From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C8F355024 for ; Tue, 27 Jan 2026 13:11:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769519466; cv=none; b=TI+SkLGck1oqqXsXdfCL9o2aWBKuIMxjRumLcp1BDn3mmdjdlgg0iBrZ8AJnZr0Z+Jg55Q7xlMuRrIHMd1LKI1WTps8PSRP8ZOQelVZZaQUAoBd0i0K9sVGFellxHh16oCe0qX93K1spTTXjnQBwIAOexFN7oJP3tu+OMkAYrfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769519466; c=relaxed/simple; bh=BSUOERwWp+IAYi6GSsD6gq1okWZePOPqJjDYBL7vTRI=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=QQLyILFiXkdrh/c1O5gQxbJmx9ep7vLMnhfB6TGJC6UXtvsgOloKO4T1hYTK1OgnsDDCexbKV3lPP944WxcWQ19mywCnLBMG8C8P59g0b8DREqU5wO9t0NqgwO0IlPNeqKAz0EbAat35o3yK6ynjeTjsKSDGgKCB5ntNYJkI/bE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=A/c/TGtD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="A/c/TGtD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16FBFC16AAE; Tue, 27 Jan 2026 13:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769519465; bh=BSUOERwWp+IAYi6GSsD6gq1okWZePOPqJjDYBL7vTRI=; h=Subject:To:Cc:From:Date:From; b=A/c/TGtDsmDfLVmioAuD+At2FuYNahMXEjF+LYsCg49gw7mw5uTCTXEyKWJ8pH7Rn WS/CCYNMJa/4WnxFSjGi6qZNZ86U6PErMQ1mUHdBvBYRx9N27zzFdpPV32LnG6k64+ Hv1I35hSva+/JBS9cW5BvUlHhiCfaqpl7tKMs2o8= Subject: FAILED: patch "[PATCH] ALSA: scarlett2: Fix buffer overflow in config retrieval" failed to apply to 6.6-stable tree To: samasth.norway.ananda@oracle.com,tiwai@suse.de Cc: From: Date: Tue, 27 Jan 2026 14:11:02 +0100 Message-ID: <2026012702-happier-luckily-8c7d@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 6f5c69f72e50d51be3a8c028ae7eda42c82902cb # git commit -s git send-email --to '' --in-reply-to '2026012702-happier-luckily-8c7d@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 6f5c69f72e50d51be3a8c028ae7eda42c82902cb Mon Sep 17 00:00:00 2001 From: Samasth Norway Ananda Date: Fri, 16 Jan 2026 17:27:06 -0800 Subject: [PATCH] ALSA: scarlett2: Fix buffer overflow in config retrieval 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 Link: https://patch.msgid.link/20260117012706.1715574-1-samasth.norway.ananda@oracle.com Signed-off-by: Takashi Iwai diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c index f2446bf3982c..bef8c9e544dd 100644 --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -2533,13 +2533,13 @@ static int scarlett2_usb_get_config( err = scarlett2_usb_get(mixer, config_item->offset, buf, size); if (err < 0) return err; - if (size == 2) { + if (config_item->size == 16) { u16 *buf_16 = buf; for (i = 0; i < count; i++, buf_16++) *buf_16 = le16_to_cpu(*(__le16 *)buf_16); - } else if (size == 4) { - u32 *buf_32 = buf; + } else if (config_item->size == 32) { + u32 *buf_32 = (u32 *)buf; for (i = 0; i < count; i++, buf_32++) *buf_32 = le32_to_cpu(*(__le32 *)buf_32);