[Devel] [PATCH rh7 3/4] net: ipip: fix crash on newlink if VE_FEATURE_IPIP is disabled

Vladimir Davydov vdavydov at virtuozzo.com
Thu Jun 23 01:57:04 PDT 2016


In this case net_generic returns NULL. We must handle this gracefully.

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 net/ipv4/ipip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 7842dcb2fd65..b1004fb7539c 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -357,6 +357,9 @@ static int ipip_newlink(struct net *src_net, struct net_device *dev,
 {
 	struct ip_tunnel_parm p;
 
+	if (net_generic(dev_net(dev), ipip_net_id) == NULL)
+		return -EACCES;
+
 	ipip_netlink_parms(data, &p);
 	return ip_tunnel_newlink(dev, tb, &p);
 }
-- 
2.1.4



More information about the Devel mailing list