mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* memory leak related to bridging, conntrack and frags in 2.6.0
@ 2003-12-12 19:55 Steve Hill
  2003-12-13 23:35 ` Bart De Schuymer
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Hill @ 2003-12-12 19:55 UTC (permalink / raw)
  To: Linux Kernel Mailing List, ebtables-devel, netfilter-devel

[-- 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-13 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-12 19:55 memory leak related to bridging, conntrack and frags in 2.6.0 Steve Hill
2003-12-13 23:35 ` Bart De Schuymer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®