WSL2-Linux-Kernel/sound/isa/cs423x
Xiaomeng Tong cf4cd2a5d0 ALSA: cs4236: fix an incorrect NULL check on list iterator
commit 0112f822f8 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: c2b73d1458 ("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>
2022-04-08 14:22:55 +02:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
cs4231.c ALSA: cs423x: Allocate resources with device-managed APIs 2021-07-19 16:17:19 +02:00
cs4236.c ALSA: cs4236: fix an incorrect NULL check on list iterator 2022-04-08 14:22:55 +02:00
cs4236_lib.c ALSA: wss: Allocate resources with device-managed APIs 2021-07-19 16:17:13 +02:00