Patch "usb: gadget: f_fs: Ensure ep0req is dequeued before free_request" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: gadget: f_fs: Ensure ep0req is dequeued before free_request

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-gadget-f_fs-ensure-ep0req-is-dequeued-before-fre.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 23d70b688159117489387d782059899643abb829
Author: Udipto Goswami <quic_ugoswami@xxxxxxxxxxx>
Date:   Thu Dec 15 10:59:06 2022 +0530

    usb: gadget: f_fs: Ensure ep0req is dequeued before free_request
    
    [ Upstream commit ce405d561b020e5a46340eb5146805a625dcacee ]
    
    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: ddf8abd25994 ("USB: f_fs: the FunctionFS driver")
    Signed-off-by: Udipto Goswami <quic_ugoswami@xxxxxxxxxxx>
    Tested-by: Krishna Kurapati <quic_kriskura@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221215052906.8993-3-quic_ugoswami@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 3b7323233b39..431ab6d07497 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1903,6 +1903,8 @@ static void functionfs_unbind(struct ffs_data *ffs)
 	ENTER();
 
 	if (!WARN_ON(!ffs->gadget)) {
+		/* dequeue before freeing ep0req */
+		usb_ep_dequeue(ffs->gadget->ep0, ffs->ep0req);
 		mutex_lock(&ffs->mutex);
 		usb_ep_free_request(ffs->gadget->ep0, ffs->ep0req);
 		ffs->ep0req = NULL;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux