From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devel@openvz.org, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 1/6] [IPV4]: Fix memory leak on error path during FIB initialization.
Date: Thu, 31 Jan 2008 15:00:45 +0300 [thread overview]
Message-ID: <1201780850-22216-1-git-send-email-den@openvz.org> (raw)
In-Reply-To: <47A1B835.7050600@sw.ru>
net->ipv4.fib_table_hash is not freed when fib4_rules_init failed. The problem
has been introduced by the following commit.
commit c8050bf6d84785a7edd2e81591e8f833231477e8
Author: Denis V. Lunev <den@openvz.org>
Date: Thu Jan 10 03:28:24 2008 -0800
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv4/fib_frontend.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d282618..d0507f4 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -975,6 +975,7 @@ static struct notifier_block fib_netdev_notifier = {
static int __net_init ip_fib_net_init(struct net *net)
{
+ int err;
unsigned int i;
net->ipv4.fib_table_hash = kzalloc(
@@ -985,7 +986,14 @@ static int __net_init ip_fib_net_init(struct net *net)
for (i = 0; i < FIB_TABLE_HASHSZ; i++)
INIT_HLIST_HEAD(&net->ipv4.fib_table_hash[i]);
- return fib4_rules_init(net);
+ err = fib4_rules_init(net);
+ if (err < 0)
+ goto fail;
+ return 0;
+
+fail:
+ kfree(net->ipv4.fib_table_hash);
+ return err;
}
static void __net_exit ip_fib_net_exit(struct net *net)
--
1.5.3.rc5
next parent reply other threads:[~2008-01-31 12:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <47A1B835.7050600@sw.ru>
2008-01-31 12:00 ` Denis V. Lunev [this message]
2008-01-31 13:14 ` David Miller
2008-01-31 12:00 ` [PATCH 2/6] [IPV4]: Small style cleanup of the error path in rtm_to_ifaddr Denis V. Lunev
2008-01-31 12:00 ` [PATCH 3/6] [NETNS]: Process interface address manipulation routines in the namespace Denis V. Lunev
2008-01-31 12:00 ` [PATCH 4/6] [IPV4]: fib_sync_down rework Denis V. Lunev
2008-01-31 12:00 ` [PATCH 5/6] [NETNS]: Add a namespace mark to fib_info Denis V. Lunev
2008-01-31 12:00 ` [PATCH 6/6] [NETNS]: Lookup in FIB semantic hashes taking into account the namespace Denis V. Lunev
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=1201780850-22216-1-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®