Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp190476imw; Fri, 15 Jul 2022 00:44:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sFclZt8mQeFZBuvaFz4y9I1xmgisaLD+IitYAmAWR+2Lpmdk8q2DM9uEN9sSXCR/lKVgSq X-Received: by 2002:a17:90b:268f:b0:1ef:ba7e:3fe4 with SMTP id pl15-20020a17090b268f00b001efba7e3fe4mr14378266pjb.23.1657871043661; Fri, 15 Jul 2022 00:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657871043; cv=none; d=google.com; s=arc-20160816; b=q43rO8sBc/R03s3UH+II020LVv9xpf2loS5CcBTna5FZpZO2zbXdcA9GQFVWCGJO7T V1uXYWBX3aTSHCggiT+Jdqlim6sK4v0AGzCZaiNMRHZtqgsJFPUPrWckkyPdJ4El986h 106ToSJOhHreLz7rQc8yuphlnhG2j2hFwIiw0xY3dArZAwBguuMqXlb400al+nkPOCMG W1xJV/KRPMEZkqc/fYVGpKMbvwrVksBW2Uh3t7/36Uq7JFSjiJMzDs6Q3beBv6TvJquZ c34TVtC+4XwojI+h4dt0te4IE1eLz1hstwHzKpNYc5WHoVlnIJyKtoSQp1OwS7b9rCuW /K5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=DZnDO4CcAUdkGtpyppGeZfipCWuBiME0nLI/4G6xB4Q=; b=myDdwgzMSdXVYMpsoIhIicfyecV6pWzVRnA5S0xSH9XyR2eqej62ppac4TA/vnM7YW VuKkoyul2c9Vn1h94OCoBdtp49Cf/3iWq6jS/xAqyaPh2XFQN1CW0tyd8M1tFrOEsI0O dNpo3gpn9iRRhRHIUj1Mn/AwOBHm/GU6VTxjDuqFSMY9yam/kVx1eJRcmMlv8uxas8Kk F62UZ61uSF9h7pK9bXscE+edZ9MIzEgCXM6mSXDUZ3JXuZPGRp5lE1Z4HIk4uyqaWEk/ tFJEfEQH0OYeF5UHsVPThqNybtX3EI2XbzR3aV4jP1/gBL+ob1SFjusjWcDW47pe39p0 ggMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=sRVVlzfr; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="yT0V/N3G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a65460a000000b00415dfc1e0f8si4901646pgq.143.2022.07.15.00.43.48; Fri, 15 Jul 2022 00:44:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=sRVVlzfr; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="yT0V/N3G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230348AbiGOG67 (ORCPT + 99 others); Fri, 15 Jul 2022 02:58:59 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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