aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiping Zhang <zlpnobody@gmail.com>2017-04-17 09:18:55 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2017-04-24 14:06:28 -0400
commit14e567615679a9999ce6bf4f23d6c9e00f03e00e (patch)
treed466c2f6163a18a4f16bcd9327730563a5b95f80
parent54a5f9d9abab639039eb7288bdc26c9c67f4e79b (diff)
netfilter: ctnetlink: drop the incorrect cthelper module request
First, when creating a new ct, we will invoke request_module to try to load the related inkernel cthelper. So there's no need to call the request_module again when updating the ct helpinfo. Second, ctnetlink_change_helper may be called with rcu_read_lock held, i.e. rcu_read_lock -> nfqnl_recv_verdict -> nfqnl_ct_parse -> ctnetlink_glue_parse -> ctnetlink_glue_parse_ct -> ctnetlink_change_helper. But the request_module invocation may sleep, so we can't call it with the rcu_read_lock held. Remove it now. Signed-off-by: Liping Zhang <zlpnobody@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/nf_conntrack_netlink.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index dc7dfd68fafe..48c184552de0 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1512,23 +1512,8 @@ static int ctnetlink_change_helper(struct nf_conn *ct,
1512 1512
1513 helper = __nf_conntrack_helper_find(helpname, nf_ct_l3num(ct), 1513 helper = __nf_conntrack_helper_find(helpname, nf_ct_l3num(ct),
1514 nf_ct_protonum(ct)); 1514 nf_ct_protonum(ct));
1515 if (helper == NULL) { 1515 if (helper == NULL)
1516#ifdef CONFIG_MODULES
1517 spin_unlock_bh(&nf_conntrack_expect_lock);
1518
1519 if (request_module("nfct-helper-%s", helpname) < 0) {
1520 spin_lock_bh(&nf_conntrack_expect_lock);
1521 return -EOPNOTSUPP;
1522 }
1523
1524 spin_lock_bh(&nf_conntrack_expect_lock);
1525 helper = __nf_conntrack_helper_find(helpname, nf_ct_l3num(ct),
1526 nf_ct_protonum(ct));
1527 if (helper)
1528 return -EAGAIN;
1529#endif
1530 return -EOPNOTSUPP; 1516 return -EOPNOTSUPP;
1531 }
1532 1517
1533 if (help) { 1518 if (help) {
1534 if (help->helper == helper) { 1519 if (help->helper == helper) {