Commit 0bc4cf1
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 df870e1 commit 0bc4cf1
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2200 | 2200 | | |
2201 | 2201 | | |
2202 | 2202 | | |
2203 | | - | |
| 2203 | + | |
| 2204 | + | |
2204 | 2205 | | |
2205 | 2206 | | |
2206 | 2207 | | |
| |||
2214 | 2215 | | |
2215 | 2216 | | |
2216 | 2217 | | |
2217 | | - | |
| 2218 | + | |
| 2219 | + | |
2218 | 2220 | | |
2219 | 2221 | | |
2220 | 2222 | | |
| |||
0 commit comments