summaryrefslogtreecommitdiff
path: root/sound/usb/mixer_us16x08.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-02-22 08:00:25 +0100
committerTakashi Iwai <tiwai@suse.de>2017-02-22 14:24:09 +0100
commite2810d76c5f3b0152fa0f7c40170e123b33e058c (patch)
tree4842d37a6231ced8c5bf33a87561adbf21282f7e /sound/usb/mixer_us16x08.h
parent89b593c30e83ee19b7e7c6c7d6092669bebf343e (diff)
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: d2bb390a2081 ("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>
Diffstat (limited to 'sound/usb/mixer_us16x08.h')
-rw-r--r--sound/usb/mixer_us16x08.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/sound/usb/mixer_us16x08.h b/sound/usb/mixer_us16x08.h
index 64f89b5eca2d..a6312fb0f962 100644
--- a/sound/usb/mixer_us16x08.h
+++ b/sound/usb/mixer_us16x08.h
@@ -112,7 +112,6 @@ struct snd_us16x08_control_params {
int type;
int num_channels;
const char *name;
- void (*freeer)(struct snd_kcontrol *kctl);
int default_val;
};