Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1331254

Re: [PATCH 1/1] af_packet: Raw socket destruction warning fix

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] af_packet: Raw socket destruction warning fix
Date 2016-02-10 16:10 +0100
Message-ID <r0Ez0-3Nr-19@gated-at.bofh.it> (permalink)
References <r0BKO-21z-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2016-02-10 at 17:35 +0530, Maninder Singh wrote:
> This Patch fixes below warning:-
> WARNING: at net/packet/af_packet.c:xxx packet_sock_destruct
> 
> There is following race between packet_rcv and packet_close
> which keeps unfree packet in receive queue.
> 
> CPU 1					CPU2
> packet_rcv
> 
> 					packet_close                       
> skb_set_owner_r(skb, sk);
> 
> 					skb_queue_purge(&sk->sk_receive_queue);
> 
> spin_lock(&sk->sk_receive_queue.lock);
> __skb_queue_tail(&sk->sk_receive_queue, skb);
> spin_unlock(&sk->sk_receive_queue.lock);

This absolutely can not happen.

CPU 1 holds rcu read lock, so cpu 2 can not possibly call
skb_queue_purge()

(cpu 1 is blocked in synchronize_net(), waiting that all cpus are no
longer in packet_rcv())

This patch does not address the root cause of your problem, and only
slightly changes probability for the bug to trigger.

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] af_packet: Raw socket destruction warning fix Maninder Singh <maninder1.s@samsung.com> - 2016-02-10 13:10 +0100
  Re: [PATCH 1/1] af_packet: Raw socket destruction warning fix Eric Dumazet <eric.dumazet@gmail.com> - 2016-02-10 16:10 +0100

csiph-web