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=1796491425; b=28AFwCk0JhxKF+yAR/dfVPNoirO4bIIGb3MfmSsYBOSkWD2wkUUMzJ88jpJqCMtJZOXP kcQPq3b7VdzqpJmXGOEsIY+i7SFxi3ZybNHV1PCoRdH5W3ecoVizUgZQJi2GfQiI9H5cS ijQC+iZMWF21hQJp1t8+RNy5mUgXeNhyKYhtNhWN0d5QxJ6Lt9uPR8X56/R/PUFQ9xQGT qMGARVGRDCafazeZdsApschuJzRPpDSE2luspSNZDZwmjQPv0S4xOJW6EFZkposxbWYn+ rA4utAIAZ0dW3VjrO1KJJSMcQLq/C/o+PZj6yQfQV6ar8nDQVenDcsZ8pAEny9KOIIQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796491425; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=5I2Nqf3uLa40S6P1C0EzgBAplc8rSK5enOaZxVOhFOI=; b=5XaRRS6VHJdIHOg/Q8BBg/r+K6AzLMG7cQwm8MdvikMelMUsxylo//UM1IwUR+kQQq3W JpmQ1uzgstggsEPFpKiZBJXDwyKk4iSdZVzaxCO5wLwAmdO6bXpIKn4qxfkMr0X/v9ky9 n3SEcRksUzkNtLoLGo6dWcBuQEiF6dkqMW7zrJsVJb8ih29tfaNUCBejjms6DEWWoIfRC nNY7irvBOxY2q5UEjmfg4sl0q0wZZImKw4rw++ULq4B4DO16aBTvPAJWPUb4tUJo6mLBy OSMuo/b4aI9J2pQWFVfHYEKg8vqXtJ7EaStxtGiWs2rQLjxotGL6vJEn1c5eiwTxdaQ== 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=lhGnxQp+; 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 183F3606A322 for ; Sat, 5 Dec 2026 17:23:44 +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=lhGnxQp+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id A65741F00936; Sat, 5 Dec 2026 17:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796491424; bh=5I2Nqf3uLa40S6P1C0EzgBAplc8rSK5enOaZxVOhFOI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=lhGnxQp+gc72du5uAC3jjMJ28n1NcUABxmvZRD6kd+rnisRAlA7zUeDY44Khnvu85 iyGG+BEgN5XCH64mRUoSKWrT75gMBhm4GDPBF+S4Jl2rne1uChyM3lMotJkl3vvHJM 8b4sjrQdM3X3eUSH+E74mVGbvfFU0YIX2vhmO5kPC2tLDbGUj0fp+P6RezDgREDUtj Ly5b2ThSrgbElnved8N/hmSqjwtv92n3W1XtM+OqEdhPdxGoKMyZ+vroc9VIZM+8PV TXKwzl6X8clqN9Tx10cm9yU4RvR+1jFtdkgdj7HMPCEqZGuJZi9EdKRfxPoTJacruN 5/FdbrfcfVJBg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 2/3] 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: <20261206-firewire-avc-bounds-v4-2-d90e91e0088e@gmail.com> References: <20261206-firewire-avc-bounds-v4-0-d90e91e0088e@gmail.com> <20261206-firewire-avc-bounds-v4-2-d90e91e0088e@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 17:23:44 +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 d3d080432ed80d2e85b65474995acaba610e99c9 Author: Maoyi Xie ALSA: bebob: bound the stream format entries to the response length This commit adds a length check in parse_stream_formation() so that the stream format entries counted by buf[4] are validated against len before the parsing loop runs. > 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] Does parse_stream_formation() still read buf[0..2] before checking len? avc_bridgeco_get_plug_strm_fmt() accepts FCP responses down to 12 bytes, shifts the payload with memmove(buf, buf + 11, err - 11), and sets *len =3D err - 11. For a 12- or 13-byte response (len of 1 or 2), parse_stream_formation() reads stale AV/C header bytes in buf[1] or buf[2] past len and returns -ENOSYS instead of -EIO, making the new len < 5 check unreachable for len <=3D 2. Checking len < 5 before inspecting buf[0..2] would avoid reading past len and return -EIO consistently for truncated responses. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206-firewire-a= vc-bounds-v4-0-d90e91e0088e@gmail.com?part=3D2