public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org,
	Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: [PATCH net-next] netfilter: x_tables: xt_init() should run earlier
Date: Wed, 05 Sep 2012 18:37:53 +0200	[thread overview]
Message-ID: <1346863073.13121.155.camel@edumazet-glaptop> (raw)
In-Reply-To: <1346861569.13121.149.camel@edumazet-glaptop>

From: Eric Dumazet <edumazet@google.com>

Cong Wang reported a NULL dereference in xt_register_target()

It turns out xt_nat_init() was called before xt_init(), so xt array
was not yet setup.

xt_init() should be marked core_initcall() to solve this problem.

Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/netfilter/x_tables.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 8d987c3..afcea11 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1390,6 +1390,6 @@ static void __exit xt_fini(void)
 	kfree(xt);
 }
 
-module_init(xt_init);
+core_initcall(xt_init);
 module_exit(xt_fini);
 



  reply	other threads:[~2012-09-05 16:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 15:43 NULL pointer dereference in xt_register_target() Cong Wang
2012-09-05 15:55 ` Eric Dumazet
2012-09-05 16:12   ` Eric Dumazet
2012-09-05 16:37     ` Eric Dumazet [this message]
2012-09-05 16:53       ` [PATCH net-next] netfilter: x_tables: xt_init() should run earlier Pablo Neira Ayuso
2012-09-05 16:59         ` Eric Dumazet
2012-09-08 17:50       ` Patrick McHardy
2012-09-08 19:50         ` Eric Dumazet
2012-09-05 16:48   ` NULL pointer dereference in xt_register_target() Pablo Neira Ayuso
2012-09-06 14:27     ` Cong Wang
2012-09-06 14:44       ` 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=1346863073.13121.155.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=xiyou.wangcong@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