mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] HID: oxp: reject short input reports
@ 2026-10-17  6:23 Jiale Yao
  2026-10-17  7:39 ` jiale yao
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-10-17  6:23 UTC (permalink / raw)
  To: Derek J. Clark, Jiri Kosina, Benjamin Tissoires, linux-input,
	linux-kernel
  Cc: Jiale Yao

oxp_hid_raw_event() logs a full OXP packet and then dispatches it to one
of two parsers. Both parsers access fixed offsets and cast the input to
fixed-size report structures without checking the received length. A short
report can therefore be read beyond its valid data.

Reject reports shorter than the fixed OXP packet size before logging or
dispatching them.

Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/hid/hid-oxp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/hid-oxp.c b/drivers/hid/hid-oxp.c
index 1e691ebc1199..e1e1b99e9878 100644
--- a/drivers/hid/hid-oxp.c
+++ b/drivers/hid/hid-oxp.c
@@ -435,6 +435,9 @@ static int oxp_hid_raw_event(struct hid_device *hdev, struct hid_report *report,
 {
 	u16 up = get_usage_page(hdev);
 
+	if (size < OXP_PACKET_SIZE)
+		return 0;
+
 	dev_dbg(&hdev->dev, "raw event data: [%*ph]\n", OXP_PACKET_SIZE, data);
 
 	switch (up) {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-17  7:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17  6:23 [PATCH] HID: oxp: reject short input reports Jiale Yao
2026-10-17  7:39 ` jiale yao

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

all inboxes | Powered by JetHome®