diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2025-12-03 11:23:18 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-12-07 06:18:54 +0900 |
| commit | 810189546cb6c8f36443ed091d91f1f5d2fc2ec7 (patch) | |
| tree | 73246389cb303c69247ba4f0c6b34cb46ace9f1f /ipc/sem.c | |
| parent | e7e8e9b1a1b1c8d4803fdb90354d4db04f05d210 (diff) | |
| download | linux-810189546cb6c8f36443ed091d91f1f5d2fc2ec7.tar.gz linux-810189546cb6c8f36443ed091d91f1f5d2fc2ec7.tar.bz2 linux-810189546cb6c8f36443ed091d91f1f5d2fc2ec7.zip | |
HID: core: Harden s32ton() against conversion to 0 bits
[ Upstream commit a6b87bfc2ab5bccb7ad953693c85d9062aef3fdd ]
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: dde5845a529f ("[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>
[ s32ton() was moved by c653ffc28340 ("HID: stop exporting hid_snto32()").
Minor context change fixed. ]
Signed-off-by: Wenshan Lan <jetlan9@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc/sem.c')
0 files changed, 0 insertions, 0 deletions
