ipv4: Check if dev_out is NULL in ip_route_output_slow()
authorDmitry Shmidt <dimitrysh@google.com>
Mon, 26 Nov 2012 20:50:50 +0000 (12:50 -0800)
committerDmitry Shmidt <dimitrysh@google.com>
Mon, 26 Nov 2012 20:50:50 +0000 (12:50 -0800)
Change-Id: If04a8e99942dbe7e099e736dc87c2a49e1e778f9
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
net/ipv4/route.c

index 6b95f74a91d3f87c5d6b4f2bcef7dc35b671882d..37be8f6548668b2889edb5df2622b5bb6cf7ac9f 100644 (file)
@@ -2751,10 +2751,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;