Commit 2cbba482 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

[PATCH] sysfs: fix sysfs_dir_close memory leak

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: default avatarGreg Kroah-Hartman <greg@kroah.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ea2e10e5
...@@ -351,6 +351,8 @@ static int sysfs_dir_close(struct inode *inode, struct file *file) ...@@ -351,6 +351,8 @@ static int sysfs_dir_close(struct inode *inode, struct file *file)
list_del_init(&cursor->s_sibling); list_del_init(&cursor->s_sibling);
up(&dentry->d_inode->i_sem); up(&dentry->d_inode->i_sem);
release_sysfs_dirent(cursor);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment