From: Jim Lin Date: Fri, 17 May 2013 09:41:03 +0000 (+0800) Subject: NET: Fix system hanging if NET device is not installed X-Git-Tag: submit/tizen/20160318.071304~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f4d884a8ead99046f7b8b2b54e441c9c07f76169;p=profile%2Fcommon%2Fplatform%2Fkernel%2Fu-boot-artik.git 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. Change-Id: I8bf18901842043f33a06c96ab5201c406fe0f605 Signed-off-by: Jim Lin Tested-by: Stephen Warren Signed-off-by: Jae-young Hwang --- diff --git a/net/net.c b/net/net.c index e8ff0662b..ea8ac4772 100644 --- a/net/net.c +++ b/net/net.c @@ -256,7 +256,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; }