Commit 1ae292a2 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by David S. Miller

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: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Fixes: 2647cffb ("net: ipconfig: Support using "delayed" DHCP replies")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8b7ac60a
...@@ -306,7 +306,7 @@ static void __init ic_close_devs(void) ...@@ -306,7 +306,7 @@ static void __init ic_close_devs(void)
while ((d = next)) { while ((d = next)) {
next = d->next; next = d->next;
dev = d->dev; 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); pr_debug("IP-Config: Downing %s\n", dev->name);
dev_change_flags(dev, d->flags); dev_change_flags(dev, d->flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment