All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maoyi Xie" <maoyixie.tju@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH 2/3] ALSA: bebob: bound the stream format entries to the response length
Date: Wed, 25 Nov 2026 12:20:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-233354@kernel.org> (raw)
In-Reply-To: <20261125121238.1602172-3-maoyixie.tju@gmail.com>

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 e6e7f1e1f29ad5a2012df4b6e2f6ca27670bc0c9
Author: Maoyi Xie <maoyixie.tju@gmail.com>

ALSA: bebob: bound the stream format entries to the response length

This commit checks in parse_stream_formation() that the stream format
entries described by buf[4] fit within the response length len, returning
-EIO otherwise.

> diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_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 == ARRAY_SIZE(bridgeco_freq_table))
>  		return -ENOSYS;
>  
> +	/* 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 reading buf[0], buf[1] and buf[2]?

avc_bridgeco_get_plug_strm_fmt() accepts FCP responses of 12 bytes or
more, shifts err - 11 bytes to the front of buf, and sets *len = err - 11.
When len is 1..4, parse_stream_formation() reads buf[0..2] past the
len-byte response (hitting leftover request bytes in buf when len <= 2)
and can return -ENOSYS before reaching the len < 5 check.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125121238.1602172-1-maoyixie.tju@gmail.com?part=2

  reply	other threads:[~2026-11-25 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 12:12 [PATCH 0/3] ALSA: bebob/oxfw: bound AV/C response walks to the response length Maoyi Xie
2026-11-25 12:12 ` [PATCH 1/3] ALSA: bebob: bound the channel position walk " Maoyi Xie
2026-11-25 12:12 ` [PATCH 2/3] ALSA: bebob: bound the stream format entries " Maoyi Xie
2026-11-25 12:20   ` sashiko-bot [this message]
2026-11-25 12:12 ` [PATCH 3/3] ALSA: oxfw: " Maoyi Xie
2026-11-28  7:09   ` Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-233354@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=maoyixie.tju@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.