]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: das16: deschedule timer routine on detach
authorIan Abbott <abbotti@mev.co.uk>
Wed, 29 Oct 2014 17:35:11 +0000 (17:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Oct 2014 20:29:31 +0000 (13:29 -0700)
The "das16" driver optionally uses a kernel timer and a DMA channel to
support asynchronous data acquisition, but currently never calls
`del_timer_sync()`.  There is some possibility the timer routine could
still be scheduled to run when the comedi "detach" handler is run to
clean up the device and cause a certain amount of havoc.  Avoid that by
calling `del_time_sync()` in the comedi "detach" handler
`das16_detach()` if the timer was initialized by the "attach" handler
`das16_attach()`.  Use the timer's `data` member to tell whether it was
initialized or not.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/das16.c

index aa9e3e10d59d358abba58451de5c77e2e06d13c8..4556af109eaedb9a76a47c0d4188f1f31c17423c 100644 (file)
@@ -1228,6 +1228,8 @@ static void das16_detach(struct comedi_device *dev)
        int i;
 
        if (devpriv) {
+               if (devpriv->timer.data)
+                       del_timer_sync(&devpriv->timer);
                if (dev->iobase)
                        das16_reset(dev);