All of lore.kernel.org
 help / color / mirror / Atom feed
* [IPV6] Fix dst leak in ipv6_add_addr
@ 2004-11-06  4:41 Herbert Xu
  2004-11-06  8:05 ` David S. Miller
  2004-11-10  5:35 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Herbert Xu @ 2004-11-06  4:41 UTC (permalink / raw)
  To: David S. Miller, YOSHIFUJI Hideaki, netdev

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

Hi:

Found another error-path dst leak.  If the idev->dead check is
triggered in ipv6_add_addr the rt entry will leak.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> 

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 612 bytes --]

===== net/ipv6/addrconf.c 1.115 vs edited =====
--- 1.115/net/ipv6/addrconf.c	2004-10-26 14:11:35 +10:00
+++ edited/net/ipv6/addrconf.c	2004-11-06 15:37:54 +11:00
@@ -484,7 +484,7 @@
 	      int scope, unsigned flags)
 {
 	struct inet6_ifaddr *ifa = NULL;
-	struct rt6_info *rt;
+	struct rt6_info *rt = NULL;
 	int hash;
 	static spinlock_t lock = SPIN_LOCK_UNLOCKED;
 	int err = 0;
@@ -572,6 +572,10 @@
 	if (unlikely(err == 0))
 		notifier_call_chain(&inet6addr_chain, NETDEV_UP, ifa);
 	else {
+		if (rt) {
+			dst_release(&rt->u.dst);
+			dst_free(&rt->u.dst);
+		}
 		kfree(ifa);
 		ifa = ERR_PTR(err);
 	}

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

* Re: [IPV6] Fix dst leak in ipv6_add_addr
  2004-11-06  4:41 [IPV6] Fix dst leak in ipv6_add_addr Herbert Xu
@ 2004-11-06  8:05 ` David S. Miller
  2004-11-06  8:20   ` Herbert Xu
  2004-11-10  5:35 ` David S. Miller
  1 sibling, 1 reply; 4+ messages in thread
From: David S. Miller @ 2004-11-06  8:05 UTC (permalink / raw)
  To: Herbert Xu; +Cc: yoshfuji, netdev

On Sat, 6 Nov 2004 15:41:21 +1100
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> Found another error-path dst leak.  If the idev->dead check is
> triggered in ipv6_add_addr the rt entry will leak.

This one was fixed in the xfrm_lookup() patch I sent yesterday :-)

I guess it's good that multiple people are verifying all of
these code paths.

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

* Re: [IPV6] Fix dst leak in ipv6_add_addr
  2004-11-06  8:05 ` David S. Miller
@ 2004-11-06  8:20   ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2004-11-06  8:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: yoshfuji, netdev

On Sat, Nov 06, 2004 at 12:05:18AM -0800, David S. Miller wrote:
> On Sat, 6 Nov 2004 15:41:21 +1100
> Herbert Xu <herbert@gondor.apana.org.au> wrote:
> 
> > Found another error-path dst leak.  If the idev->dead check is
> > triggered in ipv6_add_addr the rt entry will leak.
> 
> This one was fixed in the xfrm_lookup() patch I sent yesterday :-)

Indeed, I overlooked that message :)

However your version still leaks the rt since its refcnt is set to 1.
It will also dereference an unitialised rt if allocating ifa fails.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [IPV6] Fix dst leak in ipv6_add_addr
  2004-11-06  4:41 [IPV6] Fix dst leak in ipv6_add_addr Herbert Xu
  2004-11-06  8:05 ` David S. Miller
@ 2004-11-10  5:35 ` David S. Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-11-10  5:35 UTC (permalink / raw)
  To: Herbert Xu; +Cc: yoshfuji, netdev

On Sat, 6 Nov 2004 15:41:21 +1100
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> Found another error-path dst leak.  If the idev->dead check is
> triggered in ipv6_add_addr the rt entry will leak.

Good catch, patch applied.

Thanks Herbert.

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

end of thread, other threads:[~2004-11-10  5:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-06  4:41 [IPV6] Fix dst leak in ipv6_add_addr Herbert Xu
2004-11-06  8:05 ` David S. Miller
2004-11-06  8:20   ` Herbert Xu
2004-11-10  5:35 ` David S. 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.