All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Alexander Beregalov <a.beregalov@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] net: af_packet should disable preempt around	sock_prot_inuse_add()
Date: Mon, 24 Nov 2008 14:08:27 +0100	[thread overview]
Message-ID: <492AA74B.2030108@cosmosbay.com> (raw)
In-Reply-To: <20081124130240.GB6255@orion>

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



      reply	other threads:[~2008-11-24 13:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=492AA74B.2030108@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=a.beregalov@gmail.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 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.