This is a note to let you know that I've just added the patch titled
staging: comedi: comedi_test: fix race when cancelling command
to the 3.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
staging-comedi-comedi_test-fix-race-when-cancelling-command.patch
and it can be found in the queue-3.7 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From c0729eeefdcd76db338f635162bf0739fd2c5f6f Mon Sep 17 00:00:00 2001
From: Ian Abbott <[email protected]>
Date: Fri, 4 Jan 2013 11:33:21 +0000
Subject: staging: comedi: comedi_test: fix race when cancelling command
From: Ian Abbott <[email protected]>
commit c0729eeefdcd76db338f635162bf0739fd2c5f6f upstream.
Éric Piel reported a kernel oops in the "comedi_test" module. It was a
NULL pointer dereference within `waveform_ai_interrupt()` (actually a
timer function) that sometimes occurred when a running asynchronous
command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing
the device file).
This seems to be a race between the caller of `waveform_ai_cancel()`
which on return from that function goes and tears down the running
command, and the timer function which uses the command. In particular,
`async->cmd.chanlist` gets freed (and the pointer set to NULL) by
`do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled
`waveform_ai_interrupt()` timer function will dereference that pointer
regardless, leading to the oops.
Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()`
with `del_timer_sync()`.
Signed-off-by: Ian Abbott <[email protected]>
Reported-by: Éric Piel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/staging/comedi/drivers/comedi_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -372,7 +372,7 @@ static int waveform_ai_cancel(struct com
struct waveform_private *devpriv = dev->private;
devpriv->timer_running = 0;
- del_timer(&devpriv->timer);
+ del_timer_sync(&devpriv->timer);
return 0;
}
Patches currently in stable-queue which might be from [email protected] are
queue-3.7/staging-comedi-kconfig-comedi_ni_at_a2150-should-select-comedi_fc.patch
queue-3.7/staging-comedi-comedi_test-fix-race-when-cancelling-command.patch
queue-3.7/staging-comedi-prevent-auto-unconfig-of-manually-configured-devices.patch
queue-3.7/staging-comedi-fix-minimum-ao-period-for-ni-625x-and-ni-628x.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html