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=1796195716; b=wwUCYnbOvcYcob3SPby0ku3RWxFLbdQJo7P9FYbQvbijIGQzye1TZPNiY01YuIjmIvb3 ACTriCfAEEaugRxr2W9T5N6WiXa4xQ99ZkKbTHw5XRyK+EiK3GhBio9nLQY2DxM0NhZjg zgnA2ASIblYgigsf11NyCcOTYNr091TXnvA4fyp93EQXwTKri9pKQTFP43t5F41tblb6F LPpQckpRJrk82lPSZVsfPrvfP3QXFDQZCZ1gS0vYZQzIosML40nCIoYdzfXyPD0KDVPtj qh+jFnh73p10ArR2bS7x0eoWeu6V0AxqG7/zq9WgnaJ8f3NLCtAnaF6BWBVuPsbxyXQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796195716; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=D0nX8i6IQb5Q0aNTXnatPdwTVB7jzrGsqtHSjldPMCQ=; b=mVlhIvlj0w1I/P/qF+FPAfGHeOZs6jlExo9517NdfnAqJ+uFarrss9fUwbuZOGZWL2sL q539L9+g3m8nM8xtSEL17pKqqiPleKX1owOlUJgCu2mM6zYBhqOz+aYtxZJSrFTiGVhsV fXWqUWTqwa8dr5ph+SolXbvVQLRL7MRVR3QsB2Hx0weH5G5hxMLAmdJkz8932sUnutyNx wGbC1Dyf3gz9ae09aY7eDuMyLWouiWsV0eCcGKOyROORMfPZ2X0FKUKlmctqL6UYXD2p3 JnxNyPzT/vmSMBSEjC3Xn9nsIet4psymqJ5xgqRALWGBEtNDEHh6q7NV+TEIY4Edxtw== 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=l7obVZjl; 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 36C50606A323 for ; Wed, 2 Dec 2026 07:15:16 +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=l7obVZjl Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB11C1F00893; Wed, 2 Dec 2026 07:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796195716; bh=D0nX8i6IQb5Q0aNTXnatPdwTVB7jzrGsqtHSjldPMCQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=l7obVZjlnc5qcOyMcKHxRC/4jzP5/osD/aDkkAuPK+9Yf129I7AsBuJh2FE3J77DJ hJ36sYHV8+a9kOVRAjYElA1bFGzptLEhDyc9uMxgre9kqWI9zCIAokWcDMXq6rPN7d ST36fSbLMdJFtWpiC4TunN4C9umguukf4EyYWf+eamskmUJ1Px2/SkUnCs862paj3j Sn4bGtbtc/cAiZOkvxraY/LXre9vFz9vyYmrCk/SCxa3lQ7iRRhro2rcuiBO4I3hy5 sc5ys6qgsiE7lMPtUibGymO/mnO37GXzlW+5Y2jswmu7i6qtK9jkK5Kj6XGJ+5RgYA ilIcLin7s1Vww== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 2/4] ALSA: bebob: bound the stream format entries to the response length Reply-To: sashiko-reviews@lists.linux.dev To: "Maoyi Xie" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261202070452.732525-3-maoyixie.tju@gmail.com> References: <20261202070452.732525-1-maoyixie.tju@gmail.com> <20261202070452.732525-3-maoyixie.tju@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 07:15:15 +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: - [Medium] ALSA: bebob: parse_stream_formation() reads buf[0..2] before checking len -- commit fdc1d8bd20b16e5b19616e6a041bb9876894ff4c Author: Maoyi Xie ALSA: bebob: bound the stream format entries to the response length This commit checks that the stream format entry count in buf[4] fits within the response length in parse_stream_formation(). > diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/b= ebob_stream.c > index 5850357cb3dad..8eceafc70a447 100644 > --- a/sound/firewire/bebob/bebob_stream.c > +++ b/sound/firewire/bebob/bebob_stream.c > @@ -730,6 +730,10 @@ parse_stream_formation(u8 *buf, unsigned int len, > if (i =3D=3D ARRAY_SIZE(bridgeco_freq_table)) > return -ENOSYS; > =20 > + /* The entries should be within the response. */ > + if (len < 5 || len < 5 + buf[4] * 2) > + return -EIO; [Severity: Medium] Should the length check come at the start of parse_stream_formation(), before buf[0], buf[1], and buf[2] are read? avc_bridgeco_get_plug_strm_fmt() accepts FCP responses of 12 bytes or more and shifts err - 11 bytes to the start of buf, so len can be 1..4. Because parse_stream_formation() checks buf[0..2] first: sound/firewire/bebob/bebob_stream.c:parse_stream_formation() { ... if ((buf[0] !=3D 0x90) || (buf[1] !=3D 0x40)) return -ENOSYS; /* check sampling rate */ for (i =3D 0; i < ARRAY_SIZE(bridgeco_freq_table); i++) { if (buf[2] =3D=3D bridgeco_freq_table[i]) break; } ... } when len is 1 or 2, reading buf[1] and buf[2] accesses bytes past the response length (stale FCP request header bytes in fill_stream_formations(), or out of bounds if a caller passes a buffer sized to len) and returns -ENOSYS instead of -EIO. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202070452.7325= 25-1-maoyixie.tju@gmail.com?part=3D2