aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2019-10-11 18:14:55 -0700
committerDavid S. Miller <davem@davemloft.net>2019-10-15 10:35:23 -0700
commitb0818f80c8c1bc215bba276bd61c216014fab23b (patch)
tree4ca7931e6ae9d3e2d3d115d01b0fda824a9ca97e /net/ipv6/addrconf.c
parentMerge tag 'wireless-drivers-for-davem-2019-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers (diff)
downloadlinux-dev-b0818f80c8c1bc215bba276bd61c216014fab23b.tar.xz
linux-dev-b0818f80c8c1bc215bba276bd61c216014fab23b.zip
blackhole_netdev: fix syzkaller reported issue
While invalidating the dst, we assign backhole_netdev instead of loopback device. However, this device does not have idev pointer and hence no ip6_ptr even if IPv6 is enabled. Possibly this has triggered the syzbot reported crash. The syzbot report does not have reproducer, however, this is the only device that doesn't have matching idev created. Crash instruction is : static inline bool ip6_ignore_linkdown(const struct net_device *dev) { const struct inet6_dev *idev = __in6_dev_get(dev); return !!idev->cnf.ignore_routes_with_linkdown; <= crash } Also ipv6 always assumes presence of idev and never checks for it being NULL (as does the above referenced code). So adding a idev for the blackhole_netdev to avoid this class of crashes in the future. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/ipv6/addrconf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 34ccef18b40e..4c87594d1389 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6996,7 +6996,7 @@ static struct rtnl_af_ops inet6_ops __read_mostly = {
int __init addrconf_init(void)
{
- struct inet6_dev *idev;
+ struct inet6_dev *idev, *bdev;
int i, err;
err = ipv6_addr_label_init();
@@ -7036,10 +7036,14 @@ int __init addrconf_init(void)
*/
rtnl_lock();
idev = ipv6_add_dev(init_net.loopback_dev);
+ bdev = ipv6_add_dev(blackhole_netdev);
rtnl_unlock();
if (IS_ERR(idev)) {
err = PTR_ERR(idev);
goto errlo;
+ } else if (IS_ERR(bdev)) {
+ err = PTR_ERR(bdev);
+ goto errlo;
}
ip6_route_init_special_entries();
@@ -7124,6 +7128,7 @@ void addrconf_cleanup(void)
addrconf_ifdown(dev, 1);
}
addrconf_ifdown(init_net.loopback_dev, 2);
+ addrconf_ifdown(blackhole_netdev, 2);
/*
* Check hash table.