kernel_optimize_test/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
usx2y
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
debug.h
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
helper.c ALSA: usb-audio: correct speed checking 2016-05-08 11:42:04 +02:00
helper.h
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_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
mixer_scarlett.c
mixer_scarlett.h
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
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
pcm.c ALSA: usb-audio: Fix irq/process data synchronization 2017-01-05 07:35:00 +01:00
pcm.h
power.h
proc.c
proc.h
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
usbaudio.h Merge branch 'for-linus' into for-next 2016-05-10 16:06:04 +02:00