The patch I posted previously applies to 2.4.  The following patch
applies to 2.6.

Signed-off-by: David Kimdon <[EMAIL PROTECTED]>

* net/bridge/br_netfilter.c (br_nf_pre_routing, br_nf_pre_routing_ipv6) :
  Call nf_bridge_put() before allocating a new nf_bridge structure and
  potentially overwriting the pointer to a previously allocated one.
  This fixes a memory leak which can occur when the bridge topology
  allows for an skb to traverse more than one bridge.

diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -372,6 +372,7 @@ static unsigned int br_nf_pre_routing_ip
        if (hdr->nexthdr == NEXTHDR_HOP && check_hbh_len(skb))
                        goto inhdr_error;
 
+       nf_bridge_put(skb->nf_bridge);
        if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
                return NF_DROP;
        setup_pre_routing(skb);
@@ -455,6 +456,7 @@ static unsigned int br_nf_pre_routing(un
                        skb->ip_summed = CHECKSUM_NONE;
        }
 
+       nf_bridge_put(skb->nf_bridge);
        if ((nf_bridge = nf_bridge_alloc(skb)) == NULL)
                return NF_DROP;
        setup_pre_routing(skb);

-- 
David Kimdon                        (650) 829 2621
Devicescape Software
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to