From: Roopa Prabhu <ro...@cumulusnetworks.com>

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.carpen...@oracle.com>
Signed-off-by: Roopa Prabhu <ro...@cumulusnetworks.com>
---
v1-v2 : fixed patch version

 net/mpls/af_mpls.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index b6b9a6c..3ea90ff 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -416,6 +416,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;
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to