netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH] ipv6 addrconf: Fix memory leak when deleting addresses
Date: Thu, 5 Jun 2008 01:50:35 +0200	[thread overview]
Message-ID: <20080604235035.GJ20815@postel.suug.ch> (raw)

ip6_del_rt() may fail in which case the dst/route is not released.

Signed-off-by: Thomas graf <tgraf@suug.ch>

Index: net-2.6/net/ipv6/addrconf.c
===================================================================
--- net-2.6.orig/net/ipv6/addrconf.c	2008-06-04 22:59:11.000000000 +0200
+++ net-2.6/net/ipv6/addrconf.c	2008-06-04 23:07:05.000000000 +0200
@@ -779,8 +779,8 @@
 
 		if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
 			if (onlink == 0) {
-				ip6_del_rt(rt);
-				rt = NULL;
+				if (ip6_del_rt(rt) == 0)
+					goto out;
 			} else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
 				rt->rt6i_expires = expires;
 				rt->rt6i_flags |= RTF_EXPIRES;
@@ -788,7 +788,7 @@
 		}
 		dst_release(&rt->u.dst);
 	}
-
+out:
 	in6_ifa_put(ifp);
 }
 

             reply	other threads:[~2008-06-04 23:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 23:50 Thomas Graf [this message]
     [not found] <20080604234934.GI20815@postel.suug.ch>
2008-06-05  2:26 ` [PATCH] ipv6 addrconf: Fix memory leak when deleting addresses YOSHIFUJI Hideaki / 吉藤英明
2008-06-11 17:42   ` YOSHIFUJI Hideaki / 吉藤英明

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080604235035.GJ20815@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).