linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Hill <steve@navaho.co.uk>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	<ebtables-devel@lists.sourceforge.net>,
	<netfilter-devel@lists.netfilter.org>
Subject: memory leak related to bridging, conntrack and frags in 2.6.0
Date: Fri, 12 Dec 2003 19:55:55 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0312121948321.8670-200000@sorbus2.navaho> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1040 bytes --]


Sorry for the cross-post - I thought this would be of interest to all the 
lists and also wasn't sure where the best people to help hang out.

With both conntrack and bridging turned on in the 2.6.0test11 kernel, 
sending fragmented packets over the bridge reveals a memory leak 
(specifically, forwarding packets from any interface to a bridge).  The 
memory that is leaking seems to be being allocated on line 299 on 
net/bridge/br_netfilter.c:

        if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
                return NF_DROP;
  
Only the first fragment gets freed later on.

The patch attached fixes the problem by freeing nf_bridge when the 
packets are defragmented, however I am sure this is not the right place 
to do this.  Where would the skb's for the fragments usually get freed?

-- 

- Steve Hill
Senior Software Developer                        Email: steve@navaho.co.uk
Navaho Technologies Ltd.                           Tel: +44-870-7034015

        ... Alcohol and calculus don't mix - Don't drink and derive! ...


[-- Attachment #2: Type: TEXT/PLAIN, Size: 640 bytes --]

diff -urN linux-2.6.0-test11.vanilla/net/ipv4/ip_fragment.c linux-2.6.0-test11.bridge/net/ipv4/ip_fragment.c
--- linux-2.6.0-test11.vanilla/net/ipv4/ip_fragment.c	2003-12-12 19:27:07.000000000 +0000
+++ linux-2.6.0-test11.bridge/net/ipv4/ip_fragment.c	2003-12-12 19:42:50.000000000 +0000
@@ -592,6 +592,12 @@
 	atomic_sub(head->truesize, &ip_frag_mem);
 
 	for (fp=head->next; fp; fp = fp->next) {
+#ifdef CONFIG_BRIDGE_NETFILTER
+		if (fp->nf_bridge) {
+			nf_bridge_put(fp->nf_bridge);
+			fp->nf_bridge = NULL;
+		};
+#endif
 		head->data_len += fp->len;
 		head->len += fp->len;
 		if (head->ip_summed != fp->ip_summed)

             reply	other threads:[~2003-12-12 19:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-12 19:55 Steve Hill [this message]
2003-12-13 23:35 ` memory leak related to bridging, conntrack and frags in 2.6.0 Bart De Schuymer

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=Pine.LNX.4.44.0312121948321.8670-200000@sorbus2.navaho \
    --to=steve@navaho.co.uk \
    --cc=ebtables-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --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).