* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
@ 2016-02-12 20:56 Stephen Warren
2016-02-12 20:57 ` Marek Vasut
2016-02-12 21:15 ` Joe Hershberger
0 siblings, 2 replies; 7+ messages in thread
From: Stephen Warren @ 2016-02-12 20:56 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
The alignment and size were swapped, leading to malloc heap corruption.
On my system, this sometimes caused U-Boot to crash during or after
certain USB Ethernet operations.
Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
drivers/usb/eth/usb_ether.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c
index b9c9a8402e39..36734e2e51b3 100644
--- a/drivers/usb/eth/usb_ether.c
+++ b/drivers/usb/eth/usb_ether.c
@@ -73,7 +73,7 @@ int usb_ether_register(struct udevice *dev, struct ueth_data *ueth, int rxsize)
}
ueth->rxsize = rxsize;
- ueth->rxbuf = memalign(rxsize, ARCH_DMA_MINALIGN);
+ ueth->rxbuf = memalign(ARCH_DMA_MINALIGN, rxsize);
if (!ueth->rxbuf)
return -ENOMEM;
--
2.7.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
2016-02-12 20:56 [U-Boot] [PATCH] usb: eth: fix memalign() parameter order Stephen Warren
@ 2016-02-12 20:57 ` Marek Vasut
2016-02-12 21:09 ` Simon Glass
2016-02-12 21:15 ` Joe Hershberger
1 sibling, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2016-02-12 20:57 UTC (permalink / raw)
To: u-boot
On 02/12/2016 09:56 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> The alignment and size were swapped, leading to malloc heap corruption.
>
> On my system, this sometimes caused U-Boot to crash during or after
> certain USB Ethernet operations.
>
> Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Oh this is a nice catch!
Acked-by: Marek Vasut <marex@denx.de>
> ---
> drivers/usb/eth/usb_ether.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c
> index b9c9a8402e39..36734e2e51b3 100644
> --- a/drivers/usb/eth/usb_ether.c
> +++ b/drivers/usb/eth/usb_ether.c
> @@ -73,7 +73,7 @@ int usb_ether_register(struct udevice *dev, struct ueth_data *ueth, int rxsize)
> }
>
> ueth->rxsize = rxsize;
> - ueth->rxbuf = memalign(rxsize, ARCH_DMA_MINALIGN);
> + ueth->rxbuf = memalign(ARCH_DMA_MINALIGN, rxsize);
> if (!ueth->rxbuf)
> return -ENOMEM;
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
2016-02-12 20:57 ` Marek Vasut
@ 2016-02-12 21:09 ` Simon Glass
0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2016-02-12 21:09 UTC (permalink / raw)
To: u-boot
On 12 February 2016 at 13:57, Marek Vasut <marex@denx.de> wrote:
> On 02/12/2016 09:56 PM, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The alignment and size were swapped, leading to malloc heap corruption.
>>
>> On my system, this sometimes caused U-Boot to crash during or after
>> certain USB Ethernet operations.
>>
>> Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>
> Oh this is a nice catch!
>
> Acked-by: Marek Vasut <marex@denx.de>
>
>> ---
>> drivers/usb/eth/usb_ether.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c
>> index b9c9a8402e39..36734e2e51b3 100644
>> --- a/drivers/usb/eth/usb_ether.c
>> +++ b/drivers/usb/eth/usb_ether.c
>> @@ -73,7 +73,7 @@ int usb_ether_register(struct udevice *dev, struct ueth_data *ueth, int rxsize)
>> }
>>
>> ueth->rxsize = rxsize;
>> - ueth->rxbuf = memalign(rxsize, ARCH_DMA_MINALIGN);
>> + ueth->rxbuf = memalign(ARCH_DMA_MINALIGN, rxsize);
>> if (!ueth->rxbuf)
>> return -ENOMEM;
>>
>>
>
Oh dear. For some reason I thought that was fixed. But I see from this
thread that it did not fix the problem at the time and I didn't send a
patch either:
http://lists.denx.de/pipermail/u-boot/2015-August/222440.html
Reviewed-by: Simon Glass <sjg@chromium.org>
Thanks Stephen for finding this and actually fixing it :-)
- Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
2016-02-12 20:56 [U-Boot] [PATCH] usb: eth: fix memalign() parameter order Stephen Warren
2016-02-12 20:57 ` Marek Vasut
@ 2016-02-12 21:15 ` Joe Hershberger
2016-02-12 21:16 ` Marek Vasut
1 sibling, 1 reply; 7+ messages in thread
From: Joe Hershberger @ 2016-02-12 21:15 UTC (permalink / raw)
To: u-boot
On Fri, Feb 12, 2016 at 2:56 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> The alignment and size were swapped, leading to malloc heap corruption.
>
> On my system, this sometimes caused U-Boot to crash during or after
> certain USB Ethernet operations.
>
> Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Yikes.
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
2016-02-12 21:15 ` Joe Hershberger
@ 2016-02-12 21:16 ` Marek Vasut
2016-02-22 16:56 ` Stephen Warren
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2016-02-12 21:16 UTC (permalink / raw)
To: u-boot
On 02/12/2016 10:15 PM, Joe Hershberger wrote:
> On Fri, Feb 12, 2016 at 2:56 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The alignment and size were swapped, leading to malloc heap corruption.
>>
>> On my system, this sometimes caused U-Boot to crash during or after
>> certain USB Ethernet operations.
>>
>> Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>
> Yikes.
>
> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
>
Applied to u-boot-usb/master, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
2016-02-12 21:16 ` Marek Vasut
@ 2016-02-22 16:56 ` Stephen Warren
2016-02-24 18:16 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2016-02-22 16:56 UTC (permalink / raw)
To: u-boot
On 02/12/2016 02:16 PM, Marek Vasut wrote:
> On 02/12/2016 10:15 PM, Joe Hershberger wrote:
>> On Fri, Feb 12, 2016 at 2:56 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> The alignment and size were swapped, leading to malloc heap corruption.
>>>
>>> On my system, this sometimes caused U-Boot to crash during or after
>>> certain USB Ethernet operations.
>>>
>>> Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB Ethernet")
>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>
>> Yikes.
>>
>> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
>>
> Applied to u-boot-usb/master, thanks.
Thanks. Any chance of a pull request into mainline? This issue is
causing lots of crashing on one of the systems in my test setup, which
potentially masks other problems.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] usb: eth: fix memalign() parameter order
2016-02-22 16:56 ` Stephen Warren
@ 2016-02-24 18:16 ` Marek Vasut
0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2016-02-24 18:16 UTC (permalink / raw)
To: u-boot
On 02/22/2016 05:56 PM, Stephen Warren wrote:
> On 02/12/2016 02:16 PM, Marek Vasut wrote:
>> On 02/12/2016 10:15 PM, Joe Hershberger wrote:
>>> On Fri, Feb 12, 2016 at 2:56 PM, Stephen Warren
>>> <swarren@wwwdotorg.org> wrote:
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>
>>>> The alignment and size were swapped, leading to malloc heap corruption.
>>>>
>>>> On my system, this sometimes caused U-Boot to crash during or after
>>>> certain USB Ethernet operations.
>>>>
>>>> Fixes: c8c2797c3810 ("dm: usb: eth: Support driver model with USB
>>>> Ethernet")
>>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>>
>>> Yikes.
>>>
>>> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
>>>
>> Applied to u-boot-usb/master, thanks.
>
> Thanks. Any chance of a pull request into mainline? This issue is
> causing lots of crashing on one of the systems in my test setup, which
> potentially masks other problems.
Done, sorry for the delay.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-24 18:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12 20:56 [U-Boot] [PATCH] usb: eth: fix memalign() parameter order Stephen Warren
2016-02-12 20:57 ` Marek Vasut
2016-02-12 21:09 ` Simon Glass
2016-02-12 21:15 ` Joe Hershberger
2016-02-12 21:16 ` Marek Vasut
2016-02-22 16:56 ` Stephen Warren
2016-02-24 18:16 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox