Skip to contentSkip to conversation

gadgetfs: use after free in dev_release()

PATCH New Dan Carpenter 1 participant 1 message Aug 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gadgetfs: use after free in dev_release()

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.

---
Static checker stuff. I haven't tested this, but I'm pretty sure it's correct.

drivers/usb/gadget/inode.c +0 -4
index f255ad7..b94c049 100644
@@ -1269,10 +1269,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;
 }