linux-stable/sound/usb
Takashi Iwai e2810d76c5 ALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.c
There are a few places leaking memory and doing double-free in
mixer_us16x08.c.

The driver allocates a usb_mixer_elem_info object at each
add_new_ctl() call.  This has to be freed via kctl->private_free, but
currently this is done properly only for some controls.

Also, the driver allocates three external objects (comp_store,
eq_store, meter_store), and these are referred in elem->private_data
(it's not kctl->private_data).  And these have to be released, but
there are none doing it.  Moreover, these extra objects have to be
released only once.  Thus the release should be done only by the first
kctl element that refers to it.

For fixing these, we call either snd_usb_mixer_elem_free() (only for
kctl->private_data) or elem_private_free() (for both
kctl->private_data and elem->private_data) via kctl->private_free
appropriately.

Last but not least, snd_us16x08_controls_create() may return in the
middle without releasing the allocated *_store objects due to an
error.  For fixing this, we shuffle the allocation code so that it's
called just before its reference.

Fixes: d2bb390a20 ("ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk")
Reported-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-02-22 14:24:09 +01:00
..
6fire ALSA: usb: Constify snd_rawmidi_ops 2017-01-12 12:50:48 +01:00
bcd2000 ALSA: usb: Constify snd_rawmidi_ops 2017-01-12 12:50:48 +01:00
caiaq ALSA: usb: Constify snd_rawmidi_ops 2017-01-12 12:50:48 +01:00
hiface ALSA: hiface: Fix M2Tech hiFace driver sampling rate change 2016-12-12 22:46:43 +01:00
line6 ALSA: line6: Always setup isochronous transfer properties 2017-02-07 09:40:49 +01:00
misc ALSA: ua101: replace le16_to_cpu() with usb_endpoint_maxp() 2015-11-16 09:03:06 +01:00
usx2y ALSA: usx2y: fix inconsistent indenting on if statement 2015-12-02 18:03:24 +01:00
card.c ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() 2016-11-29 22:28:40 +01:00
card.h ALSA: usb: use TEAC UD-H01 quirk for more devices 2016-08-22 11:39:56 +02:00
clock.c ALSA: usb-audio: Limit retrying sample rate reads 2016-04-29 11:49:04 +02:00
clock.h ALSA: usb-audio: UAC2: do clock validity check earlier 2013-04-04 08:30:59 +02:00
debug.h ALSA: usb-audio: make hwc_debug a noop in case HW_CONST_DEBUG is not set 2011-05-18 11:44:35 +02:00
endpoint.c ALSA: usb-audio: test EP_FLAG_RUNNING at urb completion 2017-01-05 07:35:17 +01:00
endpoint.h ALSA: usb-audio: Fix irq/process data synchronization 2017-01-05 07:35:00 +01:00
format.c ALSA: usb-audio: rmove print for failure of kmalloc 2016-08-22 11:41:02 +02:00
format.h ALSA: usb-audio: store protocol version in struct audioformat 2013-06-27 21:59:47 +02:00
helper.c ALSA: usb-audio: correct speed checking 2016-05-08 11:42:04 +02:00
helper.h ALSA: usb-audio: increase control transfer timeout 2011-09-27 09:21:48 +02:00
Kconfig [media] Revert "[media] sound/usb: Use Media Controller API to share media resources" 2016-03-31 15:02:33 -03:00
Makefile ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk 2017-02-20 10:59:54 +01:00
midi.c ALSA: usb: Constify snd_rawmidi_ops 2017-01-12 12:50:48 +01:00
midi.h ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation 2016-01-29 07:36:10 +01:00
mixer.c ALSA: usb-audio: Add QuickCam Communicate Deluxe/S7500 to volume_control_quirks 2016-12-09 11:21:02 +01:00
mixer.h [media] Revert "[media] sound/usb: Use Media Controller API to share media resources" 2016-03-31 15:02:33 -03:00
mixer_maps.c ALSA: usb-audio: Change structure initialisation to C99 style 2016-06-17 16:58:41 +02:00
mixer_quirks.c ALSA: usb-audio: Tascam US-16x08 DSP mixer quirk 2017-02-20 10:59:54 +01:00
mixer_quirks.h ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly 2015-12-14 10:13:17 +01:00
mixer_scarlett.c ALSA: usb-audio: Fix Scarlett 6i6 initialization typo 2014-12-18 08:39:17 +01:00
mixer_scarlett.h ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 2014-11-13 07:32:39 +01:00
mixer_us16x08.c ALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.c 2017-02-22 14:24:09 +01:00
mixer_us16x08.h ALSA: usb-audio: Fix memory leak and corruption in mixer_us16x08.c 2017-02-22 14:24:09 +01:00
pcm.c ALSA: usb-audio: Fix irq/process data synchronization 2017-01-05 07:35:00 +01:00
pcm.h ALSA: usb: refine delay information with USB frame counter 2011-09-12 10:30:20 +02:00
power.h ALSA: usbaudio: implement USB autosuspend 2011-03-11 14:59:29 +01:00
proc.c ALSA: usb-audio: Avoid nested autoresume calls 2015-08-26 15:38:25 +02:00
proc.h ALSA: usb-audio: refactor code 2010-03-05 08:17:14 +01:00
quirks-table.h ALSA: usb-audio: Add quirk for Syntek STK1160 2016-10-27 12:07:19 +02:00
quirks.c Merge branch 'topic/intel-lpe-audio' into for-next 2017-01-25 22:11:17 +01:00
quirks.h ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation 2016-01-29 07:36:10 +01:00
stream.c media fixes for v4.6-rc2 2016-04-05 06:47:50 -07:00
stream.h ALSA: snd-usb: re-order code 2011-09-14 17:07:02 +02:00
usbaudio.h Merge branch 'for-linus' into for-next 2016-05-10 16:06:04 +02:00