staging: frontier: use after free in disconnect()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 22 Jul 2013 06:57:49 +0000 (09:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jul 2013 22:08:50 +0000 (15:08 -0700)
usb_alphatrack_delete() frees "dev" so we can't use it on that path.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/frontier/alphatrack.c

index 5590ebf1da15218c50561fcbd01b0ebc907ce693..817f837b240d656ccf4379bd3f68be4bbf49b867 100644 (file)
@@ -827,11 +827,11 @@ static void usb_alphatrack_disconnect(struct usb_interface *intf)
                mutex_unlock(&dev->mtx);
                usb_alphatrack_delete(dev);
        } else {
+               atomic_set(&dev->writes_pending, 0);
                dev->intf = NULL;
                mutex_unlock(&dev->mtx);
        }
 
-       atomic_set(&dev->writes_pending, 0);
        mutex_unlock(&disconnect_mutex);
 
        dev_info(&intf->dev, "Alphatrack Surface #%d now disconnected\n",