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 17:36:07 +0200 [thread overview]
Message-ID: <4BBDF7E7.708@trash.net> (raw)
In-Reply-To: <6795.1270740197@localhost>
[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]
Valdis.Kletnieks@vt.edu wrote:
> On Thu, 08 Apr 2010 13:41:00 +0200, Patrick McHardy said:
>>> [ 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]
>> There are some unnecessary rcu_dereference() calls in the conntrack
>> notifier registration and unregistration functions.
>>
>> Does this fix it?
>
> Well, it *changed* it. Does the rcu_defererence_check() only fire on the
> first time it hits something, so we've fixed the first one and now we get to
> see the second one?
It appears that way, otherwise you should have seen a second warning in
nf_conntrack_ecache the last time.
> (For what it's worth, if this is going to be one-at-a-time whack-a-mole, I'm
> OK on that, just want to know up front.)
I went through the other files and I believe this should be it.
We already removed most of these incorrect rcu_dereference()
calls a while back.
> [ 9.299425] ip_tables: (C) 2000-2006 Netfilter Core Team
> [ 9.299486]
> [ 9.299486] ===================================================
> [ 9.300499] [ INFO: suspicious rcu_dereference_check() usage. ]
> [ 9.301001] ---------------------------------------------------
> [ 9.301523] net/netfilter/nf_log.c:55 invoked rcu_dereference_check() without protection!
> [ 9.302066]
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 3053 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);
}
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 015725a..908f599 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -35,7 +35,6 @@ static struct nf_logger *__find_logger(int pf, const char *str_logger)
/* return EEXIST if the same logger is registred, 0 on success. */
int nf_log_register(u_int8_t pf, struct nf_logger *logger)
{
- const struct nf_logger *llog;
int i;
if (pf >= ARRAY_SIZE(nf_loggers))
@@ -52,8 +51,7 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
} else {
/* register at end of list to honor first register win */
list_add_tail(&logger->list[pf], &nf_loggers_l[pf]);
- llog = rcu_dereference(nf_loggers[pf]);
- if (llog == NULL)
+ if (nf_loggers[pf] == NULL)
rcu_assign_pointer(nf_loggers[pf], logger);
}
@@ -65,13 +63,11 @@ EXPORT_SYMBOL(nf_log_register);
void nf_log_unregister(struct nf_logger *logger)
{
- const struct nf_logger *c_logger;
int i;
mutex_lock(&nf_log_mutex);
for (i = 0; i < ARRAY_SIZE(nf_loggers); i++) {
- c_logger = rcu_dereference(nf_loggers[i]);
- if (c_logger == logger)
+ if (nf_loggers[i] == logger)
rcu_assign_pointer(nf_loggers[i], NULL);
list_del(&logger->list[i]);
}
next prev parent reply other threads:[~2010-04-08 15:36 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
2010-04-08 15:23 ` Valdis.Kletnieks
2010-04-08 15:36 ` Patrick McHardy [this message]
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=4BBDF7E7.708@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.