mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-17 12:41:32 +00:00
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>
This commit is contained in:
parent
2f99807125
commit
7315cfd9e1
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue