USB: cxacru: check device isn't being removed during sysfs calls
authorSimon Arlott <simon@fire.lp0.eu>
Sat, 21 Nov 2009 15:33:51 +0000 (15:33 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Mar 2010 22:52:58 +0000 (14:52 -0800)
commit9fc950d322380dda8e9bc8debe89766085e7a0eb
tree50449ddbcc2cf883da8afe7ecfd1861c2441624f
parent5d0a9c7932c45435de72b5a5b2825c7eb34186a4
USB: cxacru: check device isn't being removed during sysfs calls

It is possible for usb_get_intfdata() to return NULL if
sysfs is accessed while the module is being unloaded or
the device is being removed.

Move the access code to an inline function in usbatm.h,
and return -ENODEV if any of the pointers are NULL.

It should not be possible for the instance data or atm
device to be invalid until after unbind() completes and
the sysfs attributes have been removed.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/atm/cxacru.c
drivers/usb/atm/usbatm.c
drivers/usb/atm/usbatm.h