Commit 9c031b2
HID: playstation: Clamp num_touch_reports
commit cac61b5 upstream.
A device would never lie about the number of touch reports would it?
If it does the loop in dualshock4_parse_report will read off the end of
the touch_reports array, up to about 2 KiB for the maximum number of 256
loop iteraions. The data that is read is emitted via evdev if the
DS4_TOUCH_POINT_INACTIVE bit happens to be set. Protect against this by
clamping the num_touch_reports value provided by the device to the
maximum size of the touch_reports array.
Fixes: 7520382 ("HID: playstation: add DualShock4 touchpad support.")
Cc: stable@vger.kernel.org
Reported-by: Xingyu Jin <xingyuj@google.com>
Signed-off-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 51eba7e commit 9c031b2
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | | - | |
| 2251 | + | |
| 2252 | + | |
2252 | 2253 | | |
2253 | 2254 | | |
2254 | 2255 | | |
| |||
2262 | 2263 | | |
2263 | 2264 | | |
2264 | 2265 | | |
2265 | | - | |
| 2266 | + | |
| 2267 | + | |
2266 | 2268 | | |
2267 | 2269 | | |
2268 | 2270 | | |
| |||
0 commit comments