netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gao Feng" <gfree.wind@foxmail.com>
To: "'Pablo Neira Ayuso'" <pablo@netfilter.org>, <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 22:20:59 +0800	[thread overview]
Message-ID: <005001d2a24e$5cffea30$16ffbe90$@foxmail.com> (raw)
In-Reply-To: <20170321141329.GA12171@salvia>

Hi Pablo,

> -----Original Message-----
> From: netfilter-devel-owner@vger.kernel.org
> [mailto:netfilter-devel-owner@vger.kernel.org] On Behalf Of Pablo Neira
Ayuso
> Sent: Tuesday, March 21, 2017 10:13 PM
> 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
> 
> 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?
Yes, we need to remove expect when remove helper and nat_helper.

> 
> 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().

Oh, I missed the data path, only covered the ctlink codes.
I would update the patch again.

Best Regards
Feng

> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel"
in the
> body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html




      reply	other threads:[~2017-03-21 14:33 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
2017-03-21 14:20     ` Gao Feng [this message]

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='005001d2a24e$5cffea30$16ffbe90$@foxmail.com' \
    --to=gfree.wind@foxmail.com \
    --cc=fgao@ikuai8.com \
    --cc=gfree_wind@126.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).