* [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
@ 2014-02-28 14:34 Gregory CLEMENT
2014-02-28 15:50 ` Alexandre Belloni
2014-03-03 16:33 ` Felipe Balbi
0 siblings, 2 replies; 6+ messages in thread
From: Gregory CLEMENT @ 2014-02-28 14:34 UTC (permalink / raw)
To: Nicolas Ferre, Felipe Balbi
Cc: Alexandre Belloni, Greg Kroah-Hartman, linux-arm-kernel,
linux-usb, linux-kernel, Gregory CLEMENT, stable
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.
Cc: stable@vger.kernel.org # v3.2+
Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
2014-02-28 14:34 [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled Gregory CLEMENT
@ 2014-02-28 15:50 ` Alexandre Belloni
2014-02-28 16:18 ` Gregory CLEMENT
2014-03-03 16:33 ` Felipe Balbi
1 sibling, 1 reply; 6+ messages in thread
From: Alexandre Belloni @ 2014-02-28 15:50 UTC (permalink / raw)
To: Gregory CLEMENT
Cc: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman, linux-arm-kernel,
linux-usb, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]
Hi Gregory,
On 28/02/2014 at 15:34:01 +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.
>
> Cc: stable@vger.kernel.org # v3.2+
> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
> ---
> 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;
Shouldn't we get rid of that assignment as it is done in
usb_gadget_remove_driver() anyway ?
>
> return 0;
> }
> --
> 1.8.1.2
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
2014-02-28 15:50 ` Alexandre Belloni
@ 2014-02-28 16:18 ` Gregory CLEMENT
0 siblings, 0 replies; 6+ messages in thread
From: Gregory CLEMENT @ 2014-02-28 16:18 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Nicolas Ferre, Felipe Balbi, Greg Kroah-Hartman, linux-arm-kernel,
linux-usb, linux-kernel, stable
On 28/02/2014 16:50, Alexandre Belloni wrote:
> Hi Gregory,
>
> On 28/02/2014 at 15:34:01 +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.
>>
>> Cc: stable@vger.kernel.org # v3.2+
>> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
>> ---
>> 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;
>
> Shouldn't we get rid of that assignment as it is done in
> usb_gadget_remove_driver() anyway ?
usb_gadget_remove_driver() is not the only function to use it.
usb_udc_softconn_store() can call it too and doesn't have any
debug message.
Thanks,
Gregory
>
>>
>> return 0;
>> }
>> --
>> 1.8.1.2
>>
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
2014-02-28 14:34 [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled Gregory CLEMENT
2014-02-28 15:50 ` Alexandre Belloni
@ 2014-03-03 16:33 ` Felipe Balbi
2014-03-03 16:38 ` Gregory CLEMENT
1 sibling, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2014-03-03 16:33 UTC (permalink / raw)
To: Gregory CLEMENT
Cc: Nicolas Ferre, Felipe Balbi, Alexandre Belloni,
Greg Kroah-Hartman, linux-arm-kernel, linux-usb, linux-kernel,
stable
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
On Fri, Feb 28, 2014 at 03:34:01PM +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.
>
> Cc: stable@vger.kernel.org # v3.2+
> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
this line shouldn't be here and you're missing a SoB line, can't take
this patch, sorry.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
2014-03-03 16:33 ` Felipe Balbi
@ 2014-03-03 16:38 ` Gregory CLEMENT
2014-03-03 16:41 ` Felipe Balbi
0 siblings, 1 reply; 6+ messages in thread
From: Gregory CLEMENT @ 2014-03-03 16:38 UTC (permalink / raw)
To: balbi
Cc: Nicolas Ferre, Alexandre Belloni, Greg Kroah-Hartman,
linux-arm-kernel, linux-usb, linux-kernel, stable
On 03/03/2014 17:33, Felipe Balbi wrote:
> On Fri, Feb 28, 2014 at 03:34:01PM +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.
>>
>> Cc: stable@vger.kernel.org # v3.2+
>> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
>
> this line shouldn't be here and you're missing a SoB line, can't take
> this patch, sorry.
Right, I forgot the -s option for this commit.
and you want the "Fixes" line be before the Cc: line, right?
Thanks,
Gregory
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled
2014-03-03 16:38 ` Gregory CLEMENT
@ 2014-03-03 16:41 ` Felipe Balbi
0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2014-03-03 16:41 UTC (permalink / raw)
To: Gregory CLEMENT
Cc: balbi, Nicolas Ferre, Alexandre Belloni, Greg Kroah-Hartman,
linux-arm-kernel, linux-usb, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]
On Mon, Mar 03, 2014 at 05:38:49PM +0100, Gregory CLEMENT wrote:
> On 03/03/2014 17:33, Felipe Balbi wrote:
> > On Fri, Feb 28, 2014 at 03:34:01PM +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.
> >>
> >> Cc: stable@vger.kernel.org # v3.2+
> >> Fixes: 511f3c5326ea (usb: gadget: udc-core: fix a regression during gadget driver unbinding)
> >
> > this line shouldn't be here and you're missing a SoB line, can't take
> > this patch, sorry.
>
> Right, I forgot the -s option for this commit.
>
> and you want the "Fixes" line be before the Cc: line, right?
right, that should do it.
cheers
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-03 16:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28 14:34 [PATCH] usb: gadget: atmel_usba: Fix crashed during stopping when DEBUG is enabled Gregory CLEMENT
2014-02-28 15:50 ` Alexandre Belloni
2014-02-28 16:18 ` Gregory CLEMENT
2014-03-03 16:33 ` Felipe Balbi
2014-03-03 16:38 ` Gregory CLEMENT
2014-03-03 16:41 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).