USB: usb-skeleton.c: fix open/disconnect race
authorMing Lei <tom.leiming@gmail.com>
Fri, 16 Dec 2011 14:20:01 +0000 (22:20 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 4 Jan 2012 23:52:41 +0000 (15:52 -0800)
commit26c71a79cade5ccad80e0752cd82f3518df48fb3
tree965a339ad5ef6a02635455394525e37141b86fef
parente78832cdca2ddd23c15abaed642cad1a39b3e122
USB: usb-skeleton.c: fix open/disconnect race

If usb device is disconnected between usb_get_intfdata()
and kref_get() in skel_open(), kref_get may access a freed
object.

Also check if device is disconnected in ->open.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/usb-skeleton.c