Input: iforce - validate input packet lengths
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Sat, 25 Jul 2026 03:46:27 +0000 (20:46 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 25 Jul 2026 03:49:53 +0000 (20:49 -0700)
commit5751c781d3c97ab6ce0e2a966156ed882152c415
tree8c44cc4936ecaebd1cc6d891cae1e90b7b85ea0e
parent732f38c36059e68ba3b4b89c56911d777fd3185c
Input: iforce - validate input packet lengths

iforce_process_packet() reads fixed fields from joystick, wheel and
status packets without first checking their lengths. In particular, the
shared hats-and-buttons helper unconditionally reads data[6]. The status
tail is a sequence of 16-bit effect addresses, but an incomplete final
address is also consumed. A successful zero-length USB URB additionally
reads the packet ID before the common parser is called.

Reject the zero-length USB transfer, require the seven-byte joystick and
wheel prefixes and the two-byte status prefix, and consume only complete
status-tail addresses.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260720115018.75045-1-pengpeng@iscas.ac.cn
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/joystick/iforce/iforce-packets.c
drivers/input/joystick/iforce/iforce-usb.c