Skip to content

Commit 7f2ccc8

Browse files
Peter OhFelipe Balbi
authored andcommitted
usb: gadget: f_mass_storage: reset endpoint driver data when disabled
Gadgets endpoint driver data is a criteria to judge that whether the endpoints are in use or not. When gadget gets assigned an endpoint from endpoint list, they check its driver data if the driver data is NULL. If the driver data is not NULL then they regard it as in use. Therefore all of gadgets should reset their endpoints driver data to NULL as they are disabled. Otherwise it causes a leak of endpoint resource. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 660479a commit 7f2ccc8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/usb/gadget/f_mass_storage.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,10 +2260,12 @@ static int do_set_interface(struct fsg_common *common, struct fsg_dev *new_fsg)
22602260
/* Disable the endpoints */
22612261
if (fsg->bulk_in_enabled) {
22622262
usb_ep_disable(fsg->bulk_in);
2263+
fsg->bulk_in->driver_data = NULL;
22632264
fsg->bulk_in_enabled = 0;
22642265
}
22652266
if (fsg->bulk_out_enabled) {
22662267
usb_ep_disable(fsg->bulk_out);
2268+
fsg->bulk_out->driver_data = NULL;
22672269
fsg->bulk_out_enabled = 0;
22682270
}
22692271

0 commit comments

Comments
 (0)