mirror-linux/drivers/input/mouse
Javier Carrasco 2b9c3eb32a Input: bcm5974 - check endpoint type before starting traffic
syzbot has found a type mismatch between a USB pipe and the transfer
endpoint, which is triggered by the bcm5974 driver[1].

This driver expects the device to provide input interrupt endpoints and
if that is not the case, the driver registration should terminate.

Repros are available to reproduce this issue with a certain setup for
the dummy_hcd, leading to an interrupt/bulk mismatch which is caught in
the USB core after calling usb_submit_urb() with the following message:
"BOGUS urb xfer, pipe 1 != type 3"

Some other device drivers (like the appletouch driver bcm5974 is mainly
based on) provide some checking mechanism to make sure that an IN
interrupt endpoint is available. In this particular case the endpoint
addresses are provided by a config table, so the checking can be
targeted to the provided endpoints.

Add some basic checking to guarantee that the endpoints available match
the expected type for both the trackpad and button endpoints.

This issue was only found for the trackpad endpoint, but the checking
has been added to the button endpoint as well for the same reasons.

Given that there was never a check for the endpoint type, this bug has
been there since the first implementation of the driver (f89bd95c5c).

[1] https://syzkaller.appspot.com/bug?extid=348331f63b034f89b622

Fixes: f89bd95c5c ("Input: bcm5974 - add driver for Macbook Air and Pro Penryn touchpads")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reported-and-tested-by: syzbot+348331f63b034f89b622@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20231007-topic-bcm5974_bulk-v3-1-d0f38b9d2935@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2024-01-31 10:32:59 -08:00
..
Kconfig input: remove pxa930_trkball driver 2023-02-01 17:23:38 +01:00
Makefile input: remove pxa930_trkball driver 2023-02-01 17:23:38 +01:00
alps.c Input: alps - fix compatibility with -funsigned-char 2023-03-19 23:07:04 -07:00
alps.h
amimouse.c Input: amimouse - convert to platform remove callback returning void 2023-12-01 15:36:18 -08:00
appletouch.c
atarimouse.c
bcm5974.c Input: bcm5974 - check endpoint type before starting traffic 2024-01-31 10:32:59 -08:00
byd.c
byd.h
cyapa.c Input: mouse - use sysfs_emit[_at]() instead of scnprintf() 2023-12-13 21:26:11 -08:00
cyapa.h
cyapa_gen3.c Input: mouse - use sysfs_emit[_at]() instead of scnprintf() 2023-12-13 21:26:11 -08:00
cyapa_gen5.c Input: mouse - use sysfs_emit[_at]() instead of scnprintf() 2023-12-13 21:26:11 -08:00
cyapa_gen6.c Input: mouse - use sysfs_emit[_at]() instead of scnprintf() 2023-12-13 21:26:11 -08:00
cypress_ps2.c
cypress_ps2.h
elan_i2c.h
elan_i2c_core.c Input: mouse - use sysfs_emit[_at]() instead of scnprintf() 2023-12-13 21:26:11 -08:00
elan_i2c_i2c.c
elan_i2c_smbus.c
elantech.c Input: psmouse - fix fast_reconnect function for PS/2 mode 2023-10-13 17:59:18 -07:00
elantech.h
focaltech.c Input: focaltech - use explicitly signed char type 2023-03-19 23:07:02 -07:00
focaltech.h
gpio_mouse.c
hgpk.c
hgpk.h
inport.c
lifebook.c
lifebook.h
logibm.c
logips2pp.c
logips2pp.h
maplemouse.c
navpoint.c Input: navpoint - convert to use GPIO descriptor 2023-12-13 21:26:13 -08:00
pc110pad.c
psmouse-base.c Input: libps2 - introduce common interrupt handler 2023-05-18 11:40:32 -07:00
psmouse-smbus.c Revert "Input: psmouse - add delay when deactivating for SMBus mode" 2023-10-12 16:01:36 -07:00
psmouse.h Input: libps2 - attach ps2dev instances as serio port's drvdata 2023-05-18 11:40:32 -07:00
rpcmouse.c
sentelic.c
sentelic.h
sermouse.c
synaptics.c Input: psmouse - enable Synaptics InterTouch for ThinkPad L14 G1 2023-11-15 16:52:02 +00:00
synaptics.h
synaptics_i2c.c Input: Switch i2c drivers back to use .probe() 2023-05-17 09:59:11 -07:00
synaptics_usb.c
touchkit_ps2.c
touchkit_ps2.h
trackpoint.c Input: libps2 - attach ps2dev instances as serio port's drvdata 2023-05-18 11:40:32 -07:00
trackpoint.h
vmmouse.c
vmmouse.h
vsxxxaa.c