netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: af_packet should disable preempt around sock_prot_inuse_add()
@ 2008-11-24 13:02 Alexander Beregalov
  2008-11-24 13:08 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Beregalov @ 2008-11-24 13:02 UTC (permalink / raw)
  To: netdev, dada1, davem


BUG: using smp_processor_id() in preemptible [00000000] code: dhc

caller is sock_prot_inuse_add+0x24/0x42
Pid: 1776, comm: dhcpcd Tainted: G        W  2.6.28-rc6-next-2008

Call Trace:
 [<ffffffff8037fb72>] debug_smp_processor_id+0xca/0xe0
 [<ffffffff8046afc9>] sock_prot_inuse_add+0x24/0x42
 [<ffffffff804bd0a7>] packet_release+0x178/0x198
 [<ffffffff804695c6>] sock_release+0x20/0xc0
 [<ffffffff80469688>] sock_close+0x22/0x26
 [<ffffffff8029fa30>] __fput+0xeb/0x18a
 [<ffffffff8029fae4>] fput+0x15/0x17
 [<ffffffff8029cfac>] filp_close+0x67/0x72
 [<ffffffff8029d05c>] sys_close+0xa5/0xe4
 [<ffffffff8020b75b>] system_call_fastpath+0x16/0x1b

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---

 net/packet/af_packet.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b4870a3..8b7ddf7 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -910,7 +910,9 @@ static int packet_release(struct socket *sock)
 	skb_queue_purge(&sk->sk_receive_queue);
 	sk_refcnt_debug_release(sk);
 
+	preempt_disable();
 	sock_prot_inuse_add(net, sk->sk_prot, -1);
+	preempt_enable();
 	sock_put(sk);
 	return 0;
 }
@@ -1085,8 +1087,8 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
 
 	write_lock_bh(&net->packet.sklist_lock);
 	sk_add_node(sk, &net->packet.sklist);
-	write_unlock_bh(&net->packet.sklist_lock);
 	sock_prot_inuse_add(net, &packet_proto, 1);
+	write_unlock_bh(&net->packet.sklist_lock);
 	return(0);
 out:
 	return err;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: af_packet should disable preempt around sock_prot_inuse_add()
  2008-11-24 13:02 [PATCH] net: af_packet should disable preempt around sock_prot_inuse_add() Alexander Beregalov
@ 2008-11-24 13:08 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2008-11-24 13:08 UTC (permalink / raw)
  To: Alexander Beregalov; +Cc: netdev, davem

Alexander Beregalov a écrit :
> BUG: using smp_processor_id() in preemptible [00000000] code: dhc
> 
> caller is sock_prot_inuse_add+0x24/0x42
> Pid: 1776, comm: dhcpcd Tainted: G        W  2.6.28-rc6-next-2008
> 
> Call Trace:
>  [<ffffffff8037fb72>] debug_smp_processor_id+0xca/0xe0
>  [<ffffffff8046afc9>] sock_prot_inuse_add+0x24/0x42
>  [<ffffffff804bd0a7>] packet_release+0x178/0x198
>  [<ffffffff804695c6>] sock_release+0x20/0xc0
>  [<ffffffff80469688>] sock_close+0x22/0x26
>  [<ffffffff8029fa30>] __fput+0xeb/0x18a
>  [<ffffffff8029fae4>] fput+0x15/0x17
>  [<ffffffff8029cfac>] filp_close+0x67/0x72
>  [<ffffffff8029d05c>] sys_close+0xa5/0xe4
>  [<ffffffff8020b75b>] system_call_fastpath+0x16/0x1b
> 
> Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
> ---
> 
>  net/packet/af_packet.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index b4870a3..8b7ddf7 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -910,7 +910,9 @@ static int packet_release(struct socket *sock)
>  	skb_queue_purge(&sk->sk_receive_queue);
>  	sk_refcnt_debug_release(sk);
>  
> +	preempt_disable();
>  	sock_prot_inuse_add(net, sk->sk_prot, -1);
> +	preempt_enable();
>  	sock_put(sk);
>  	return 0;
>  }
> @@ -1085,8 +1087,8 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
>  
>  	write_lock_bh(&net->packet.sklist_lock);
>  	sk_add_node(sk, &net->packet.sklist);
> -	write_unlock_bh(&net->packet.sklist_lock);
>  	sock_prot_inuse_add(net, &packet_proto, 1);
> +	write_unlock_bh(&net->packet.sklist_lock);
>  	return(0);
>  out:
>  	return err;
> --

Thanks Alexander, but same answer than previous mail.

Problem already fixed in net-next-2.6



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-24 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 13:02 [PATCH] net: af_packet should disable preempt around sock_prot_inuse_add() Alexander Beregalov
2008-11-24 13:08 ` Eric Dumazet

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).