Skip to content

Commit ce405d5

Browse files
Udipto Goswamigregkh
authored andcommitted
usb: gadget: f_fs: Ensure ep0req is dequeued before free_request
As per the documentation, function usb_ep_free_request guarantees the request will not be queued or no longer be re-queued (or otherwise used). However, with the current implementation it doesn't make sure that the request in ep0 isn't reused. Fix this by dequeuing the ep0req on functionfs_unbind before freeing the request to align with the definition. Fixes: ddf8abd ("USB: f_fs: the FunctionFS driver") Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com> Tested-by: Krishna Kurapati <quic_kriskura@quicinc.com> Link: https://lore.kernel.org/r/20221215052906.8993-3-quic_ugoswami@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6a19da1 commit ce405d5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • drivers/usb/gadget/function

drivers/usb/gadget/function/f_fs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,8 @@ static void functionfs_unbind(struct ffs_data *ffs)
18951895
ENTER();
18961896

18971897
if (!WARN_ON(!ffs->gadget)) {
1898+
/* dequeue before freeing ep0req */
1899+
usb_ep_dequeue(ffs->gadget->ep0, ffs->ep0req);
18981900
mutex_lock(&ffs->mutex);
18991901
usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);
19001902
ffs->ep0req = NULL;

0 commit comments

Comments
 (0)