Changli Gao
2010-Aug-23 05:03 UTC
[Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
nf_bridge_alloc() always reset the skb->nf_bridge, so we should always put the old one. Signed-off-by: Changli Gao <xiaosuo at gmail.com> --- v2: Should init tmp->use again because memcpy() overwrite it. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 2c911c0..5ed00bd 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c @@ -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;
Bart De Schuymer
2010-Aug-23 19:33 UTC
[Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
Looks correct to me. Signed-off-by: Bart De Schuymer <bdschuym at pandora.be> Changli Gao schreef:> nf_bridge_alloc() always reset the skb->nf_bridge, so we should always > put the old one. > > Signed-off-by: Changli Gao <xiaosuo at gmail.com> > --- > v2: Should init tmp->use again because memcpy() overwrite it. > 1 file changed, 1 insertion(+), 1 deletion(-) > diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c > index 2c911c0..5ed00bd 100644 > --- a/net/bridge/br_netfilter.c > +++ b/net/bridge/br_netfilter.c > @@ -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 > Bridge at lists.linux-foundation.org > https://lists.linux-foundation.org/mailman/listinfo/bridge > >-- Bart De Schuymer www.artinalgorithms.be
David Miller
2010-Aug-24 03:15 UTC
[Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
From: Bart De Schuymer <bdschuym at pandora.be> Date: Mon, 23 Aug 2010 21:33:48 +0200> Looks correct to me. > > Signed-off-by: Bart De Schuymer <bdschuym at pandora.be>Bart, please do not top post.> Changli Gao schreef: >> nf_bridge_alloc() always reset the skb->nf_bridge, so we should always >> put the old one. >> >> Signed-off-by: Changli Gao <xiaosuo at gmail.com>Applied, thanks everyone.