From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796483033; b=vQf/0WHrL/g+O1ulittgRzAbuye6t5TWtMHM9AKe6N3SS54oYrGI9462x8bLLr/lbsNu k77axZ0WJHAg1vOMqUkH0DYAEinRuu4o74nDJKF33iZdWlzmXyvWpUCJgOE56MhT5PEfw ++SRMbcUpxYt6tNgnMirNQgwD63/lZKG0Qo3Sc8KKszr4YYpAdmD4x8CLD+DKQLEKFHdx g622fbw91te9Es0D7UZOWrm/QOXFm7Y52Ml4U7bbNmNPn/wpZwkr1Wz528jsf/G5tumv2 DhuzvrG1Tt50xZ1pbfa47qXkiCt86Ponc0DzKiDVxvJ1UafC2Ntu66L0DoWWsPA/ZEA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796483033; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=R9cF1IU6z34NOC49iVNi6pZNDf3o2MifeHGU5jq1a6s=; b=fzdRTLyfSFTfmzt8B0YoGgzQxFmzMcSbTIe/mZwFvTMP33mfHDayrzPxRPXGqevjRa3D OzzknzcME8y4YNVOAGu9DkDY1Dpj1GRavIyLHgDFVbkrYlzj7ZkGhbRMjGaUZrj6utwqT G3q6M/VUxjlhcBzIhBPb8OQl7/JcK+5A08DmPIaEwk92a15ktxfbhb4qg4oRCpjSBPouH qy6VecUEL9w54OaHnZ2DQYBVwwIMqE9tSn/Ekfbv8yds2vJENTxZAX0hCOsXePibwTEwY 0z5VjpDJpIMKHvIn8WEpl9UE9wc52GcB0gA/btGd+gcngMNoWk/PqsqUdvQ26GPB4qA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VE0UnlwF; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CA9F606A322 for ; Sat, 5 Dec 2026 15:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VE0UnlwF Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC63D1F0092B; Sat, 5 Dec 2026 15:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796483032; bh=R9cF1IU6z34NOC49iVNi6pZNDf3o2MifeHGU5jq1a6s=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VE0UnlwF2iWxm+6uFH0kzsimUBeIMc5cM2oiTtjlM1oX8Zfo/xtjxdnIhT3sX9bkt 0NdyMfK/4qIO2ZaX4CXBiPr2+CDzSVmmcdyXzowsIDGNAQJ3Cv238BYrBZQOduHKPV Olhx7lGqI0bdKWgadX/RXqmZPU30OaOuIEzyg1dUauzfFfeg+5jugj8dpF0XQ6AKuY fnurz3tkdOp5xjyH05R5L1i1pD1C8JRh/jyLFbyyZ4sCyhf4w6D3B83WiVZhFCsw1m 004mXn9/QjbxUlWK9/58nZT3jNOYOU268rYBTwODy5wdpQVUYV229X9/BA2xIx7Lin zr4xgfFJCNFCg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ALSA: firewire-lib: clear protocol pointer in amdtp_stream_destroy() Reply-To: sashiko-reviews@lists.linux.dev To: "Yuansheng Yang" <0xbeac@gmail.com> Cc: linux-sound@vger.kernel.org In-Reply-To: <20261205145351.1712358-1-0xbeac@gmail.com> References: <20261205145351.1712358-1-0xbeac@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 15:03:52 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] ALSA: firewire-lib: Fixes trailer cites wrong commit for double-free -- commit 6e9bc1c90758880ff0ccb44d4ebbd1e733d08950 Author: Yuansheng Yang <0xbeac@gmail.com> > ALSA: firewire-lib: clear protocol pointer in amdtp_stream_destroy() > > amdtp_stream_destroy() guards against destroying an uninitialized or > already-destroyed stream by checking if s->protocol is NULL, then frees > s->protocol via kfree() without resetting s->protocol to NULL. > > All ALSA FireWire drivers using snd_*_stream_init_duplex() (bebob, dice, > digi00x, fireface, fireworks, motu, oxfw, and tascam) register > card->private_free (which invokes snd_*_stream_destroy_duplex() -> > amdtp_stream_destroy()) before calling snd_*_stream_init_duplex(). When > snd_*_stream_init_duplex() fails after initializing at least one stream > (for example, when snd_efw_command_set_tx_mode() fails after tx_stream > and rx_stream have been initialized in snd_efw_stream_init_duplex(), or > on any mid-duplex stream or domain initialization error), > snd_*_stream_init_duplex() calls amdtp_stream_destroy() internally and > leaves s->protocol dangling. The driver's probe error path then calls > snd_card_free(), invoking amdtp_stream_destroy() a second time on the > already-freed pointer: > > BUG: KASAN: double-free in amdtp_stream_destroy > Call Trace: > kfree > amdtp_stream_destroy > snd_efw_stream_destroy_duplex > release_card_device > snd_card_free > > Clear s->protocol to NULL after kfree(s->protocol) in > amdtp_stream_destroy() so a second call returns early at the NULL check, > avoiding both the double kfree() and destroying s->mutex twice. > > Fixes: 44c376b9596c ("ALSA: firewire-lib: suppress kernel warnings when r= eleasing uninitialized stream data") > Cc: stable@vger.kernel.org > Signed-off-by: Yuansheng Yang <0xbeac@gmail.com> [Severity: Low] Should the Fixes tag cite df075feefbd3 ("ALSA: firewire-lib: complete AM824 data block processing layer") instead? Commit 44c376b9596c ("ALSA: firewire-lib: suppress kernel warnings when releasing uninitialized stream data") only added the early NULL check on s->protocol in amdtp_stream_destroy(). The s->protocol allocation and kfree(s->protocol) without clearing the pointer were introduced earlier by that commit, when drivers such as fireworks already registered card->private_free before duplex stream init. Pointing Fixes there keeps stable-backport tracking accurate: Fixes: df075feefbd3 ("ALSA: firewire-lib: complete AM824 data block proce= ssing layer") --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205145351.1712= 358-1-0xbeac@gmail.com?part=3D1