From 2a6960b36d5e8f4b46c0a00462c61c9f7a0dea16 Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Thu, 23 Jan 2014 10:19:34 +0100 Subject: [PATCH] fib_frontend: fix possible NULL pointer dereference The two commits 2c4dc291fa (net: remove delay at device dismantle) and b0c02f7d599 (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. Signed-off-by: Oliver Hartkopp Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- net/ipv4/fib_frontend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index d846304b7b89d..c7539e22868b3 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -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: -- 2.39.5