public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] NET: Fix system hanging if NET device is not installed
@ 2013-05-17  9:41 Jim Lin
  2013-05-18  0:18 ` Stephen Warren
  2013-06-19 12:36 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Jim Lin @ 2013-05-17  9:41 UTC (permalink / raw)
  To: u-boot

If we try to boot from NET device, NetInitLoop in net.c will be invoked.
If NET device is not installed, eth_get_dev() function will return
eth_current value, which is NULL.
When NetInitLoop is called, "eth_get_dev->enetaddr" will access
restricted memory area and therefore cause hanging.
This issue is found on Tegra30 Cardhu platform after adding
CONFIG_CMD_NET and CONFIG_CMD_DHCP in config header file.

Signed-off-by: Jim Lin <jilin@nvidia.com>
---
 net/net.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/net.c b/net/net.c
index df94789..7663b9c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -271,7 +271,8 @@ static void NetInitLoop(void)
 #endif
 		env_changed_id = env_id;
 	}
-	memcpy(NetOurEther, eth_get_dev()->enetaddr, 6);
+	if (eth_get_dev())
+		memcpy(NetOurEther, eth_get_dev()->enetaddr, 6);
 
 	return;
 }
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 1/1] NET: Fix system hanging if NET device is not installed
  2013-05-17  9:41 [U-Boot] [PATCH 1/1] NET: Fix system hanging if NET device is not installed Jim Lin
@ 2013-05-18  0:18 ` Stephen Warren
  2013-06-19 12:36 ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2013-05-18  0:18 UTC (permalink / raw)
  To: u-boot

On 05/17/2013 03:41 AM, Jim Lin wrote:
> If we try to boot from NET device, NetInitLoop in net.c will be invoked.
> If NET device is not installed, eth_get_dev() function will return
> eth_current value, which is NULL.
> When NetInitLoop is called, "eth_get_dev->enetaddr" will access
> restricted memory area and therefore cause hanging.
> This issue is found on Tegra30 Cardhu platform after adding
> CONFIG_CMD_NET and CONFIG_CMD_DHCP in config header file.

Tested-by: Stephen Warren <swarren@nvidia.com>

This fixes the crash I was seeing on the Cardhu board. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [U-Boot, 1/1] NET: Fix system hanging if NET device is not installed
  2013-05-17  9:41 [U-Boot] [PATCH 1/1] NET: Fix system hanging if NET device is not installed Jim Lin
  2013-05-18  0:18 ` Stephen Warren
@ 2013-06-19 12:36 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2013-06-19 12:36 UTC (permalink / raw)
  To: u-boot

On Fri, May 17, 2013 at 05:41:03PM +0800, Jim Lin wrote:

> If we try to boot from NET device, NetInitLoop in net.c will be invoked.
> If NET device is not installed, eth_get_dev() function will return
> eth_current value, which is NULL.
> When NetInitLoop is called, "eth_get_dev->enetaddr" will access
> restricted memory area and therefore cause hanging.
> This issue is found on Tegra30 Cardhu platform after adding
> CONFIG_CMD_NET and CONFIG_CMD_DHCP in config header file.
> 
> Signed-off-by: Jim Lin <jilin@nvidia.com>
> Tested-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130619/2dd57dd2/attachment.pgp>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-19 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17  9:41 [U-Boot] [PATCH 1/1] NET: Fix system hanging if NET device is not installed Jim Lin
2013-05-18  0:18 ` Stephen Warren
2013-06-19 12:36 ` [U-Boot] [U-Boot, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox