Skip to content
Commit 54eaf9b8 authored by Vladis Dronov's avatar Vladis Dronov Committed by Gerrit - the friendly Code Review server
Browse files

ALSA: usb-audio: Fix double-free in error paths after snd_usb_add_audio_stream() call

create_fixed_stream_quirk(), snd_usb_parse_audio_interface() and
create_uaxx_quirk() functions allocate the audioformat object by themselves
and free it upon error before returning. However, once the object is linked
to a stream, it's freed again in snd_usb_audio_pcm_free(), thus it'll be
double-freed, eventually resulting in a memory corruption.

This patch fixes these failures in the error paths by unlinking the audioformat
object before freeing it.

Based on a patch by Takashi Iwai <tiwai@suse.de>

[Note for stable backports:
 this patch requires the commit 902eb7fd1e4a ('ALSA: usb-audio: Minor
 code cleanup in create_fixed_stream_quirk()')]

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1283358


Reported-by: default avatarRalf Spenneberg <ralf@spenneberg.net>
Cc: <stable@vger.kernel.org> # see the note above
Signed-off-by: default avatarVladis Dronov <vdronov@redhat.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Change-Id: Ie36a8b7ce9e03e0db028251ed6ee78ee978ed4f3
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git


Git-commit: 836b34a935abc91e13e63053d0a83b24dfb5ea78
[rsiddoji@codeaurora.org : resolved some minor confilts ]
Signed-off-by: default avatarRavi Kumar Siddojigari <rsiddoji@codeaurora.org>
parent 2497ca84
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment