public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: torvalds@osdl.org, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] sysfs: fix sysfs_dir_close memory leak
Date: Fri, 3 Dec 2004 12:00:36 -0800	[thread overview]
Message-ID: <20041203200036.GC1178@kroah.com> (raw)
In-Reply-To: <20041203200003.GB1178@kroah.com>


sysfs_dir_close did not free the "cursor" sysfs_dirent used for keeping
track of position in the list of sysfs_dirent nodes.  Consequently,
doing a "find /sys" would leak a sysfs_dirent for each of the 1140
directories in my /sys tree, or about 36kB each time.


From: "Adam J. Richter" <adam@yggdrasil.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


--- 1.34/fs/sysfs/dir.c	2004-11-22 10:42:02 -08:00
+++ edited/fs/sysfs/dir.c	2004-12-03 10:42:51 -08:00
@@ -351,6 +351,8 @@ static int sysfs_dir_close(struct inode 
 	list_del_init(&cursor->s_sibling);
 	up(&dentry->d_inode->i_sem);
 
+	release_sysfs_dirent(cursor);
+
 	return 0;
 }
 

  reply	other threads:[~2004-12-03 20:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-03 19:59 [PATCH 0/3] A few misc patches for 2.6.10-rc2 Greg KH
2004-12-03 20:00 ` [PATCH 1/3] Driver Core: restore comment in kobject_uevent.c Greg KH
2004-12-03 20:00   ` Greg KH [this message]
2004-12-03 20:01     ` [PATCH 3/3] Add documentation about why the in-kernel api is the way it is Greg KH

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=20041203200036.GC1178@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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