All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Valdis.Kletnieks@vt.edu
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: mmotm 2010-04-05-16-09 uploaded
Date: Thu, 08 Apr 2010 13:41:00 +0200	[thread overview]
Message-ID: <4BBDC0CC.7080305@trash.net> (raw)
In-Reply-To: <13074.1270663309@localhost>

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

Valdis.Kletnieks@vt.edu wrote:
> On Mon, 05 Apr 2010 16:09:45 PDT, akpm@linux-foundation.org said:
>> The mm-of-the-moment snapshot 2010-04-05-16-09 has been uploaded to
>>
>>    http://userweb.kernel.org/~akpm/mmotm/
> 
> Seen in dmesg, 2.6.34-rc2-mmotm0323 didn't do this. Tossing it at all the
> likely suspects, hopefully somebody will recognize it and save me the
> bisecting. ;)
> 
> [   11.488535] ctnetlink v0.93: registering with nfnetlink.
> [   11.488579] 
> [   11.488579] ===================================================
> [   11.489529] [ INFO: suspicious rcu_dereference_check() usage. ]
> [   11.489988] ---------------------------------------------------
> [   11.490494] net/netfilter/nf_conntrack_ecache.c:88 invoked rcu_dereference_check() without protection!
> [   11.491024] 
> [   11.491024] other info that might help us debug this:
> [   11.491025] 
> [   11.492834] 
> [   11.492835] rcu_scheduler_active = 1, debug_locks = 0
> [   11.494124] 1 lock held by swapper/1:
> [   11.494776]  #0:  (nf_ct_ecache_mutex){+.+...}, at: [<ffffffff8148c606>] nf_conntrack_register_notifier+0x1a/0x76
> [   11.495505] 

There are some unnecessary rcu_dereference() calls in the conntrack
notifier registration and unregistration functions.

Does this fix it?


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

diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index d5a9bcd..849614a 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -81,11 +81,9 @@ EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
 int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new)
 {
 	int ret = 0;
-	struct nf_ct_event_notifier *notify;
 
 	mutex_lock(&nf_ct_ecache_mutex);
-	notify = rcu_dereference(nf_conntrack_event_cb);
-	if (notify != NULL) {
+	if (nf_conntrack_event_cb != NULL) {
 		ret = -EBUSY;
 		goto out_unlock;
 	}
@@ -101,11 +99,8 @@ EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier);
 
 void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new)
 {
-	struct nf_ct_event_notifier *notify;
-
 	mutex_lock(&nf_ct_ecache_mutex);
-	notify = rcu_dereference(nf_conntrack_event_cb);
-	BUG_ON(notify != new);
+	BUG_ON(nf_conntrack_event_cb != new);
 	rcu_assign_pointer(nf_conntrack_event_cb, NULL);
 	mutex_unlock(&nf_ct_ecache_mutex);
 }
@@ -114,11 +109,9 @@ EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
 int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new)
 {
 	int ret = 0;
-	struct nf_exp_event_notifier *notify;
 
 	mutex_lock(&nf_ct_ecache_mutex);
-	notify = rcu_dereference(nf_expect_event_cb);
-	if (notify != NULL) {
+	if (nf_expect_event_cb != NULL) {
 		ret = -EBUSY;
 		goto out_unlock;
 	}
@@ -134,11 +127,8 @@ EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier);
 
 void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new)
 {
-	struct nf_exp_event_notifier *notify;
-
 	mutex_lock(&nf_ct_ecache_mutex);
-	notify = rcu_dereference(nf_expect_event_cb);
-	BUG_ON(notify != new);
+	BUG_ON(nf_expect_event_cb != new);
 	rcu_assign_pointer(nf_expect_event_cb, NULL);
 	mutex_unlock(&nf_ct_ecache_mutex);
 }

  reply	other threads:[~2010-04-08 11:41 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 23:09 mmotm 2010-04-05-16-09 uploaded akpm
2010-04-06  5:04 ` [PATCH mmotm] hid-picolcd: depends on LCD_CLASS_DEVICE Randy Dunlap
2010-04-06  8:40   ` Jiri Kosina
2010-04-06  8:56     ` Bruno Prémont
2010-04-06 15:26       ` Randy Dunlap
2010-04-06 16:35         ` Bruno Prémont
2010-04-06 16:35           ` Bruno Prémont
2010-04-06 16:56           ` Randy Dunlap
2010-04-06 16:56             ` Randy Dunlap
2010-04-06 21:04             ` Bruno Prémont
2010-04-06 21:04               ` Bruno Prémont
2010-04-07 16:20               ` Randy Dunlap
2010-04-07 18:31                 ` Bruno Prémont
2010-04-07 18:31                   ` Bruno Prémont
2010-04-08 12:42                   ` Jiri Kosina
2010-04-08 12:42                     ` Jiri Kosina
2010-04-11 10:17                     ` Bruno Prémont
2010-04-11 10:17                       ` Bruno Prémont
2010-04-11 18:28                       ` Jiri Kosina
2010-04-11 18:28                         ` Jiri Kosina
2010-04-07 18:44             ` Bruno Prémont
2010-04-07 20:12               ` Randy Dunlap
2010-04-07 20:12                 ` Randy Dunlap
2010-04-07 20:29                 ` Bruno Prémont
2010-04-07 20:29                   ` Bruno Prémont
2010-04-07 18:01 ` mmotm 2010-04-05-16-09 uploaded Valdis.Kletnieks
2010-04-08 11:41   ` Patrick McHardy [this message]
2010-04-08 15:23     ` Valdis.Kletnieks
2010-04-08 15:36       ` Patrick McHardy
2010-04-09  0:50         ` Valdis.Kletnieks
2010-04-09 14:49           ` Patrick McHardy
2010-04-08 23:57 ` mmotm 2010-04-05 - another RCU whinge (not network this time) Valdis.Kletnieks
2010-04-09 23:16   ` Paul E. McKenney
2010-04-10  3:22     ` Valdis.Kletnieks
2010-04-10  5:15       ` Paul E. McKenney
2010-04-12 18:32         ` Oleg Nesterov

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=4BBDC0CC.7080305@trash.net \
    --to=kaber@trash.net \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=peterz@infradead.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.