aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/cytherm.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2007-10-23 06:26:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-25 15:18:44 -0400
commitd718d2b17822bb92708204cb1a9175e512520261 (patch)
tree07db96751e993ceba8bed366458115d2c1ec6773 /drivers/usb/misc/cytherm.c
parent54d2bc068fd21bcb096660938bce7c7265613a24 (diff)
USB: fix read vs. disconnect race in cytherm driver
the disconnect method of this driver set intfdata to NULL before removing attribute files. The attributes' read methods will happily follow the NULL pointer. Here's the correct ordering. Signed-off-by : Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/cytherm.c')
-rw-r--r--drivers/usb/misc/cytherm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 2677fea147d9..1cd9e7eba93b 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -399,7 +399,6 @@ static void cytherm_disconnect(struct usb_interface *interface)
399 struct usb_cytherm *dev; 399 struct usb_cytherm *dev;
400 400
401 dev = usb_get_intfdata (interface); 401 dev = usb_get_intfdata (interface);
402 usb_set_intfdata (interface, NULL);
403 402
404 device_remove_file(&interface->dev, &dev_attr_brightness); 403 device_remove_file(&interface->dev, &dev_attr_brightness);
405 device_remove_file(&interface->dev, &dev_attr_temp); 404 device_remove_file(&interface->dev, &dev_attr_temp);
@@ -407,6 +406,9 @@ static void cytherm_disconnect(struct usb_interface *interface)
407 device_remove_file(&interface->dev, &dev_attr_port0); 406 device_remove_file(&interface->dev, &dev_attr_port0);
408 device_remove_file(&interface->dev, &dev_attr_port1); 407 device_remove_file(&interface->dev, &dev_attr_port1);
409 408
409 /* first remove the files, then NULL the pointer */
410 usb_set_intfdata (interface, NULL);
411
410 usb_put_dev(dev->udev); 412 usb_put_dev(dev->udev);
411 413
412 kfree(dev); 414 kfree(dev);