linux/drivers/comedi
Ian Abbott 17221216ae comedi: comedi_parport: deal with premature interrupt
Syzbot reported a general protection fault in
`comedi_get_is_subdevice_running()`, which was called from the interrupt
handler `parport_interrupt()` in the "comedi_parport" driver, but it
does not currently have a C reproducer for the problem.  It's
probably due to a premature interrupt for one of two reasons:

1. The driver sets up the interrupt handler before the comedi subdevices
   used by the interrupt handler have been allocated, but does not
   disable the interrupt in the parallel port's CTRL register first.
2. The driver uses a user-supplied I/O port base address which Syzbot
   would have supplied, but it might not be backed by real parallel port
   hardware.

Change the initialization order in the driver's comedi "attach" handler
(`parport_attach()`) so that the hardware registers are initialized
before the interrupt handler is requested.  This should prevent
premature interrupts occurring for real hardware.

Also add a test to the interrupt handler to ensure the comedi device is
fully attached and return early if it isn't.

Fixes: 241ab6ad71 ("Staging: comedi: add comedi_parport driver")
Reported-by: syzbot+f24c3d5d316011bacc70@syzkaller.appspotmail.com
Cc: stable <stable@kernel.org>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20260527125104.96596-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-17 14:50:35 +02:00
..
drivers comedi: comedi_parport: deal with premature interrupt 2026-07-17 14:50:35 +02:00
kcomedilib comedi: remove unnecessary module_init/exit functions 2026-04-02 15:49:54 +02:00
comedi_buf.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
comedi_fops.c mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
comedi_internal.h comedi: Use reference count for asynchronous command functions 2025-11-26 14:19:41 +01:00
comedi_pci.c comedi: remove unnecessary module_init/exit functions 2026-04-02 15:49:54 +02:00
comedi_pcmcia.c comedi: remove unnecessary module_init/exit functions 2026-04-02 15:49:54 +02:00
comedi_usb.c comedi: remove unnecessary module_init/exit functions 2026-04-02 15:49:54 +02:00
drivers.c Linux 7.0-rc7 2026-04-06 09:04:53 +02:00
Kconfig comedi: Correct name of ACCES I/O Products 2026-04-02 15:49:48 +02:00
Makefile staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00
proc.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
range.c comedi: Fix getting range information for subdevices 16 to 255 2026-01-16 16:42:15 +01:00
TODO staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00