From: Roopa Prabhu Date: Tue, 4 Aug 2015 13:36:24 +0000 (-0700) Subject: af_mpls: add null dev check in find_outdev X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3dcb615e6841eb945a49f605743a6923ed591400;p=openwrt%2Fstaging%2Fblogic.git af_mpls: add null dev check in find_outdev 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 Signed-off-by: Roopa Prabhu Signed-off-by: David S. Miller --- diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index d93c0301ad23..04306989d054 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c @@ -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; }