diff --git a/net/ipv6/route.c b/net/ipv6/route.c index d305051e8ab5..9ad78d2f4f6a 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3592,7 +3592,7 @@ int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, if (!dev) goto out; - if (idev->cnf.disable_ipv6) { + if (!idev || idev->cnf.disable_ipv6) { NL_SET_ERR_MSG(extack, "IPv6 is disabled on nexthop device"); err = -EACCES; goto out;