All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Patrick McHardy <kaber@trash.net>,
	netfilter-devel@vger.kernel.org
Subject: netfilter 01/07: nf_log: fix sleeping function called from invalid context
Date: Sat, 13 Jun 2009 15:09:36 +0200 (MEST)	[thread overview]
Message-ID: <20090613130935.2112.24077.sendpatchset@x2.localnet> (raw)
In-Reply-To: <20090613130934.2112.65299.sendpatchset@x2.localnet>

commit 266d07cb1c9a0c345d7d3aea889f92062894059e
Author: Patrick McHardy <kaber@trash.net>
Date:   Sat Jun 13 12:21:10 2009 +0200

    netfilter: nf_log: fix sleeping function called from invalid context
    
    Fix regression introduced by 17625274 "netfilter: sysctl support of
    logger choice":
    
    BUG: sleeping function called from invalid context at /mnt/s390test/linux-2.6-tip/arch/s390/include/asm/uaccess.h:234
    in_atomic(): 1, irqs_disabled(): 0, pid: 3245, name: sysctl
    CPU: 1 Not tainted 2.6.30-rc8-tipjun10-02053-g39ae214 #1
    Process sysctl (pid: 3245, task: 000000007f675da0, ksp: 000000007eb17cf0)
    0000000000000000 000000007eb17be8 0000000000000002 0000000000000000
           000000007eb17c88 000000007eb17c00 000000007eb17c00 0000000000048156
           00000000003e2de8 000000007f676118 000000007eb17f10 0000000000000000
           0000000000000000 000000007eb17be8 000000000000000d 000000007eb17c58
           00000000003e2050 000000000001635c 000000007eb17be8 000000007eb17c30
    Call Trace:
    (Ý<00000000000162e6>¨ show_trace+0x13a/0x148)
     Ý<00000000000349ea>¨ __might_sleep+0x13a/0x164
     Ý<0000000000050300>¨ proc_dostring+0x134/0x22c
     Ý<0000000000312b70>¨ nf_log_proc_dostring+0xfc/0x188
     Ý<0000000000136f5e>¨ proc_sys_call_handler+0xf6/0x118
     Ý<0000000000136fda>¨ proc_sys_read+0x26/0x34
     Ý<00000000000d6e9c>¨ vfs_read+0xac/0x158
     Ý<00000000000d703e>¨ SyS_read+0x56/0x88
     Ý<0000000000027f42>¨ sysc_noemu+0x10/0x16
    
    Use the nf_log_mutex instead of RCU to fix this.
    
    Reported-and-tested-by: Maran Pakkirisamy <maranpsamy@in.ibm.com>
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index beb3731..2fefe14 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -248,14 +248,14 @@ static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
 		rcu_assign_pointer(nf_loggers[tindex], logger);
 		mutex_unlock(&nf_log_mutex);
 	} else {
-		rcu_read_lock();
-		logger = rcu_dereference(nf_loggers[tindex]);
+		mutex_lock(&nf_log_mutex);
+		logger = nf_loggers[tindex];
 		if (!logger)
 			table->data = "NONE";
 		else
 			table->data = logger->name;
 		r = proc_dostring(table, write, filp, buffer, lenp, ppos);
-		rcu_read_unlock();
+		mutex_unlock(&nf_log_mutex);
 	}
 
 	return r;

  reply	other threads:[~2009-06-13 13:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 13:09 netfilter 00/07: netfilter update Patrick McHardy
2009-06-13 13:09 ` Patrick McHardy [this message]
2009-06-13 13:09 ` netfilter 02/07: nf_conntrack: use mod_timer_pending() for conntrack refresh Patrick McHardy
2009-06-13 13:09 ` netfilter 03/07: conntrack: move event caching to conntrack extension infrastructure Patrick McHardy
2009-06-13 13:09 ` netfilter 04/07: conntrack: move helper destruction to nf_ct_helper_destroy() Patrick McHardy
2009-06-13 13:09 ` list_nulls 05/07: add hlist_nulls_add_head and hlist_nulls_del Patrick McHardy
2009-06-13 13:09 ` netfilter 06/07: conntrack: optional reliable conntrack event delivery Patrick McHardy
2009-06-13 13:09 ` x_tables 07/07: Convert printk to pr_err Patrick McHardy
2009-06-13 23:53 ` netfilter 00/07: netfilter update David Miller

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=20090613130935.2112.24077.sendpatchset@x2.localnet \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --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.