linux-stable/sound
Xiaomeng Tong f13ab82aeb codecs: rt5682s: fix an incorrect NULL check on list iterator
commit acc72863e0 upstream.

The bug is here:
            if (!dai) {

The list iterator value 'dai' will *always* be set and non-NULL
by for_each_component_dais(), so it is incorrect to assume that
the iterator value will be NULL if the list is empty or no element
is found (In fact, it will be a bogus pointer to an invalid struct
object containing the HEAD). Otherwise it will bypass the check
'if (!dai) {' (never call dev_err() and never return -ENODEV;)
and lead to invalid memory access lately when calling
'rt5682s_set_bclk1_ratio(dai, factor);'.

To fix the bug, just return rt5682s_set_bclk1_ratio(dai, factor);
when found the 'dai', otherwise dev_err() and return -ENODEV;

Cc: stable@vger.kernel.org
Fixes: bdd229ab26 ("ASoC: rt5682s: Add driver for ALC5682I-VS codec")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220327081300.12962-1-xiam0nd.tong@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-27 14:41:15 +02:00
..
ac97
aoa
arm
atmel
core ALSA: pcm: Test for "silence" field in struct "pcm_format_data" 2022-04-20 09:36:25 +02:00
drivers ALSA: mtpav: Don't call card private_free at probe error path 2022-04-20 09:36:16 +02:00
firewire ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction 2022-04-08 13:57:50 +02:00
hda ALSA: hda: intel-dsp-config: update AlderLake PCI IDs 2022-04-27 14:41:07 +02:00
i2c
isa ALSA: sc6000: Fix the missing snd_card_free() call at probe error 2022-04-20 09:36:11 +02:00
mips
oss
parisc
pci ALSA: hda/hdmi: fix warning about PCM count when used with SOF 2022-04-27 14:40:59 +02:00
pcmcia
ppc ALSA: ppc: beep: fix clang -Wimplicit-fallthrough 2021-12-07 15:36:56 +01:00
sh
soc codecs: rt5682s: fix an incorrect NULL check on list iterator 2022-04-27 14:41:15 +02:00
sparc ALSA: sparc: no need to initialise statics to 0 2021-12-12 10:01:04 +01:00
spi ALSA: spi: Add check for clk_enable() 2022-04-08 13:57:49 +02:00
synth ALSA: synth: missing check for possible NULL after the call to kstrdup 2021-11-09 07:18:50 +01:00
usb ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant 2022-04-27 14:41:07 +02:00
virtio virtio: wrap config->reset calls 2022-01-14 18:50:52 -05:00
x86 ALSA: intel_hdmi: Fix the missing snd_card_free() call at probe error 2022-04-20 09:36:10 +02:00
xen xen: flag xen_snd_front to be not essential for system boot 2021-11-23 13:43:54 -06:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c