All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] bridge: netfilter: fix a memory leak
@ 2010-08-23  5:03 ` Changli Gao
  0 siblings, 0 replies; 6+ messages in thread
From: Changli Gao @ 2010-08-23  5:03 UTC (permalink / raw)
  To: David S. Miller; +Cc: Stephen Hemminger, bridge, netdev, Changli Gao

nf_bridge_alloc() always reset the skb->nf_bridge, so we should always
put the old one.

Signed-off-by: Changli Gao <xiaosuo@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;

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

* [Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
@ 2010-08-23  5:03 ` Changli Gao
  0 siblings, 0 replies; 6+ messages in thread
From: Changli Gao @ 2010-08-23  5:03 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, bridge, Changli Gao

nf_bridge_alloc() always reset the skb->nf_bridge, so we should always
put the old one.

Signed-off-by: Changli Gao <xiaosuo@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;

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

* Re: [Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
  2010-08-23  5:03 ` [Bridge] " Changli Gao
@ 2010-08-23 19:33   ` Bart De Schuymer
  -1 siblings, 0 replies; 6+ messages in thread
From: Bart De Schuymer @ 2010-08-23 19:33 UTC (permalink / raw)
  To: Changli Gao; +Cc: David S. Miller, netdev, bridge

Looks correct to me.

Signed-off-by: Bart De Schuymer <bdschuym@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@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@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/bridge
>
>   


-- 
Bart De Schuymer
www.artinalgorithms.be


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

* Re: [Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
@ 2010-08-23 19:33   ` Bart De Schuymer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart De Schuymer @ 2010-08-23 19:33 UTC (permalink / raw)
  To: Changli Gao; +Cc: netdev, bridge, David S. Miller

Looks correct to me.

Signed-off-by: Bart De Schuymer <bdschuym@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@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@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/bridge
>
>   


-- 
Bart De Schuymer
www.artinalgorithms.be


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

* Re: [Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
  2010-08-23 19:33   ` Bart De Schuymer
@ 2010-08-24  3:15     ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-08-24  3:15 UTC (permalink / raw)
  To: bdschuym; +Cc: xiaosuo, netdev, bridge

From: Bart De Schuymer <bdschuym@pandora.be>
Date: Mon, 23 Aug 2010 21:33:48 +0200

> Looks correct to me.
> 
> Signed-off-by: Bart De Schuymer <bdschuym@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@gmail.com>

Applied, thanks everyone.

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

* Re: [Bridge] [PATCH v2] bridge: netfilter: fix a memory leak
@ 2010-08-24  3:15     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-08-24  3:15 UTC (permalink / raw)
  To: bdschuym; +Cc: netdev, bridge, xiaosuo

From: Bart De Schuymer <bdschuym@pandora.be>
Date: Mon, 23 Aug 2010 21:33:48 +0200

> Looks correct to me.
> 
> Signed-off-by: Bart De Schuymer <bdschuym@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@gmail.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2010-08-24  3:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23  5:03 [PATCH v2] bridge: netfilter: fix a memory leak Changli Gao
2010-08-23  5:03 ` [Bridge] " Changli Gao
2010-08-23 19:33 ` Bart De Schuymer
2010-08-23 19:33   ` Bart De Schuymer
2010-08-24  3:15   ` David Miller
2010-08-24  3:15     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.