[patch]read vs. disconnect race in cytherm driver
Oliver Neukum <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, 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. Regards Oliver Signed-off-by : Oliver Neukum <[email protected]> ---- --- a/drivers/usb/misc/cytherm.c 2007-10-23 11:56:27.000000000 +0200 +++ b/drivers/usb/misc/cytherm.c 2007-10-23 11:57:24.000000000 +0200 @@ -399,7 +399,6 @@ static void cytherm_disconnect(struct us struct usb_cytherm *dev; dev = usb_get_intfdata (interface); - usb_set_intfdata (interface, NULL); device_remove_file(&interface->dev, &dev_attr_brightness); device_remove_file(&interface->dev, &dev_attr_temp); @@ -407,6 +406,9 @@ static void cytherm_disconnect(struct us device_remove_file(&interface->dev, &dev_attr_port0); device_remove_file(&interface->dev, &dev_attr_port1); + /* first remove the files, then NULL the pointer */ + usb_set_intfdata (interface, NULL); + usb_put_dev(dev->udev); kfree(dev); ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel