Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d718d2b17822bb92708204cb1a9175e512520261
Commit:     d718d2b17822bb92708204cb1a9175e512520261
Parent:     54d2bc068fd21bcb096660938bce7c7265613a24
Author:     Oliver Neukum <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 23 12:26:41 2007 +0200
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Thu Oct 25 12:18:44 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/misc/cytherm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 2677fea..1cd9e7e 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)
        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 usb_interface 
*interface)
        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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to