Merge remote-tracking branch 'stable/linux-3.0.y' into develop-3.0
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / route.c
index 0428b64ec400214d51833269cb78bca13498a372..c3961708d18eec77e32625850b19bbeb128129d1 100644 (file)
@@ -2755,10 +2755,15 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
            res.type == RTN_UNICAST && !fl4->flowi4_oif)
                fib_select_default(&res);
 
+       dev_out = FIB_RES_DEV(res);
+       if (dev_out == NULL) {
+               rth = ERR_PTR(-ENODEV);
+               goto out;
+       }
+
        if (!fl4->saddr)
                fl4->saddr = FIB_RES_PREFSRC(net, res);
 
-       dev_out = FIB_RES_DEV(res);
        fl4->flowi4_oif = dev_out->ifindex;