mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: [Patch] fix ext2/ext3 memory leak
Date: Thu, 9 Dec 2004 17:48:33 +0100	[thread overview]
Message-ID: <20041209164833.GA5547@osiris.boeblingen.de.ibm.com> (raw)

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

Hi,

the patch below fixes an ext2/ext3 memory leak: the *_fill_super
functions allocate percpu data structures but don't free them in
*_put_super.

Thanks,
Heiko

[-- Attachment #2: 00_ext3.diff --]
[-- Type: text/plain, Size: 1260 bytes --]

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

diffstat:
 fs/ext2/super.c |    3 +++
 fs/ext3/super.c |    3 +++
 2 files changed, 6 insertions(+)

diff -urN linux-2.6/fs/ext2/super.c linux-2.6-patched/fs/ext2/super.c
--- linux-2.6/fs/ext2/super.c	2004-12-09 17:41:49.000000000 +0100
+++ linux-2.6-patched/fs/ext2/super.c	2004-12-09 17:42:01.000000000 +0100
@@ -122,6 +122,9 @@
 			brelse (sbi->s_group_desc[i]);
 	kfree(sbi->s_group_desc);
 	kfree(sbi->s_debts);
+	percpu_counter_destroy(&sbi->s_freeblocks_counter);
+	percpu_counter_destroy(&sbi->s_freeinodes_counter);
+	percpu_counter_destroy(&sbi->s_dirs_counter);
 	brelse (sbi->s_sbh);
 	sb->s_fs_info = NULL;
 	kfree(sbi);
diff -urN linux-2.6/fs/ext3/super.c linux-2.6-patched/fs/ext3/super.c
--- linux-2.6/fs/ext3/super.c	2004-12-09 17:41:49.000000000 +0100
+++ linux-2.6-patched/fs/ext3/super.c	2004-12-09 17:42:01.000000000 +0100
@@ -400,6 +400,9 @@
 	for (i = 0; i < sbi->s_gdb_count; i++)
 		brelse(sbi->s_group_desc[i]);
 	kfree(sbi->s_group_desc);
+	percpu_counter_destroy(&sbi->s_freeblocks_counter);
+	percpu_counter_destroy(&sbi->s_freeinodes_counter);
+	percpu_counter_destroy(&sbi->s_dirs_counter);
 	brelse(sbi->s_sbh);
 #ifdef CONFIG_QUOTA
 	for (i = 0; i < MAXQUOTAS; i++) {

                 reply	other threads:[~2004-12-09 16:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041209164833.GA5547@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@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®