diff mbox

[net-next,v2] af_mpls: add null dev check in find_outdev

Message ID 1438695384-26306-1-git-send-email-roopa@cumulusnetworks.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Roopa Prabhu Aug. 4, 2015, 1:36 p.m. UTC
From: Roopa Prabhu <roopa@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.carpenter@oracle.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
v1-v2 : fixed patch version

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

Comments

David Miller Aug. 7, 2015, 5:04 a.m. UTC | #1
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Tue,  4 Aug 2015 06:36:24 -0700

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

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

Patch

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;
 }