From: Phil Oester <kernel@linuxace.com>
To: netdev@oss.sgi.com, netfilter-devel@lists.netfilter.org
Subject: [PATCH] Conntrack leak with raw sockets
Date: Fri, 25 Mar 2005 12:11:27 -0800 [thread overview]
Message-ID: <20050325201127.GA3400@linuxace.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 901 bytes --]
In the event a raw socket is created for sending purposes only, the creator
never bothers to check the socket's receive queue. But we continue to
add skbs to its queue until it fills up.
Unfortunately, if ip_conntrack is loaded on the box, each skb we add to the
queue potentially holds a reference to a conntrack. If the user attempts
to unload ip_conntrack, we will spin around forever since the queued skbs
are pinned.
This behaviour can be witnessed in Fedora distributions which use
NetworkManager. Arguably there should be an option to create a 'sending-only'
socket which won't suffer from this problem, but in the interim I think
the cleanest solution is to drop the conntrack reference before adding the skb
to the socket's queue. The below patch does just that.
This fixes Netfilter bugzilla #91 and Redhat bugzilla #112630.
Phil
Signed-off-by: Phil Oester <kernel@linuxace.com>
[-- Attachment #2: patch-ref --]
[-- Type: text/plain, Size: 727 bytes --]
diff -ru linux-orig/net/packet/af_packet.c linux-new/net/packet/af_packet.c
--- linux-orig/net/packet/af_packet.c 2005-03-25 14:48:13.597903552 -0500
+++ linux-new/net/packet/af_packet.c 2005-03-25 14:51:05.480773384 -0500
@@ -274,6 +274,10 @@
dst_release(skb->dst);
skb->dst = NULL;
+ /* drop conntrack reference */
+ nf_conntrack_put(skb->nfct);
+ skb->nfct = NULL;
+
spkt = (struct sockaddr_pkt*)skb->cb;
skb_push(skb, skb->data-skb->mac.raw);
@@ -517,6 +521,10 @@
dst_release(skb->dst);
skb->dst = NULL;
+ /* drop conntrack reference */
+ nf_conntrack_put(skb->nfct);
+ skb->nfct = NULL;
+
spin_lock(&sk->sk_receive_queue.lock);
po->stats.tp_packets++;
__skb_queue_tail(&sk->sk_receive_queue, skb);
next reply other threads:[~2005-03-25 20:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-25 20:11 Phil Oester [this message]
2005-03-25 20:37 ` [PATCH] Conntrack leak with raw sockets Patrick McHardy
2005-03-26 0:09 ` Herbert Xu
2005-03-26 6:05 ` Phil Oester
2005-03-28 20:16 ` Patrick McHardy
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=20050325201127.GA3400@linuxace.com \
--to=kernel@linuxace.com \
--cc=netdev@oss.sgi.com \
--cc=netfilter-devel@lists.netfilter.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).