]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
HID: pidff: Fix possible null pointer dereference
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Sat, 23 Aug 2025 19:45:16 +0000 (21:45 +0200)
committerJiri Kosina <jkosina@suse.com>
Fri, 12 Sep 2025 15:29:19 +0000 (17:29 +0200)
commitd927909d4d7a57fc27684e0761fa7ca1991ba115
tree74c0fe010d19cf913820015b8e65810b24aa610e
parent13120abdb0d70431fb0c0cda29bec184aee782a6
HID: pidff: Fix possible null pointer dereference

As reported by Dan Carpenter, if the axes_enable field wasn't found,
trying to find the axes themselves will result in a null pointer
dereference. This could only occur with a broken PID descriptor, but
it's worth protecting from.

Exit early if the axes_enable wasn't found AND add a gate to the
pidff_find_special_keys to exit early if the passed HID field is null.
This will protect again null dereferencing in the future and properly
return 0 found special keys.

Fixes: 1d72e7bd340b ("HID: pidff: Add support for AXES_ENABLE field")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/usbhid/hid-pidff.c