Skip to contentSkip to conversation

fib_frontend: fix possible NULL pointer dereference

PATCH In review Oliver Hartkopp 3 participants 3 messages Jan 23, 2014 – Jan 24, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fib_frontend: fix possible NULL pointer dereference

The two commits 0115e8e30d (net: remove delay at device dismantle) and 748e2d9396a (net: reinstate rtnl in call_netdevice_notifiers()) silently removed a NULL pointer check for in_dev since Linux 3.7.

This patch re-introduces this check as it causes crashing the kernel when setting small mtu values on non-ip capable netdevices.

---

net/ipv4/fib_frontend.c +2 -0
index d846304..c7539e2 100644
@@ -1047,6 +1047,8 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 	}
 
 	in_dev = __in_dev_get_rtnl(dev);
+	if (!in_dev)
+		return NOTIFY_DONE;
 
 	switch (event) {
 	case NETDEV_UP:
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Oliver Hartkopp

The two commits 0115e8e30d (net: remove delay at device dismantle) and 748e2d9396a (net: reinstate rtnl in call_netdevice_notifiers()) silently removed a NULL pointer check for in_dev since Linux 3.7.

This patch re-introduces this check as it causes crashing the kernel when setting small mtu values on non-ip capable netdevices.

---

Thanks for the fix !

maintainer
#2 lore raw
In reply to Oliver Hartkopp

From: Oliver Hartkopp <[email protected]>
Date: Thu, 23 Jan 2014 10:19:34 +0100

Quoted 8 lines

The two commits 0115e8e30d (net: remove delay at device dismantle) and 748e2d9396a (net: reinstate rtnl in call_netdevice_notifiers()) silently removed a NULL pointer check for in_dev since Linux 3.7.

This patch re-introduces this check as it causes crashing the kernel when setting small mtu values on non-ip capable netdevices.

Applied and queued up for -stable, thanks.