ni_670x: Fix possible invalid pointer dereference in ni_670x_detach()
authorIan Abbott <abbotti@mev.co.uk>
Mon, 2 Jul 2012 09:03:40 +0000 (10:03 +0100)
committerIan Abbott <abbotti@mev.co.uk>
Mon, 2 Jul 2012 09:03:40 +0000 (10:03 +0100)
commit235cd3bde72ab7f798414da1ca675ee2327184ca
treeb90367a208cc9c80c40879b1df1379183946a544
parent68a1a6536b59000f315c91f8dc96957a280619d4
ni_670x: Fix possible invalid pointer dereference in ni_670x_detach()

In ni_670x_detach(), dev->subdevices will be NULL if the call to
alloc_subdevices() failed in ni_670x_attach(), so don't dereference it
until the pointer has been checked.

Spotted by H Hartley Sweeten in the "staging" sources, but used a
different check due to difference in behavior of alloc_subdevices() on
error between the two versions.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
comedi/drivers/ni_670x.c