All of lore.kernel.org
 help / color / mirror / Atom feed
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
Date: Mon, 3 Mar 2014 18:10:14 +0100	[thread overview]
Message-ID: <20140303171014.GC3155@piout.net> (raw)
In-Reply-To: <1393865324-27309-1-git-send-email-gregory.clement@free-electrons.com>

On 03/03/2014 at 17:48:34 +0100, Gregory CLEMENT wrote :
> The debug trace in the atmel_usba_stop function made the assumption
> that the driver pointer passed in parameter was not NULL. Since the
> commit "usb: gadget: udc-core: fix a regression during gadget driver
> unbinding", it was no more always true. This lead to a kernel crash.
> 
> This commit now use the driver pointer stored in udc which fixes this
> issue.
> 
> Since the commit which have triggered this issue was backported to the
> 3.2 stable branch, then this one should also be backported to the same
> kernel.
> 
> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
> Cc: stable at vger.kernel.org # v3.2+
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
> Changelog:
> v1 -> v2
> Fixed the signature block in the commit log
> 
>  drivers/usb/gadget/atmel_usba_udc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 52771d4c44bc..167843de2d8a 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -1827,12 +1827,12 @@ static int atmel_usba_stop(struct usb_gadget *gadget,
>  	toggle_bias(0);
>  	usba_writel(udc, CTRL, USBA_DISABLE_MASK);
>  
> -	udc->driver = NULL;
> -
>  	clk_disable_unprepare(udc->hclk);
>  	clk_disable_unprepare(udc->pclk);
>  
> -	DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name);
> +	DBG(DBG_GADGET, "unregistered driver `%s'\n", udc->driver->driver.name);
> +
> +	udc->driver = NULL;
>  
>  	return 0;
>  }
> -- 
> 1.8.1.2
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	Felipe Balbi <balbi@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
Date: Mon, 3 Mar 2014 18:10:14 +0100	[thread overview]
Message-ID: <20140303171014.GC3155@piout.net> (raw)
In-Reply-To: <1393865324-27309-1-git-send-email-gregory.clement@free-electrons.com>

On 03/03/2014 at 17:48:34 +0100, Gregory CLEMENT wrote :
> The debug trace in the atmel_usba_stop function made the assumption
> that the driver pointer passed in parameter was not NULL. Since the
> commit "usb: gadget: udc-core: fix a regression during gadget driver
> unbinding", it was no more always true. This lead to a kernel crash.
> 
> This commit now use the driver pointer stored in udc which fixes this
> issue.
> 
> Since the commit which have triggered this issue was backported to the
> 3.2 stable branch, then this one should also be backported to the same
> kernel.
> 
> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
> Cc: stable@vger.kernel.org # v3.2+
> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
> Changelog:
> v1 -> v2
> Fixed the signature block in the commit log
> 
>  drivers/usb/gadget/atmel_usba_udc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index 52771d4c44bc..167843de2d8a 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -1827,12 +1827,12 @@ static int atmel_usba_stop(struct usb_gadget *gadget,
>  	toggle_bias(0);
>  	usba_writel(udc, CTRL, USBA_DISABLE_MASK);
>  
> -	udc->driver = NULL;
> -
>  	clk_disable_unprepare(udc->hclk);
>  	clk_disable_unprepare(udc->pclk);
>  
> -	DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name);
> +	DBG(DBG_GADGET, "unregistered driver `%s'\n", udc->driver->driver.name);
> +
> +	udc->driver = NULL;
>  
>  	return 0;
>  }
> -- 
> 1.8.1.2
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2014-03-03 17:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03 16:48 [PATCH v2] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled Gregory CLEMENT
2014-03-03 16:48 ` Gregory CLEMENT
2014-03-03 17:10 ` Alexandre Belloni [this message]
2014-03-03 17:10   ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140303171014.GC3155@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.