Patch "ipv4: fib: Fix NULL pointer deref during fib_sync_down_dev()" has been added to the 4.12-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
ipv4: fib: Fix NULL pointer deref during fib_sync_down_dev()
to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ipv4-fib-fix-null-pointer-deref-during-fib_sync_down_dev.patch
and it can be found in the queue-4.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Aug 8 16:27:29 PDT 2017
From: Ido Schimmel <[email protected]>
Date: Fri, 28 Jul 2017 23:27:44 +0300
Subject: ipv4: fib: Fix NULL pointer deref during fib_sync_down_dev()
From: Ido Schimmel <[email protected]>
[ Upstream commit 71ed7ee35ad2c5300f4b51634185a0193b4fb0fa ]
Michał reported a NULL pointer deref during fib_sync_down_dev() when unregistering a netdevice. The problem is that we don't check for 'in_dev' being NULL, which can happen in very specific cases.
Usually routes are flushed upon NETDEV_DOWN sent in either the netdev or the inetaddr notification chains. However, if an interface isn't configured with any IP address, then it's possible for host routes to be flushed following NETDEV_UNREGISTER, after NULLing dev->ip_ptr in inetdev_destroy().
To reproduce:
$ ip link add type dummy $ ip route add local 1.1.1.0/24 dev dummy0 $ ip link del dev dummy0
Fix this by checking for the presence of 'in_dev' before referencing it.
--- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_semantics.c +1 -1
@@ -1372,7 +1372,7 @@ static int call_fib_nh_notifiers(structreturn call_fib_notifiers (dev_net (fib_nh->nh_dev), event_type, &info.info);case FIB_EVENT_NH_DEL : -if ((IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN (in_dev) && +if ((in_dev &&IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN (in_dev) && fib_nh->nh_flags &RTNH_F_LINKDOWN ) || (fib_nh->nh_flags &RTNH_F_DEAD )) return call_fib_notifiers(dev_net(fib_nh->nh_dev),
Patches currently in stable-queue which might be from [email protected] are
queue-4.12/ipv4-fib-fix-null-pointer-deref-during-fib_sync_down_dev.patch