netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Matteo Croce <technoboy85@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: nftables null pointer
Date: Tue, 5 Aug 2014 15:39:07 +0200	[thread overview]
Message-ID: <20140805133907.GA3782@salvia> (raw)
In-Reply-To: <CAFnufp3mVBFVfLOmb3QofpPDubCYgzmOUc4u4vGM6gXv+6Rezg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

On Tue, Aug 05, 2014 at 12:21:30PM +0200, Matteo Croce wrote:
> Yes it's reproducible with two config and two list:
> 
> # nft -f /dev/stdin <<EOF
> table ip nat {
>         chain post {
>                 type nat hook postrouting priority 0;
>                 ip saddr 192.168.0.0/24 oif eth0 snat 192.168.1.2
>         }
> }
> EOF
> 
> # nft -n list table nat
> 
> # nft -f /dev/stdin <<EOF
> table ip nat {
>         chain post {
>                 type nat hook postrouting priority 0;
>                 ip saddr 192.168.0.0/24 oif eth0 snat 192.168.1.2
>         }
> }
> EOF
> 
> # nft -n list table nat

Could you give a try to the following patch? Thanks.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 526 bytes --]

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index f95dc95..f7dce2b 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -899,6 +899,9 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
 static void nft_chain_stats_replace(struct nft_base_chain *chain,
 				    struct nft_stats __percpu *newstats)
 {
+	if (newstats == NULL)
+		return;
+
 	if (chain->stats) {
 		struct nft_stats __percpu *oldstats =
 				nft_dereference(chain->stats);

  reply	other threads:[~2014-08-05 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05  8:01 nftables null pointer Matteo Croce
2014-08-05 10:01 ` Pablo Neira Ayuso
2014-08-05 10:21   ` Matteo Croce
2014-08-05 13:39     ` Pablo Neira Ayuso [this message]
2014-08-05 15:07       ` Matteo Croce
2014-08-05 15:25         ` 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=20140805133907.GA3782@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=technoboy85@gmail.com \
    /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).