From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 DBF1E30D3F6; Thu, 16 Jul 2026 14:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210682; cv=none; b=N1+aWBl3blxXnGZ1dMV8Im1uJaM9NrUoffn7r2iPK8IM0iOy3IdMqdwMhHgL5lk2WQnloBc9ZCyuxgxGMflwfjrSbvhQs3NTjgfVpojP1qUs0ZLf8qEgoN6lwU44GaPJ5OxdSrn/j6TMmrBmdBflZptPJ+xZ6N3GbwDVpQ9+wBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210682; c=relaxed/simple; bh=2MAYfqlVJm87z4+tev0uXeoQcMVCqE1E2CayeB7sLBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eIM6dlHViFNWx3rr9GC+I0ealX2Y1QB3q+qv/GBKpDruzoFEZABQd2JHf5cPrD8IVdxaK3bSAGCC6y6ldaXPKHGgjhE35VT3r/XAcaRWgY8CznFFUYgiZW+bUQrxD+xU1b7v3nZChAVemqUczDGGtZWgPJiiwp+4E1ImnetABqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=M2S54U3z; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="M2S54U3z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D9A71F000E9; Thu, 16 Jul 2026 14:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784210681; bh=nXu9gRXBhR/fhEL/YIZ47T6WlNLcCzO85VXx1iP/ZKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=M2S54U3zdNWZj9uIIHHDkVHmGxx/CGqWc3KO/WE75I9JllCrWuY0tzkQhKnHr0WUB 2umDY1QWmrIIxxN5l6N7Dz3q7F3CSHF+A22x1rAP7P12i0wWIin32wnPYDk3N3zgcD KSfcZWPsYU5Btthiqx5EvwUaqUDeMn6IBEQhNs6Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maoyi Xie , Takashi Iwai Subject: [PATCH 6.18 096/480] ALSA: caiaq: fix out-of-bounds read in the Traktor Kontrol S4 input parser Date: Thu, 16 Jul 2026 15:27:23 +0200 Message-ID: <20260716133046.789414374@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133044.672218725@linuxfoundation.org> References: <20260716133044.672218725@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maoyi Xie commit f7f3f9fd81e7adbaa12c2e62ee07f0e094a543fd upstream. snd_usb_caiaq_tks4_dispatch() decodes the Traktor Kontrol S4 input stream in fixed 16-byte (TKS4_MSGBLOCK_SIZE) message blocks. On every iteration it advances buf and subtracts the block size while looping on "while (len)". len is urb->actual_length. That value is supplied by the device and is not guaranteed to be a multiple of 16. When a final short block leaves len between 1 and 15, the loop runs once more, reads up to buf[15], and then does "len -= TKS4_MSGBLOCK_SIZE". As len is unsigned this underflows to a huge value. The loop then keeps iterating and walking buf far past the end of the 512-byte ep4_in_buf, reading out of bounds until a bogus block id happens to be hit. Iterate only while a full message block is available. This stops the unsigned underflow and silently drops any trailing partial block, which carries no complete control value anyway. The sibling endpoint-4 parsers are not affected. The Traktor Kontrol X1 and Maschine arms in snd_usb_caiaq_ep4_reply_dispatch() floor urb->actual_length before dispatching. Fixes: 15c5ab607045 ("ALSA: snd-usb-caiaq: Add support for Traktor Kontrol S4") Cc: stable@vger.kernel.org Signed-off-by: Maoyi Xie Link: https://patch.msgid.link/178176259547.3343534.2724779296835237429@maoyixie.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/caiaq/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/usb/caiaq/input.c +++ b/sound/usb/caiaq/input.c @@ -330,7 +330,7 @@ static void snd_usb_caiaq_tks4_dispatch( { struct device *dev = caiaqdev_to_dev(cdev); - while (len) { + while (len >= TKS4_MSGBLOCK_SIZE) { unsigned int i, block_id = (buf[0] << 8) | buf[1]; switch (block_id) {