af_mpls: add null dev check in find_outdev
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Tue, 4 Aug 2015 13:36:24 +0000 (06:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Aug 2015 05:03:58 +0000 (22:03 -0700)
This patch adds null dev check for the 'cfg->rc_via_table ==
NEIGH_LINK_TABLE or dev_get_by_index() failed' case

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mpls/af_mpls.c

index d93c030..0430698 100644 (file)
@@ -411,6 +411,9 @@ static struct net_device *find_outdev(struct net *net,
                dev = dev_get_by_index(net, cfg->rc_ifindex);
        }
 
+       if (!dev)
+               return ERR_PTR(-ENODEV);
+
        return dev;
 }