Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
Cc: perex@perex.cz, tiwai@suse.com, g@b4.vu,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] ALSA: scarlett2: Fix buffer overflow in config retrieval
Date: Sat, 17 Jan 2026 09:33:15 +0100	[thread overview]
Message-ID: <87zf6cbpv8.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260117012706.1715574-1-samasth.norway.ananda@oracle.com>

On Sat, 17 Jan 2026 02:27:06 +0100,
Samasth Norway Ananda wrote:
> 
> The scarlett2_usb_get_config() function has a logic error in the
> endianness conversion code that can cause buffer overflows when
> count > 1.
> 
> The code checks `if (size == 2)` where `size` is the total buffer size in
> bytes, then loops `count` times treating each element as u16 (2 bytes).
> This causes the loop to access `count * 2` bytes when the buffer only
> has `size` bytes allocated.
> 
> Fix by checking the element size (config_item->size) instead of the
> total buffer size. This ensures the endianness conversion matches the
> actual element type.
> 
> Fixes: ac34df733d2d ("ALSA: usb-audio: scarlett2: Update get_config to do endian conversion")
> Cc: stable@vger.kernel.org
> Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>

Applied now.  Thanks.


Takashi

      reply	other threads:[~2026-01-17  8:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-17  1:27 [PATCH RESEND] ALSA: scarlett2: Fix buffer overflow in config retrieval Samasth Norway Ananda
2026-01-17  8:33 ` Takashi Iwai [this message]

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=87zf6cbpv8.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=g@b4.vu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=samasth.norway.ananda@oracle.com \
    --cc=tiwai@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox