usb: gadget: gadgetfs: use after free in dev_release()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Aug 2013 08:14:49 +0000 (11:14 +0300)
committerFelipe Balbi <balbi@ti.com>
Tue, 27 Aug 2013 20:03:28 +0000 (15:03 -0500)
The call to put_dev() releases "dev".  Hopefully, we don't need to set
the state to STATE_DEV_DISABLED anyway so I have removed those lines.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/inode.c

index 570c005062ab8a3c75a9da56131ffebfdce118aa..465ef8e2cc910e04ffd5194fddbf3b14391887c0 100644 (file)
@@ -1270,10 +1270,6 @@ dev_release (struct inode *inode, struct file *fd)
        dev->buf = NULL;
        put_dev (dev);
 
-       /* other endpoints were all decoupled from this device */
-       spin_lock_irq(&dev->lock);
-       dev->state = STATE_DEV_DISABLED;
-       spin_unlock_irq(&dev->lock);
        return 0;
 }