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 E8BAF3D411F; Wed, 8 Apr 2026 18:29:16 +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=1775672957; cv=none; b=m9q7xatUh9biSO5gpGMxycqWfxeAQWRc+i3vT29gERdvHv/NtqunVkTPKSNWwVKdI2jwDe2eVUF3eBjlyVjgIAu26nNRGlt+uzzi045Nf0C9dJXET72nFROkXjw7rAWsJ+u+Okb4I3PbmymNUiiMtr1HQIqa+UwdGbLxZQAumtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775672957; c=relaxed/simple; bh=3naH0bNCqlPKz7PJL4NqObSOPDYQEn28HldCYmOeqGo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HyE0aTOBctJYzBfRcmUNFtDjxdka1hGwzzINTBxBU5J/X4AW+FpGW4tPXOfHY//KRms8357UyDSnGCijySZBfTobHhFfpn/Z8Ui7BbWMRbNQjskY+BfzSau1Pv3ltCkAyN7sUCtBfyBK2Anv+o2XzUPRrjpoowsHuyeTGC2vajM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kVUHcDbW; 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="kVUHcDbW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EC26C19421; Wed, 8 Apr 2026 18:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775672956; bh=3naH0bNCqlPKz7PJL4NqObSOPDYQEn28HldCYmOeqGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVUHcDbW/1wZNWNsbtaihtlGli4WfLR7lZm0Kn6iInJw3zmB+6Q9utTu6zK6pyKCh acPL86rsMPvgtKfNUEWRDsPcuM+rlQmWjFaEb2NIjFsgPahY5Qhw/oVJ4GxGWFjb/+ KeBXwGj2sIvzVEDh0GK7g2fzwZcNgq/Fl0axhSZ4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Beno=C3=AEt=20Sevens?= , Jason Gerecke , Jiri Kosina , Sasha Levin Subject: [PATCH 6.18 004/277] HID: wacom: fix out-of-bounds read in wacom_intuos_bt_irq Date: Wed, 8 Apr 2026 19:59:49 +0200 Message-ID: <20260408175934.007289656@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175933.836769063@linuxfoundation.org> References: <20260408175933.836769063@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benoît Sevens [ Upstream commit 2f1763f62909ccb6386ac50350fa0abbf5bb16a9 ] The wacom_intuos_bt_irq() function processes Bluetooth HID reports without sufficient bounds checking. A maliciously crafted short report can trigger an out-of-bounds read when copying data into the wacom structure. Specifically, report 0x03 requires at least 22 bytes to safely read the processed data and battery status, while report 0x04 (which falls through to 0x03) requires 32 bytes. Add explicit length checks for these report IDs and log a warning if a short report is received. Signed-off-by: Benoît Sevens Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/wacom_wac.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 9b2c710f8da18..da1f0ea85625d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1208,10 +1208,20 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len) switch (data[0]) { case 0x04: + if (len < 32) { + dev_warn(wacom->pen_input->dev.parent, + "Report 0x04 too short: %zu bytes\n", len); + break; + } wacom_intuos_bt_process_data(wacom, data + i); i += 10; fallthrough; case 0x03: + if (i == 1 && len < 22) { + dev_warn(wacom->pen_input->dev.parent, + "Report 0x03 too short: %zu bytes\n", len); + break; + } wacom_intuos_bt_process_data(wacom, data + i); i += 10; wacom_intuos_bt_process_data(wacom, data + i); -- 2.53.0