linux-stable/drivers/comedi/drivers
Nikita Zhandarovich d1718530e3 comedi: vmk80xx: fix incomplete endpoint checking
While vmk80xx does have endpoint checking implemented, some things
can fall through the cracks. Depending on the hardware model,
URBs can have either bulk or interrupt type, and current version
of vmk80xx_find_usb_endpoints() function does not take that fully
into account. While this warning does not seem to be too harmful,
at the very least it will crash systems with 'panic_on_warn' set on
them.

Fix the issue found by Syzkaller [1] by somewhat simplifying the
endpoint checking process with usb_find_common_endpoints() and
ensuring that only expected endpoint types are present.

This patch has not been tested on real hardware.

[1] Syzkaller report:
usb 1-1: BOGUS urb xfer, pipe 1 != type 3
WARNING: CPU: 0 PID: 781 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
...
Call Trace:
 <TASK>
 usb_start_wait_urb+0x113/0x520 drivers/usb/core/message.c:59
 vmk80xx_reset_device drivers/comedi/drivers/vmk80xx.c:227 [inline]
 vmk80xx_auto_attach+0xa1c/0x1a40 drivers/comedi/drivers/vmk80xx.c:818
 comedi_auto_config+0x238/0x380 drivers/comedi/drivers.c:1067
 usb_probe_interface+0x5cd/0xb00 drivers/usb/core/driver.c:399
...

Similar issue also found by Syzkaller:
Link: https://syzkaller.appspot.com/bug?extid=5205eb2f17de3e01946e

Reported-and-tested-by: syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com
Cc: stable <stable@kernel.org>
Fixes: 49253d542c ("staging: comedi: vmk80xx: factor out usb endpoint detection")
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://lore.kernel.org/r/20240408171633.31649-1-n.zhandarovich@fintech.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-11 15:16:23 +02:00
..
ni_routing comedi: ni_routing: tools: Update due to moved COMEDI headers 2021-11-26 16:48:59 +01:00
tests
8255.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
8255_pci.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
Makefile
addi_apci_3xxx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_16xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1032.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1500.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1516.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_1564.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_2032.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_2200.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_3120.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_apci_3501.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_tcw.h
addi_watchdog.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
addi_watchdog.h
adl_pci7x3x.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adl_pci6208.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adl_pci8164.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adl_pci9111.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
adl_pci9118.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
adq12b.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1710.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
adv_pci1720.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1723.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1724.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
adv_pci1760.c comedi: adv_pci1760: Fix PWM instruction handling 2023-01-19 17:24:47 +01:00
adv_pci_dio.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
aio_aio12_8.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
aio_iiro_16.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amcc_s5933.h
amplc_dio200.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_dio200.h
amplc_dio200_common.c comedi: amplc_dio200_common: Conditionally remove I/O port support 2023-10-05 13:34:04 +02:00
amplc_dio200_pci.c comedi: amplc_dio200_pci: Conditionally remove devices that use port I/O 2023-10-05 13:34:04 +02:00
amplc_pc236.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_pc236.h
amplc_pc236_common.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
amplc_pc263.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_pci224.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
amplc_pci230.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
amplc_pci236.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
amplc_pci263.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
c6xdigio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
cb_das16_cs.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
cb_pcidas.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
cb_pcidas64.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
cb_pcidda.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
cb_pcimdas.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
cb_pcimdda.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
comedi_8254.c comedi: comedi_8254: Conditionally remove I/O port support 2023-10-05 13:34:04 +02:00
comedi_8255.c comedi: comedi_8255: Correct error in subdevice initialization 2024-03-05 14:21:42 +00:00
comedi_bond.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
comedi_isadma.c PCI: Move isa_dma_bridge_buggy out of asm/dma.h 2022-07-22 17:24:47 -05:00
comedi_parport.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
comedi_test.c comedi: comedi_test: Prevent timers rescheduling during deletion 2024-03-05 14:21:45 +00:00
contec_pci_dio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dac02.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
daqboard2000.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
das08.c comedi: remove redundant assignment to variable range 2024-02-18 19:17:11 +01:00
das08.h
das08_cs.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
das08_isa.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
das08_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
das16.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
das16m1.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
das800.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
das1800.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
das6402.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
dmm32at.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
dt282x.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
dt2801.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2811.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2814.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2815.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt2817.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt3000.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dt9812.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
dyna_pci10xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
fl512.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
gsc_hpdi.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
icp_multi.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ii_pci20kc.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
jr3_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
jr3_pci.h
ke_counter.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
me4000.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
me_daq.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
mf6x4.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
mite.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
mite.h
mpc624.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
multiq3.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_65xx.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_660x.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_670x.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_6527.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_at_a2150.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
ni_at_ao.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
ni_atmio.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_atmio16d.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
ni_daq_700.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_daq_dio24.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
ni_labpc.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_labpc.h
ni_labpc_common.c comedi: ni_labpc_common: Conditionally remove I/O port support 2023-10-05 13:34:04 +02:00
ni_labpc_cs.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_labpc_isadma.c comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h> 2021-11-26 16:48:59 +01:00
ni_labpc_isadma.h
ni_labpc_pci.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_labpc_regs.h
ni_mio_common.c comedi: ni_mio_common: Conditionally use I/O port or MMIO 2023-10-05 13:34:04 +02:00
ni_mio_cs.c comedi: Move and rename "8255.h" to <linux/comedi/comedi_8255.h> 2021-11-26 16:48:59 +01:00
ni_pcidio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_pcimio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_routes.c comedi: drivers: ni_routes: Use strcmp() instead of memcmp() 2022-02-25 12:08:52 +01:00
ni_routes.h comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_stc.h
ni_tio.c comedi: drivers: ni_tio: Fix slightly broken kernel-doc and demote others 2021-05-21 14:38:44 +02:00
ni_tio.h comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
ni_tio_internal.h
ni_tiocmd.c
ni_usb6501.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcl711.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
pcl724.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
pcl726.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcl730.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcl812.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
pcl816.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
pcl818.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
pcm3724.c comedi: comedi_8255: Rework subdevice initialization functions 2023-10-05 13:34:04 +02:00
pcmad.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcmda12.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcmmio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
pcmuio.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
plx9052.h
plx9080.h
quatech_daqp_cs.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
rtd520.c comedi: comedi_8254: Replace comedi_8254_init() and comedi_8254_mm_init() 2023-10-05 13:34:04 +02:00
rti800.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
rti802.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
s526.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
s626.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
s626.h
ssv_dnp.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
usbdux.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
usbduxfast.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
usbduxsigma.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
vmk80xx.c comedi: vmk80xx: fix incomplete endpoint checking 2024-04-11 15:16:23 +02:00
z8536.h