[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1544014590-14429-4-git-send-email-laoar.shao@gmail.com>
Date: Wed, 5 Dec 2018 20:56:29 +0800
From: Yafang Shao <laoar.shao@...il.com>
To: pablo@...filter.org, kadlec@...ckhole.kfki.hu, fw@...len.de,
davem@...emloft.net, adobriyan@...il.com, akpm@...ux-foundation.org
Cc: netfilter-devel@...r.kernel.org, coreteam@...filter.org,
netdev@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Yafang Shao <laoar.shao@...il.com>
Subject: [PATCH 4/5] netfilter: fix missed NULL check in nf_conntrack_proto_pernet_init()
nf_ct_l4proto_net() may return NULL.
That may happens if some module forget to set both l4proto->get_net_proto
and l4proto->net_id.
We'd check the return value here, in case crash happens.
Signed-off-by: Yafang Shao <laoar.shao@...il.com>
---
net/netfilter/nf_conntrack_proto.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c
index 154e8c0..316fef3 100644
--- a/net/netfilter/nf_conntrack_proto.c
+++ b/net/netfilter/nf_conntrack_proto.c
@@ -946,6 +946,9 @@ int nf_conntrack_proto_pernet_init(struct net *net)
struct nf_proto_net *pn = nf_ct_l4proto_net(net,
&nf_conntrack_l4proto_generic);
+ if (pn == NULL)
+ return -EINVAL;
+
err = nf_conntrack_l4proto_generic.init_net(net);
if (err < 0)
return err;
--
1.8.3.1
Powered by blists - more mailing lists