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@gmail.com
Subject: Re: [PATCH v2 nf 1/1] netfilter: helper: Fix possible panic caused by invoking expectfn unloaded
Date: Mon, 20 Mar 2017 13:50:40 +0100	[thread overview]
Message-ID: <20170320125040.GA12416@salvia> (raw)
In-Reply-To: <20170320104442.GA10855@salvia>

On Mon, Mar 20, 2017 at 11:44:42AM +0100, Pablo Neira Ayuso wrote:
> > diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
> > index 6dc44d9..6c840af 100644
> > --- a/net/netfilter/nf_conntrack_helper.c
> > +++ b/net/netfilter/nf_conntrack_helper.c
> > @@ -130,6 +130,42 @@ static unsigned int helper_hash(const struct nf_conntrack_tuple *tuple)
> >  	return NULL;
> >  }
> >  
> > +static void
> > +nf_ct_remove_expect_refer_dying_module(const struct module *me)
> > +{
> > +	struct nf_conntrack_expect *exp;
> > +	const struct hlist_node *next;
> > +	u32 i;
> > +
> > +	if (!me)
> > +		return;
> > +
> > +	/* Make sure no one is still using the moudule unless
> > +	 * its a connection in the hash.
> > +	 */
> > +	synchronize_rcu();
> > +
> > +	/* Get rid of expectations */
> > +	spin_lock_bh(&nf_conntrack_expect_lock);
> > +	for (i = 0; i < nf_ct_expect_hsize; i++) {
> > +		hlist_for_each_entry_safe(exp, next,
> > +					  &nf_ct_expect_hash[i], hnode) {
> > +			struct nf_conn_help *master_help = nfct_help(exp->master);
> > +
> > +			if ((master_help->helper && master_help->helper->me == me) ||
> > +			    (exp->helper && exp->helper->me == me) ||
> > +			    exp->expectfn_module == me) {

Are you also sure this is correct?

me can be nf_nat_sip, while exp->helper->me points to
nf_conntrack_sip.

  reply	other threads:[~2017-03-20 12:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-18  7:40 [PATCH v2 nf 1/1] netfilter: helper: Fix possible panic caused by invoking expectfn unloaded fgao
2017-03-20 10:44 ` Pablo Neira Ayuso
2017-03-20 12:50   ` Pablo Neira Ayuso [this message]
2017-03-20 13:06     ` Gao Feng
2017-03-20 13:11       ` Pablo Neira Ayuso
2017-03-20 13:17         ` Gao Feng
2017-03-20 13:22           ` Feng Gao
2017-03-20 12:57   ` Gao Feng
     [not found] <1489823439-32077-1-git-send-email-fgao@ikuai8.com>
2017-03-18  7:57 ` Feng Gao

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=20170320125040.GA12416@salvia \
    --to=pablo@netfilter.org \
    --cc=fgao@ikuai8.com \
    --cc=gfree.wind@gmail.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.