From: Jiale Yao <yaojiale02@163.com>
To: "Derek J. Clark" <derekjohn.clark@gmail.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH] HID: oxp: reject short input reports
Date: Sat, 17 Oct 2026 14:23:47 +0800 [thread overview]
Message-ID: <20261017062347.3787437-1-yaojiale02@163.com> (raw)
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
next reply other threads:[~2026-10-17 6:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 6:23 Jiale Yao [this message]
2026-10-17 7:39 ` Re:[PATCH] HID: oxp: reject short input reports jiale yao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261017062347.3787437-1-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=bentiss@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox