]> git.karo-electronics.de Git - linux-beck.git/commit
staging: comedi: 8255_pci: fix possible NULL deref during detach
authorIan Abbott <abbotti@mev.co.uk>
Wed, 3 Oct 2012 15:25:15 +0000 (16:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Oct 2012 18:46:34 +0000 (11:46 -0700)
commitf4dd2367f3ad276fe49c89a522267ea5ccb6bf80
tree81a52677385fddf1f0a4d44269efcd39ce262c16
parent6681e63399926651cc29bcb9d92229b6f1cf1daa
staging: comedi: 8255_pci: fix possible NULL deref during detach

`pci_8255_detach()` will be called by the comedi core if
`pci_8255_attach_pci()` returns an error.  It currently assumes that
both `board` (assigned from the return value of `comedi_board(dev)`) and
`devpriv` (assigned from `dev->private`) are non-null, but they might
be null, leading to a null pointer dereference.

`pci_8255_detach()` doesn't need to do anything if either `board` or
`devpriv` are null, so just return early in this case.

Cc: <stable@vger.kernel.org> # 3.6.x
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/8255_pci.c