patch "usb: cdns3: ep0: add spinlock for cdns3_check_new_setup" added to usb-linus
This is a note to let you know that I've just added the patch titled
usb: cdns3: ep0: add spinlock for cdns3_check_new_setup
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From d0b78265cac9d8b5f7d5c97fa44860d6ab952dc8 Mon Sep 17 00:00:00 2001
From: Peter Chen <[email protected]>
Date: Tue, 23 Jun 2020 11:09:18 +0800
Subject: usb: cdns3: ep0: add spinlock for cdns3_check_new_setup
The other thread may access other endpoints when the cdns3_check_new_setup is handling, add spinlock to protect it.
--- drivers/usb/cdns3/ep0.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/cdns3/ep0.c +4 -3
@@ -705,15 +705,17 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,int ret =0 ;u8 zlp =0 ; +spin_lock_irqsave (&priv_dev->lock, flags);trace_cdns3_ep0_queue (priv_dev, request);/* cancel the request if controller receive new SETUP packet. */ -if (cdns3_check_new_setup (priv_dev)) +if (cdns3_check_new_setup (priv_dev)) { +spin_unlock_irqrestore (&priv_dev->lock, flags);return -ECONNRESET ; + }/* send STATUS stage. Should be called only for SET_CONFIGURATION */ if (priv_dev->ep0_stage ==CDNS3_STATUS_STAGE ) { -spin_lock_irqsave (&priv_dev->lock, flags);cdns3_select_ep (priv_dev,0x00 ); erdy_sent = !priv_dev->hw_configured_flag;
@@ -738,7 +740,6 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep,return 0 ; } -spin_lock_irqsave (&priv_dev->lock, flags);if (!list_empty (&priv_ep->pending_req_list)) {dev_err (priv_dev->dev,"can't handle multiple requests for ep0\n" );
Signature · 1 line
2.27.0