Commit d927909
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: 1d72e7b ("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>1 parent 13120ab commit d927909
1 file changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1194 | 1194 | | |
1195 | 1195 | | |
1196 | 1196 | | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1197 | 1200 | | |
1198 | 1201 | | |
1199 | 1202 | | |
| |||
1299 | 1302 | | |
1300 | 1303 | | |
1301 | 1304 | | |
1302 | | - | |
| 1305 | + | |
1303 | 1306 | | |
1304 | | - | |
1305 | | - | |
1306 | | - | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
1307 | 1312 | | |
1308 | 1313 | | |
1309 | 1314 | | |
1310 | 1315 | | |
1311 | 1316 | | |
1312 | 1317 | | |
1313 | 1318 | | |
1314 | | - | |
| 1319 | + | |
1315 | 1320 | | |
1316 | 1321 | | |
1317 | 1322 | | |
| |||
0 commit comments