]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: bug-fix NULL pointer dereference on failed attach
authorIan Abbott <abbotti@mev.co.uk>
Fri, 23 Aug 2013 11:37:17 +0000 (12:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Aug 2013 17:31:47 +0000 (10:31 -0700)
commit15cf7013ca332ab0357b9a69f226e6f61edba1a7
treefd4e91763cbf0063028bcc1ec2d2ea5f94437419
parent3820885d3a641256fed52a2a99c7b74a1e8f2434
staging: comedi: bug-fix NULL pointer dereference on failed attach

Commit 5de437a1c90646d3565acdaf58924b8fd82efe28 ("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>
Cc: <stable@vger.kernel.org> # 3.10+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers.c