USB: cypress_cy7c63: race disconnect/sysfs read-write leading to following NULL pointer
authorOliver Neukum <oneukum@suse.de>
Fri, 30 Mar 2007 08:52:16 +0000 (10:52 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 20:28:38 +0000 (13:28 -0700)
this driver sets intfdata to NULL while it still can be read and happily followed.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/cypress_cy7c63.c

index b63b5f34b2aa5f0f79b7103c9e14ce9e89f2b2a7..d721380b242d69a9e4c4addcb21bfdb47d363ec9 100644 (file)
@@ -246,11 +246,13 @@ static void cypress_disconnect(struct usb_interface *interface)
        struct cypress *dev;
 
        dev = usb_get_intfdata(interface);
-       usb_set_intfdata(interface, NULL);
 
        /* remove device attribute files */
        device_remove_file(&interface->dev, &dev_attr_port0);
        device_remove_file(&interface->dev, &dev_attr_port1);
+       /* the intfdata can be set to NULL only after the
+        * device files have been removed */
+       usb_set_intfdata(interface, NULL);
 
        usb_put_dev(dev->udev);