Commit d5ed108
committed
HID: core: Harden s32ton() against conversion to 0 bits
jira VULN-131259
cve CVE-2025-38556
commit-author Alan Stern <stern@rowland.harvard.edu>
commit a6b87bf
upstream-diff This function is in a different place in this
kernel, so there was a conflict. Also, when
this function was moved in the upstream kernel,
a newline was added afer 's32 a = value....'.
Since that newline doesn't exist in this kernel
this commit adds it.
Testing by the syzbot fuzzer showed that the HID core gets a
shift-out-of-bounds exception when it tries to convert a 32-bit
quantity to a 0-bit quantity. Ideally this should never occur, but
there are buggy devices and some might have a report field with size
set to zero; we shouldn't reject the report or the device just because
of that.
Instead, harden the s32ton() routine so that it returns a reasonable
result instead of crashing when it is called with the number of bits
set to 0 -- the same as what snto32() does.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: syzbot+b63d677d63bcac06cf90@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-usb/68753a08.050a0220.33d347.0008.GAE@google.com/
Tested-by: syzbot+b63d677d63bcac06cf90@syzkaller.appspotmail.com
Fixes: dde5845 ("[PATCH] Generic HID layer - code split")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/613a66cd-4309-4bce-a4f7-2905f9bce0c9@rowland.harvard.edu
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
(cherry picked from commit a6b87bf)
Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>1 parent 9f30757 commit d5ed108
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1338 | 1338 | | |
1339 | 1339 | | |
1340 | 1340 | | |
1341 | | - | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1342 | 1347 | | |
1343 | 1348 | | |
1344 | 1349 | | |
| |||
0 commit comments