From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0A58C433EF for ; Fri, 15 Jul 2022 06:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbiGOG7A (ORCPT ); Fri, 15 Jul 2022 02:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbiGOG65 (ORCPT ); Fri, 15 Jul 2022 02:58:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C2721A042 for ; Thu, 14 Jul 2022 23:58:56 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DE2961FACC; Fri, 15 Jul 2022 06:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657868334; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DZnDO4CcAUdkGtpyppGeZfipCWuBiME0nLI/4G6xB4Q=; b=sRVVlzfrcTTsuYwFIs/oCHmHnx78kZR7urfIAPvhRRDzFy5wxGO0SDOU5oLDuWVy5yN2UB tHUqi0ksbLLfH1gSh17oGGiJg8OqCieLNSsBl4/BFGcsVnN6t349/OlcjW7lMcigE5zj6n Xfrim8DhMHkIN6XQP7DWaKuKt2TlVP8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657868334; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DZnDO4CcAUdkGtpyppGeZfipCWuBiME0nLI/4G6xB4Q=; b=yT0V/N3GdixRvCWUTq68AYF284zXyke41xyygKliPXQ8dvmpB3U9dZMV/qUXxu87vrFDGk 5tT8+zkvz79GM7AQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B886613754; Fri, 15 Jul 2022 06:58:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5ydSLC4Q0WIMfgAAMHmgww (envelope-from ); Fri, 15 Jul 2022 06:58:54 +0000 Date: Fri, 15 Jul 2022 08:58:54 +0200 Message-ID: <87a69ax3o1.wl-tiwai@suse.de> From: Takashi Iwai To: Zheyu Ma Cc: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: bcd2000: Fix a UAF bug on the error path of probing In-Reply-To: <20220715010515.2087925-1-zheyuma97@gmail.com> References: <20220715010515.2087925-1-zheyuma97@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Jul 2022 03:05:15 +0200, Zheyu Ma wrote: > > When the driver fails in snd_card_register() at probe time, it will free > the 'bcd2k->midi_out_urb' before killing it, which may cause a UAF bug. > > The following log can reveal it: > > [ 50.727020] BUG: KASAN: use-after-free in bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000] > [ 50.727623] Read of size 8 at addr ffff88810fab0e88 by task swapper/4/0 > [ 50.729530] Call Trace: > [ 50.732899] bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000] > > Fix this by adding usb_kill_urb() before usb_free_urb(). > > Fixes: b47a22290d58 ("ALSA: MIDI driver for Behringer BCD2000 USB device") > Signed-off-by: Zheyu Ma Thanks, applied. Takashi