Skip to contentSkip to conversation

gadgetfs: potential use after free in unbind()

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

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

PATCH 1/1 gadgetfs: potential use after free in unbind()

ffs_data_put() can sometimes free "ffs" so I have moved the call down a line below the dereference.

---
Static checker stuff. I can't actually compile this file.

drivers/usb/gadget/f_fs.c +1 -1
index f394f29..1a66c5b 100644
@@ -1417,8 +1417,8 @@ static void functionfs_unbind(struct ffs_data *ffs)
 		usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);
 		ffs->ep0req = NULL;
 		ffs->gadget = NULL;
-		ffs_data_put(ffs);
 		clear_bit(FFS_FL_BOUND, &ffs->flags);
+		ffs_data_put(ffs);
 	}
 }