summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJim Lin <jilin@nvidia.com>2013-05-17 17:41:03 +0800
committerTom Rini <trini@ti.com>2013-06-19 08:32:44 -0400
commit7315cfd9e1922ee1c3c5f016e5a3b16199122172 (patch)
treed152589def2062441c5d6fdb02c9d15f9f631eac /net
parent2f998071254d566c71c34ef013aef1d9d0ec0fa3 (diff)
downloadu-boot-imx-7315cfd9e1922ee1c3c5f016e5a3b16199122172.zip
u-boot-imx-7315cfd9e1922ee1c3c5f016e5a3b16199122172.tar.gz
u-boot-imx-7315cfd9e1922ee1c3c5f016e5a3b16199122172.tar.bz2
NET: Fix system hanging if NET device is not installed
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>
Diffstat (limited to 'net')
-rw-r--r--net/net.c3
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;
}