diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2013-08-23 15:37:17 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-29 20:47:36 +0400 |
commit | 6f123e952c4144ddda16ebdac765677ebdf6f37c (patch) | |
tree | 603950849a1670973bdd6dd84a6778bc6b50a1a8 | |
parent | 90dbc54a171ca7fd96c35d2858d30baf5d7c6376 (diff) | |
download | linux-6f123e952c4144ddda16ebdac765677ebdf6f37c.tar.xz |
staging: comedi: bug-fix NULL pointer dereference on failed attach
commit 3955dfa8216f712bc204a5ad2f4e51efff252fde upstream.
Commit dcd7b8bd63cb81c5b973bf86510ca3c80bbbd162 ("staging: comedi: put
module _after_ detach" by myself) reversed a couple of calls in
`comedi_device_attach()` when recovering from an error returned by the
low-level driver's 'attach' handler. Unfortunately, that introduced a
NULL pointer dereference bug as `dev->driver` is NULL after the call to
`comedi_device_detach()`. We still have a pointer to the low-level
comedi driver structure in the `driv` variable, so use that instead.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 06d190f8fd34..4a2b04277304 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -464,7 +464,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) ret = comedi_device_postconfig(dev); if (ret < 0) { comedi_device_detach(dev); - module_put(dev->driver->module); + module_put(driv->module); } /* On success, the driver module count has been incremented. */ return ret; |