LKML Archive mirror
 help / color / mirror / Atom feed
From: Maninder Singh <maninder1.s@samsung.com>
To: davem@davemloft.net, willemb@google.com, daniel@iogearbox.net,
	edumazet@google.com, eyal.birger@gmail.com, tklauser@distanz.ch,
	fruggeri@aristanetworks.com, dwmw2@infradead.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: pankaj.m@samsung.com, gh007.kim@samsung.com,
	hakbong5.lee@samsung.com,
	Maninder Singh <maninder1.s@samsung.com>,
	Vaneet Narang <v.narang@samsung.com>
Subject: [PATCH] af_packet: Raw socket destruction warning fix
Date: Mon, 18 Jan 2016 12:07:48 +0530	[thread overview]
Message-ID: <1453099068-39022-1-git-send-email-maninder1.s@samsung.com> (raw)

Receieve queue is not purged when socket dectruction is called
results in kernel warning because of non zero sk_rmem_alloc.

WARNING: at net/packet/af_packet.c:1142 packet_sock_destruct

Backtrace:
WARN_ON(atomic_read(&sk->sk_rmem_alloc)
packet_sock_destruct
__sk_free
sock_wfree
skb_release_head_state
skb_release_all
__kfree_skb
net_tx_action
__do_softirq
run_ksoftirqd

Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
---
 net/packet/af_packet.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 81b4b81..bcb37ba 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1310,6 +1310,7 @@ static bool packet_rcv_has_room(struct packet_sock *po, struct sk_buff *skb)
 
 static void packet_sock_destruct(struct sock *sk)
 {
+	skb_queue_purge(&sk->sk_receive_queue);
 	skb_queue_purge(&sk->sk_error_queue);
 
 	WARN_ON(atomic_read(&sk->sk_rmem_alloc));
-- 
1.7.9.5

             reply	other threads:[~2016-01-18  6:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  6:37 Maninder Singh [this message]
2016-01-18  9:44 ` [PATCH] af_packet: Raw socket destruction warning fix Daniel Borkmann
2016-01-18 10:29   ` Daniel Borkmann
2016-02-05 11:26   ` Eric Dumazet
  -- strict thread matches above, loose matches on Subject: below --
2016-01-18 10:11 Vaneet Narang
2016-01-18 11:08 ` Daniel Borkmann
2016-01-21 11:40 Maninder Singh
2016-01-26  0:13 ` Daniel Borkmann
2016-02-05  5:23 Vaneet Narang
2016-02-10 12:43 Vaneet Narang
2016-02-10 14:56 ` 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=1453099068-39022-1-git-send-email-maninder1.s@samsung.com \
    --to=maninder1.s@samsung.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=edumazet@google.com \
    --cc=eyal.birger@gmail.com \
    --cc=fruggeri@aristanetworks.com \
    --cc=gh007.kim@samsung.com \
    --cc=hakbong5.lee@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pankaj.m@samsung.com \
    --cc=tklauser@distanz.ch \
    --cc=v.narang@samsung.com \
    --cc=willemb@google.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).