Patch "usb: gadget: fix wrong endpoint desc" has been added to the 4.14-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: fix wrong endpoint desc

to the 4.14-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-fix-wrong-endpoint-desc.patch
and it can be found in the queue-4.14 subdirectory.

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



commit dab76427ac2cf1a7528fe926a7b13f59b900610a
Author: EJ Hsu <ejh@xxxxxxxxxx>
Date:   Tue Dec 3 23:34:56 2019 -0800

    usb: gadget: fix wrong endpoint desc
    
    [ Upstream commit e5b5da96da50ef30abb39cb9f694e99366404d24 ]
    
    Gadget driver should always use config_ep_by_speed() to initialize
    usb_ep struct according to usb device's operating speed. Otherwise,
    usb_ep struct may be wrong if usb devcie's operating speed is changed.
    
    The key point in this patch is that we want to make sure the desc pointer
    in usb_ep struct will be set to NULL when gadget is disconnected.
    This will force it to call config_ep_by_speed() to correctly initialize
    usb_ep struct based on the new operating speed when gadget is
    re-connected later.
    
    Reviewed-by: Peter Chen <peter.chen@xxxxxxx>
    Signed-off-by: EJ Hsu <ejh@xxxxxxxxxx>
    Signed-off-by: Felipe Balbi <balbi@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 4c488d15b6f6..dc99ed94f03d 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -625,8 +625,12 @@ static void ecm_disable(struct usb_function *f)
 
 	DBG(cdev, "ecm deactivated\n");
 
-	if (ecm->port.in_ep->enabled)
+	if (ecm->port.in_ep->enabled) {
 		gether_disconnect(&ecm->port);
+	} else {
+		ecm->port.in_ep->desc = NULL;
+		ecm->port.out_ep->desc = NULL;
+	}
 
 	usb_ep_disable(ecm->notify);
 	ecm->notify->desc = NULL;
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index c7c5b3ce1d98..2bde68f5d246 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -622,6 +622,7 @@ static void rndis_disable(struct usb_function *f)
 	gether_disconnect(&rndis->port);
 
 	usb_ep_disable(rndis->notify);
+	rndis->notify->desc = 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