From: Alexander Beregalov <a.beregalov@gmail.com>
To: netdev@vger.kernel.org, dada1@cosmosbay.com, davem@davemloft.net
Subject: [PATCH] net: af_unix should disable preempt around sock_prot_inuse_add()
Date: Mon, 24 Nov 2008 15:54:57 +0300 [thread overview]
Message-ID: <20081124125457.GA6255@orion> (raw)
BUG: using smp_processor_id() in preemptible [00000000] code: ini
caller is sock_prot_inuse_add+0x24/0x42
Pid: 738, comm: init-early.sh Tainted: G W 2.6.28-rc6-nex
Call Trace:
[<ffffffff8037fb72>] debug_smp_processor_id+0xca/0xe0
[<ffffffff8046afc9>] sock_prot_inuse_add+0x24/0x42
[<ffffffff804baf2c>] unix_create1+0x161/0x176
[<ffffffff804bb03d>] unix_stream_connect+0x94/0x3b0
[<ffffffff80468a84>] sys_connect+0x68/0x8e
[<ffffffff8020b75b>] system_call_fastpath+0x16/0x1b
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---
net/unix/af_unix.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a9b3c90..f7a1d46 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -361,7 +361,9 @@ static void unix_sock_destructor(struct sock *sk)
unix_release_addr(u->addr);
atomic_dec(&unix_nr_socks);
+ preempt_disable();
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
+ preempt_enable();
#ifdef UNIX_REFCNT_DEBUG
printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk,
atomic_read(&unix_nr_socks));
@@ -612,9 +614,11 @@ static struct sock *unix_create1(struct net *net, struct socket *sock)
out:
if (sk == NULL)
atomic_dec(&unix_nr_socks);
- else
+ else {
+ preempt_disable();
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
-
+ preempt_enable();
+ }
return sk;
}
next reply other threads:[~2008-11-24 12:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 12:54 Alexander Beregalov [this message]
2008-11-24 13:06 ` [PATCH] net: af_unix should disable preempt around sock_prot_inuse_add() Eric Dumazet
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=20081124125457.GA6255@orion \
--to=a.beregalov@gmail.com \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=netdev@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 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).