From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org
Subject: Re: [PATCH 3/6] netfilter: ctnetlink: use GFP_ATOMIC in all allocations
Date: Tue, 6 Mar 2012 15:48:38 +0100 [thread overview]
Message-ID: <20120306144838.GA1527@1984> (raw)
In-Reply-To: <1331038221.9504.9.camel@edumazet-glaptop>
On Tue, Mar 06, 2012 at 04:50:21AM -0800, Eric Dumazet wrote:
> On Tue, 2012-03-06 at 12:22 +0100, pablo@netfilter.org wrote:
> > From: Pablo Neira Ayuso <pablo@netfilter.org>
> >
> > All ctnetlink operations are invoked inside rcu_read_lock
> > (see net/netfilter/nfnetlink.c).
> >
> > Allocations have to be atomic, as RCU requires.
> >
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > ---
> > net/netfilter/nf_conntrack_netlink.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
> > index 1068769..867843f 100644
> > --- a/net/netfilter/nf_conntrack_netlink.c
> > +++ b/net/netfilter/nf_conntrack_netlink.c
> > @@ -1002,7 +1002,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
> > ct = nf_ct_tuplehash_to_ctrack(h);
> >
> > err = -ENOMEM;
> > - skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> > + skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
> > if (skb2 == NULL) {
> > nf_ct_put(ct);
> > return -ENOMEM;
> > @@ -1865,7 +1865,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
> > }
> >
> > err = -ENOMEM;
> > - skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> > + skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
> > if (skb2 == NULL) {
> > nf_ct_expect_put(exp);
> > goto out;
>
> This cant be right.
>
> Really this must be kept as GFP_KERNEL allocations.
>
> Only if .call_rcu member is used in place of .call rcu_read_lock() is
> held instead of nfnl_lock().
I thought we couldn't sleep while holding rcu_read_lock.
> You should take a look at all GFP_ATOMIC uses in
> net/netfilter/nf_conntrack_netlink.c and check if they can be GFP_KERNEL
> instead.
David, can you take all patches except this one?
I'll have to rebase my tree after this, sorry.
next prev parent reply other threads:[~2012-03-06 14:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 11:22 [PATCH 0/6] netfilter fixes for 3.3-rc6 pablo
2012-03-06 11:22 ` [PATCH 1/6] netfilter: ebtables: fix wrong name length while copying to user-space pablo
2012-03-06 20:15 ` David Miller
2012-03-06 11:22 ` [PATCH 2/6] netfilter: ctnetlink: remove incorrect spin_[un]lock_bh on NAT module autoload pablo
2012-03-06 20:15 ` David Miller
2012-03-06 11:22 ` [PATCH 3/6] netfilter: ctnetlink: use GFP_ATOMIC in all allocations pablo
2012-03-06 12:50 ` Eric Dumazet
2012-03-06 14:48 ` Pablo Neira Ayuso [this message]
2012-03-06 15:09 ` Eric Dumazet
2012-03-06 15:35 ` Pablo Neira Ayuso
2012-03-06 20:20 ` David Miller
2012-03-06 11:22 ` [PATCH 4/6] netfilter: bridge: fix wrong pointer dereference pablo
2012-03-06 20:15 ` David Miller
2012-03-06 11:22 ` [PATCH 5/6] bridge: netfilter: don't call iptables on vlan packets if sysctl is off pablo
2012-03-06 20:15 ` David Miller
2012-03-06 11:22 ` [PATCH 6/6] netfilter: nf_conntrack: fix early_drop with reliable event delivery pablo
2012-03-06 20:16 ` David Miller
2012-03-07 13:19 ` Pablo Neira Ayuso
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=20120306144838.GA1527@1984 \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--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.