[PATCH 1/5] comedi: fix endless recursion in comedi_event()
From: Greg Kroah-Hartman
Date: Tue Oct 27 2026 - 12:55:20 EST
From: Josef Bacik <josef@xxxxxxxxxxxxxx>
When comedi_event() was split into a wrapper which takes a reference on
the running command and _comedi_event(), which does the work, the wrapper
ended up calling itself:
if (comedi_get_is_subdevice_running(s)) {
comedi_event(dev, s);
comedi_put_is_subdevice_running(s);
}
As long as the command is running every level takes another reference
and recurses, until the stack is used up.
Most drivers go through comedi_handle_events(), which calls
_comedi_event(). usbdux, usbduxfast and usbduxsigma cannot use that and
call comedi_event() from their URB completion handlers, i.e. for every
completed URB of a running acquisition.
Fixes: 51495254fda4 ("comedi: Use reference count for asynchronous command functions")
Cc: stable <stable@xxxxxxxxxx>
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/comedi/comedi_fops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
index 05d14839c5a6..68eddf853465 100644
--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -3495,7 +3495,7 @@ void _comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
{
if (comedi_get_is_subdevice_running(s)) {
- comedi_event(dev, s);
+ _comedi_event(dev, s);
comedi_put_is_subdevice_running(s);
}
}
--
2.56.0