kernel_optimize_test/sound/usb
Xiyu Yang 59e1947ca0 ALSA: usb-audio: Fix usb audio refcnt leak when getting spdif
snd_microii_spdif_default_get() invokes snd_usb_lock_shutdown(), which
increases the refcount of the snd_usb_audio object "chip".

When snd_microii_spdif_default_get() returns, local variable "chip"
becomes invalid, so the refcount should be decreased to keep refcount
balanced.

The reference counting issue happens in several exception handling paths
of snd_microii_spdif_default_get(). When those error scenarios occur
such as usb_ifnum_to_if() returns NULL, the function forgets to decrease
the refcnt increased by snd_usb_lock_shutdown(), causing a refcnt leak.

Fix this issue by jumping to "end" label when those error scenarios
occur.

Fixes: 447d6275f0 ("ALSA: usb-audio: Add sanity checks for endpoint accesses")
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1587617711-13200-1-git-send-email-xiyuyang19@fudan.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-23 09:10:05 +02:00
..
6fire
bcd2000
caiaq
hiface
line6
misc
usx2y ALSA: usx2y: Fix potential NULL dereference 2020-04-21 08:00:41 +02:00
card.c
card.h
clock.c
clock.h
debug.h
endpoint.c
endpoint.h
format.c ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices 2020-04-18 21:08:39 +02:00
format.h
helper.c
helper.h
Kconfig
Makefile
media.c
media.h
midi.c ALSA: usb-audio: Fix case when USB MIDI interface has more than one extra endpoint descriptor 2020-03-31 14:34:28 +02:00
midi.h
mixer_maps.c ALSA: usb-audio: Add connector notifier delegation 2020-04-22 13:33:46 +02:00
mixer_quirks.c ALSA: usb-audio: Fix usb audio refcnt leak when getting spdif 2020-04-23 09:10:05 +02:00
mixer_quirks.h
mixer_s1810c.c
mixer_s1810c.h
mixer_scarlett_gen2.c
mixer_scarlett_gen2.h
mixer_scarlett.c
mixer_scarlett.h
mixer_us16x08.c
mixer_us16x08.h
mixer.c ALSA: usb-audio: Add connector notifier delegation 2020-04-22 13:33:46 +02:00
mixer.h ALSA: usb-audio: Add connector notifier delegation 2020-04-22 13:33:46 +02:00
pcm.c
pcm.h
power.c
power.h
proc.c
proc.h
quirks-table.h ALSA: usb-audio: Add quirk for Focusrite Scarlett 2i2 2020-04-21 07:58:54 +02:00
quirks.c ALSA: usb-audio: Apply async workaround for Scarlett 2i4 2nd gen 2020-04-21 21:30:28 +02:00
quirks.h
stream.c
stream.h
usbaudio.h
validate.c