Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df498995 authored by Dan Carpenter's avatar Dan Carpenter Committed by Felipe Balbi
Browse files

usb: gadget: 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.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 1826e9b1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
	}
}