]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ALSA: cs4236: fix an incorrect NULL check on list iterator
authorXiaomeng Tong <xiam0nd.tong@gmail.com>
Sun, 27 Mar 2022 06:08:22 +0000 (14:08 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:37:34 +0000 (14:37 +0200)
commit9ace4d52ea6c52b474982b449866124f688edda0
treed01e2d128e1bd683ac5c44c78c1c16f5d941428f
parent3c332f495ff6f9d7524d6e31226bb2976841eddd
ALSA: cs4236: fix an incorrect NULL check on list iterator

BugLink: https://bugs.launchpad.net/bugs/1969110
commit 0112f822f8a6d8039c94e0bc9b264d7ffc5d4704 upstream.

The bug is here:
err = snd_card_cs423x_pnp(dev, card->private_data, pdev, cdev);

The list iterator value 'cdev' will *always* be set and non-NULL
by list_for_each_entry(), so it is incorrect to assume that the
iterator value will be NULL if the list is empty or no element
is found.

To fix the bug, use a new variable 'iter' as the list iterator,
while use the original variable 'cdev' as a dedicated pointer
to point to the found element. And snd_card_cs423x_pnp() itself
has NULL check for cdev.

Cc: stable@vger.kernel.org
Fixes: c2b73d1458014 ("ALSA: cs4236: cs4232 and cs4236 driver merge to solve PnP BIOS detection")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220327060822.4735-1-xiam0nd.tong@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit cf4cd2a5d0ae13ccdc7efff4dbf6ecab4f9428bd)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
sound/isa/cs423x/cs4236.c