Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757049AbcCaQN3 (ORCPT ); Thu, 31 Mar 2016 12:13:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:53920 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbcCaQN2 (ORCPT ); Thu, 31 Mar 2016 12:13:28 -0400 Date: Thu, 31 Mar 2016 18:13:26 +0200 Message-ID: From: Takashi Iwai To: Vladis Dronov Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: Re: [PATCH] ALSA: usb-audio: Fix double-free in snd_usb_add_audio_stream() In-Reply-To: <2105584083.43718399.1459440343149.JavaMail.zimbra@redhat.com> References: <1459364602-28997-1-git-send-email-vdronov@redhat.com> <1459364602-28997-2-git-send-email-vdronov@redhat.com> <882494379.43642280.1459427790768.JavaMail.zimbra@redhat.com> <805340847.43676741.1459433035733.JavaMail.zimbra@redhat.com> <2105584083.43718399.1459440343149.JavaMail.zimbra@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1145 Lines: 30 On Thu, 31 Mar 2016 18:05:43 +0200, Vladis Dronov wrote: > > From: Vladis Dronov > Subject: [PATCH] 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" > > [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: Ralf Spenneberg > Cc: # see the note above > Signed-off-by: Vladis Dronov Applied, thanks. Takashi