Re: [PATCH] usb composite: fix locking in usb_function_activate

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

 



 On Thu, Jul 19, 2012 at 12:20:11AM +0200, Michael Grzeschik wrote:
> The lockdep hunter mentions a non consistent usage of spin_lock and
> spin_lock_irqsafe in the composite_disconnect and usb_function_activate
> function:
[...]
 
> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>

Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

> ---
>  drivers/usb/gadget/composite.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 3f72110..2cb1030 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -300,9 +300,10 @@ int usb_function_deactivate(struct usb_function *function)
>  int usb_function_activate(struct usb_function *function)
>  {
>  	struct usb_composite_dev	*cdev = function->config->cdev;
> +	unsigned long			flags;
>  	int				status = 0;
>  
> -	spin_lock(&cdev->lock);
> +	spin_lock_irqsave(&cdev->lock, flags);
>  
>  	if (WARN_ON(cdev->deactivations == 0))
>  		status = -EINVAL;
> @@ -312,7 +313,7 @@ int usb_function_activate(struct usb_function *function)
>  			status = usb_gadget_connect(cdev->gadget);
>  	}
>  
> -	spin_unlock(&cdev->lock);
> +	spin_unlock_irqrestore(&cdev->lock, flags);
>  	return status;
>  }

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--

Attachment: pgpA223GX5VDx.pgp
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux