All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: fgao@ikuai8.com
Cc: netfilter-devel@vger.kernel.org, gfree_wind@126.com
Subject: Re: [PATCH nf v3 2/2] netfilter: helper: Fix possible panic caused by invoking expectfn unloaded
Date: Tue, 21 Mar 2017 15:13:29 +0100	[thread overview]
Message-ID: <20170321141329.GA12171@salvia> (raw)
In-Reply-To: <b30c3340a5b543d5544ced6aae5c7d585d423328.1490060879.git.fgao@ikuai8.com>

On Tue, Mar 21, 2017 at 02:06:26PM +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
> 
> Because the conntrack NAT module could be rmmod anytime, so we should
> really leave things in clean state if such thing happens and make sure
> we don't leave any packet running over code that will be gone after
> the removal.
> 
> We only removed the expectations when unregister conntrack helper before.
> Actually it is necessary too when remove the nat helper.

We still need something like this, right?

diff --git a/net/netfilter/nf_nat_sip.c b/net/netfilter/nf_nat_sip.c
index 791fac4fd745..38f1ed5219e4 100644
--- a/net/netfilter/nf_nat_sip.c
+++ b/net/netfilter/nf_nat_sip.c
@@ -377,6 +377,7 @@ static unsigned int nf_nat_sip_expect(struct
sk_buff *skb, unsigned int protoff,
        exp->saved_proto.udp.port = exp->tuple.dst.u.udp.port;
        exp->dir = !dir;
        exp->expectfn = nf_nat_sip_expected;
+       exp->nat_module = THIS_MODULE;
 
        for (; port != 0; port++) {
                int ret;

So if the user invokes:

        rmmod nf_nat_sip

we can get rid of this expectation from nf_ct_flush_expect().

  reply	other threads:[~2017-03-21 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21  6:06 [PATCH nf v3 0/2] Fix invoking expectfn unloaded fgao
2017-03-21  6:06 ` [PATCH nf v3 1/2] netfilter: helper: Rename struct nf_ct_helper_expectfn to nf_ct_nat_helper fgao
2017-03-21  6:06 ` [PATCH nf v3 2/2] netfilter: helper: Fix possible panic caused by invoking expectfn unloaded fgao
2017-03-21 14:13   ` Pablo Neira Ayuso [this message]
2017-03-21 14:20     ` Gao Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170321141329.GA12171@salvia \
    --to=pablo@netfilter.org \
    --cc=fgao@ikuai8.com \
    --cc=gfree_wind@126.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.