[PATCH v3 0/4] Input: adi - more bounds checks in the gameport packet path
From: Guanglei Zhu
Date: Tue Dec 01 2026 - 07:23:28 EST
This is v3 of the two-stream merge fix. v2 rejected a merge that did
not fit the buffer; the review asked for four more things, folded in
here as a small series:
1/4 rejects a merge whose length field is zero as well, and computes
the start offset once instead of recomputing it in the loop.
2/4 fixes the length guard in adi_read_packet(), which tests the
counter before the pre-increment.
3/4 rejects ID packets whose axis split or button count would wrap,
and stores the byte fields as u8 (pad as s8) so the values do not
depend on the signedness of char.
4/4 checks the decoded axis, hat and button counts against the size
of the device's axis and key tables before they are walked.
Each patch was replayed against master in user space with ASan; the
results are in the note under the tear line of the patch.
Guanglei Zhu (4):
Input: adi - reject stream merges that do not fit the buffer
Input: adi - fix the packet length guard in adi_read_packet()
Input: adi - reject ID packets with wrapped axis or button counts
Input: adi - check the decoded counts against the device tables
drivers/input/joystick/adi.c | 104 ++++++++++++++++++++++++++++-------
1 file changed, 83 insertions(+), 21 deletions(-)
--
2.43.0