Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: handle kmemdup failure in Bluetooth IRQ path
@ 2026-06-06  4:03 Ruoyu Wang
  0 siblings, 0 replies; only message in thread
From: Ruoyu Wang @ 2026-06-06  4:03 UTC (permalink / raw)
  To: Ping Cheng
  Cc: Jason Gerecke, Jiri Kosina, Benjamin Tissoires, linux-input,
	linux-kernel, Ruoyu Wang

wacom_intuos_bt_irq() duplicates the input report with kmemdup() and then
uses data[0] to dispatch the report type. If the allocation fails, the
switch statement dereferences a NULL pointer.

Handle allocation failure by dropping the report. This keeps the
interrupt path from dereferencing a NULL buffer while preserving the
existing return convention for ignored or malformed reports.

Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
 drivers/hid/wacom_wac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index da1f0ea85625d..c42af15e7dba0 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1206,6 +1206,9 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
 	int i = 1;
 	unsigned power_raw, battery_capacity, bat_charging, ps_connected;
 
+	if (!data)
+		return 0;
+
 	switch (data[0]) {
 	case 0x04:
 		if (len < 32) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-06  4:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06  4:03 [PATCH] HID: wacom: handle kmemdup failure in Bluetooth IRQ path Ruoyu Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox