* [PATCH v2 00/10] HID: Fix race conditions, UAFs, and bounds bugs
@ 2026-11-27 17:06 Lee Jones
2026-11-27 17:06 ` [PATCH v2 09/10] HID: debug: Hold driver_input_lock while dumping raw report descriptor Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Lee Jones @ 2026-11-27 17:06 UTC (permalink / raw)
To: lee, bpf
Cc: linux-kernel, Barnabás Pőcze, Benoît Sevens,
Filipe Laíns, He, Bo, K. Y. Srinivasan, Zhang, Jun,
Andreas Gal, Andy Shevchenko, Bastien Nocera, Benjamin Tissoires,
Charles Wang, Dexuan Cui, Dmitry Torokhov, Haiyang Zhang,
Jason Gerecke, Jiangshan Yi, Jiri Kosina, Jonathan Cameron,
linux-hyperv, linux-i2c, linux-iio, linux-input, Lopez Casado,
Marcel Holtmann, message to, Michael Bommarito, Michael Haboustak,
Pan Chuang, Ping Cheng, Rishi Gupta, Roderick Colenbrander,
Srinivas Pandruvada, Stefan Achatz, Tianchu Chen, Vojtech Pavlik,
Wei Liu, Zhang Lixu
These issues were reported by Sashiko.
This v2 series addresses Srinivas Pandruvada's review feedback on
hid-sensor-hub and collects Reviewed-by and Tested-by tags from v1.
v1 => v2:
- Drop kfree() from sensor_hub_raw_event() and clear hsdev->pending.status before complete() under data->lock in patch 04, per Srinivas Pandruvada's review.
- Add Hamza Mahfooz's Reviewed-by tag on patch 06.
- Add Ping Cheng's Reviewed-by and Tested-by tags on patch 08.
Cc: "Barnabás Pőcze" <pobrn@protonmail.com>
Cc: "Benoît Sevens" <bsevens@google.com>
Cc: "Filipe Laíns" <lains@riseup.net>
Cc: "He, Bo" <bo.he@intel.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: "Zhang, Jun" <jun.zhang@intel.com>
Cc: Andreas Gal <gal@cs.uni-magdeburg.de>
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Bastien Nocera <hadess@hadess.net>
Cc: Benjamin Tissoires <bentiss@kernel.org>
Cc: bpf@vger.kernel.org
Cc: Charles Wang <charles.goodix@gmail.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Jason Gerecke <jason.gerecke@wacom.com>
Cc: Jiangshan Yi <yijiangshan@kylinos.cn>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-hyperv@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-iio@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: Lopez Casado <nlopezcasad@logitech.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: message to <vojtech@ucw.cz>
Cc: Michael Bommarito <michael.bommarito@gmail.com>
Cc: Michael Haboustak <mike-@cinci.rr.com>
Cc: Pan Chuang <panchuang@vivo.com>
Cc: Ping Cheng <ping.cheng@wacom.com>
Cc: Rishi Gupta <gupt21@gmail.com>
Cc: Roderick Colenbrander <roderick.colenbrander@sony.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Stefan Achatz <erazor_de@users.sourceforge.net>
Cc: Tianchu Chen <flynnnchen@tencent.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Zhang Lixu <lixu.zhang@intel.com>
Lee Jones (10):
HID: core: Protect hid->inputs traversal in hid_check_keys_pressed()
HID: mcp2221: Synchronise rxbuf access against raw_event callback
HID: logitech-hidpp: Synchronise send_receive_buf against raw events
HID: sensor-hub: Serialise synchronous read teardown under data->lock
HID: roccat: pyra: Resolve USB device from parent in actual_profile
HID: hyperv: Validate VMBus packet and payload bounds on receive
HID: hid-goodix-spi: Validate package sizes in goodix_hid_irq()
HID: wacom: Stop HID hardware before releasing resources on mode
change
HID: debug: Hold driver_input_lock while dumping raw report descriptor
HID: playstation: Cancel DualSense output worker on create failure
drivers/hid/hid-core.c | 16 ++++++---
drivers/hid/hid-debug.c | 12 ++++---
drivers/hid/hid-goodix-spi.c | 34 +++++++++++++------
drivers/hid/hid-hyperv.c | 12 +++++++
drivers/hid/hid-logitech-hidpp.c | 58 +++++++++++++++++++++-----------
drivers/hid/hid-mcp2221.c | 47 ++++++++++++++------------
drivers/hid/hid-playstation.c | 1 +
drivers/hid/hid-roccat-pyra.c | 9 +++--
drivers/hid/hid-sensor-hub.c | 29 ++++++++++++----
drivers/hid/wacom_sys.c | 4 +--
10 files changed, 150 insertions(+), 72 deletions(-)
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 09/10] HID: debug: Hold driver_input_lock while dumping raw report descriptor
2026-11-27 17:06 [PATCH v2 00/10] HID: Fix race conditions, UAFs, and bounds bugs Lee Jones
@ 2026-11-27 17:06 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-11-27 17:06 UTC (permalink / raw)
To: lee, Jiri Kosina, Benjamin Tissoires, Andreas Gal, Vojtech Pavlik,
Zhang, Jun, He, Bo, linux-input, linux-kernel, bpf
Cc: stable
hid_debug_rdesc_show() reads hdev->rdesc and hdev->rsize and formats
the raw report descriptor before acquiring hdev->driver_input_lock.
When a HID driver with report_fixup() unbinds or HID-BPF reprobes the
device, hid_device_remove() and __hid_device_probe() free hdev->rdesc
and hdev->bpf_rdesc under hdev->driver_input_lock while the debugfs
entry remains accessible, causing a use-after-free in
hid_debug_rdesc_show().
Acquire hdev->driver_input_lock at the start of hid_debug_rdesc_show()
before reading hdev->rdesc and hdev->rsize.
Fixes: cef0d4948cb0 ("HID: debug: fix race condition with between rdesc_show() and device removal")
Closes: https://sashiko.dev/#/bug/linux-31c0bbf2-e4e7-41e6-ab3b-0d17dfe45389
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
v1 => v2:
- No changes.
drivers/hid/hid-debug.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index f44e6e708404..56207dea4aa7 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -3654,10 +3654,15 @@ static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)
static int hid_debug_rdesc_show(struct seq_file *f, void *p)
{
struct hid_device *hdev = f->private;
- const __u8 *rdesc = hdev->rdesc;
- unsigned rsize = hdev->rsize;
+ const __u8 *rdesc;
+ unsigned int rsize;
int i;
+ if (down_interruptible(&hdev->driver_input_lock))
+ return 0;
+
+ rdesc = hdev->rdesc;
+ rsize = hdev->rsize;
if (!rdesc) {
rdesc = hdev->dev_rdesc;
rsize = hdev->dev_rsize;
@@ -3669,9 +3674,6 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p)
seq_printf(f, "\n\n");
/* dump parsed data and input mappings */
- if (down_interruptible(&hdev->driver_input_lock))
- return 0;
-
hid_dump_device(hdev, f);
seq_printf(f, "\n");
hid_dump_input_mapping(hdev, f);
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 17:06 [PATCH v2 00/10] HID: Fix race conditions, UAFs, and bounds bugs Lee Jones
2026-11-27 17:06 ` [PATCH v2 09/10] HID: debug: Hold driver_input_lock while dumping raw report descriptor Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox