path: root/net/ipv4/ipconfig.c
diff options
authorGeert Uytterhoeven <geert+renesas@glider.be>2016-08-22 15:01:03 +0200
committerDavid S. Miller <davem@davemloft.net>2016-08-22 21:04:41 -0700
commit1ae292a2457cd692828da2be87cb967260993ad0 (patch)
tree7f8e6b2718168f811a8aebb437c7c7ef62d33662 /net/ipv4/ipconfig.c
parentMerge tag 'batadv-next-for-davem-20160822' of git://git.open-mesh.org/linux-merge (diff)
net: ipconfig: Fix NULL pointer dereference on RARP/BOOTP/DHCP timeout
If no RARP, BOOTP, or DHCP response is received, ic_dev is never set, causing a NULL pointer dereference in ic_close_devs(): Sending DHCP requests ...... timed out! Unable to handle kernel NULL pointer dereference at virtual address 00000004 To fix this, add a check to avoid dereferencing ic_dev if it is still NULL. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Fixes: 2647cffb2bc6fbed ("net: ipconfig: Support using "delayed" DHCP replies") Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipconfig.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index ba9cbeafbb2e..071a785c65eb 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -306,7 +306,7 @@ static void __init ic_close_devs(void)
while ((d = next)) {
next = d->next;
dev = d->dev;
- if (dev != ic_dev->dev && !netdev_uses_dsa(dev)) {
+ if ((!ic_dev || dev != ic_dev->dev) && !netdev_uses_dsa(dev)) {
pr_debug("IP-Config: Downing %s\n", dev->name);
dev_change_flags(dev, d->flags);