bridge: netfilter: fix a memory leak
Subsystems (4)
PATCH v2 1/1 bridge: netfilter: fix a memory leak
nf_bridge_alloc() always reset the skb->nf_bridge, so we should always put the old one.
---
v2: Should init tmp->use again because memcpy() overwrite it.
1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_netfilter.c +1 -1
@@ -162,8 +162,8 @@ static inline struct nf_bridge_info *nf_bridge_unshare(struct sk_buff *skb)if (tmp) {memcpy (tmp, nf_bridge,sizeof (struct nf_bridge_info ));atomic_set (&tmp->use,1 ); -nf_bridge_put (nf_bridge); } +nf_bridge_put (nf_bridge); nf_bridge = tmp; }return nf_bridge;
Looks correct to me.
Changli Gao schreef:
Quoted 27 lines
nf_bridge_alloc()always reset theskb->nf_bridge, so we should always put the old one.Signed-off-by Changli Gao <[email protected]>---
v2: Should inittmp->useagain becausememcpy()overwrite it.1 file changed, 1 insertion(+), 1 deletion(-)net/bridge/br_netfilter.c +1
-1@@ -162,8 +162,8 @@ static inline struct nf_bridge_info *nf_bridge_unshare(struct sk_buff *skb)if (tmp) {memcpy (tmp, nf_bridge,sizeof (struct nf_bridge_info ));atomic_set (&tmp->use,1 ); -nf_bridge_put (nf_bridge); } +nf_bridge_put (nf_bridge); nf_bridge = tmp; }return nf_bridge;_______________________________________________
Bridge mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/bridge
Signature · 2 lines
Bart De Schuymer www.artinalgorithms.be
From: Bart De Schuymer <[email protected]>
Date: Mon, 23 Aug 2010 21:33:48 +0200
Quoted 3 lines
Looks correct to me.
Signed-off-by Bart De Schuymer <[email protected]>
Bart, please do not top post.
Quoted 5 lines
Changli Gao schreef:
Quoted 4 lines
nf_bridge_alloc()always reset theskb->nf_bridge, so we should always put the old one.Signed-off-by Changli Gao <[email protected]>
Applied, thanks everyone.