[Devel] [PATCH rh7 4/4] net: sit: fix crash on newlink if VE_FEATURE_SIT is disabled

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


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

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

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 2a73b520d3bf..6b1ae3b06be9 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1441,6 +1441,9 @@ static int ipip6_newlink(struct net *src_net, struct net_device *dev,
 #endif
 	int err;
 
+	if (net_generic(net, sit_net_id) == NULL)
+		return -EACCES;
+
 	nt = netdev_priv(dev);
 	ipip6_netlink_parms(data, &nt->parms);
 
-- 
2.1.4



More information about the Devel mailing list