Re: [PATCH v2] HID: wacom: fix OOB read in wacom_wac_pen_serial_enforce()
From: Wei Jie Law
Date: Fri Aug 28 2026 - 21:04:42 EST
On Thu, Aug 27, 2026 at 12:02 PM Jason Gerecke <killertofu@xxxxxxxxx> wrote:
> I would appreciate an update to this patch with less confusing wording.
Reworded in v3:
https://lore.kernel.org/all/20260828033323.82958-1-98lawweijie@xxxxxxxxx/
> I don't believe there is any situation where maxusage could be less
> than report_count since it is initialized as max(usage_index,
> report_count).
You are right. Thanks for the correction.
> We would also *want* to read fields beyond the last-declared usage
Agreed; the submitted v3 keeps that, and the changelog
notes the 6.2.2.8 reuse rule.
> Given the above, I propose simply making the loop condition " j <
> field->report_count". Thoughts?
That is v3, with Suggested-by: you. Retested on v6.12.105 with a
kprobe on hid_field_extract(): with your condition the 12288-usage /
Report Count 1 descriptor extracts nothing in the driver loop (the one
remaining call is the core's own in-bounds fetch) and trips no KASAN;
stock extracts at bit offset 98296 and does.
As a side note, I am also looking into a separate but related read in
the same function based on Sashiko's review. I do not want to hold
up this patch over it or speculate before I have it pinned down.
If it turns out to be a real bug I will send it as its own patch.
Also my bad, I realised I had not replied to this thread addressing
some things you have said, after submitting the v3 patch.
Wei Jie