diff mbox series

usb: gadget: core: remove unbalanced mutex_unlock in usb_gadget_activate

Message ID 20230721222256.1743645-1-m.grzeschik@pengutronix.de
State New
Headers show
Series usb: gadget: core: remove unbalanced mutex_unlock in usb_gadget_activate | expand

Commit Message

Michael Grzeschik July 21, 2023, 10:22 p.m. UTC
Commit 286d9975a838 ("usb: gadget: udc: core: Prevent soft_connect_store() race")
introduced one extra mutex_unlock of connect_lock in the usb_gadget_active function.

Fixes: 286d9975a838 ("usb: gadget: udc: core: Prevent soft_connect_store() race")
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/usb/gadget/udc/core.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Alan Stern July 24, 2023, 2:26 p.m. UTC | #1
On Sat, Jul 22, 2023 at 12:22:56AM +0200, Michael Grzeschik wrote:
> Commit 286d9975a838 ("usb: gadget: udc: core: Prevent soft_connect_store() race")
> introduced one extra mutex_unlock of connect_lock in the usb_gadget_active function.
> 
> Fixes: 286d9975a838 ("usb: gadget: udc: core: Prevent soft_connect_store() race")
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---

Hard to see how we missed that...

Reviewed-by: Alan Stern <stern@rowland.harvard.edu>

Thanks!

>  drivers/usb/gadget/udc/core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index 59188ea065e0c9..cd58f2a4e7f34d 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -878,7 +878,6 @@ int usb_gadget_activate(struct usb_gadget *gadget)
>  	 */
>  	if (gadget->connected)
>  		ret = usb_gadget_connect_locked(gadget);
> -	mutex_unlock(&gadget->udc->connect_lock);
>  
>  unlock:
>  	mutex_unlock(&gadget->udc->connect_lock);
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index 59188ea065e0c9..cd58f2a4e7f34d 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -878,7 +878,6 @@  int usb_gadget_activate(struct usb_gadget *gadget)
 	 */
 	if (gadget->connected)
 		ret = usb_gadget_connect_locked(gadget);
-	mutex_unlock(&gadget->udc->connect_lock);
 
 unlock:
 	mutex_unlock(&gadget->udc->connect_lock);