From adam@yggdrasil.com Thu Dec 2 19:49:26 2004 >From greg Thu Dec 2 19:49:26 2004 Return-Path: Received: from localhost.localdomain [127.0.0.1] by localhost with POP3 (fetchmail-6.2.5) for greg@localhost (single-drop); Thu, 02 Dec 2004 19:49:26 -0800 (PST) Received: from kroah.com ([216.218.225.136]) by kroah.com for ; Thu, 2 Dec 2004 19:00:05 -0800 Received: from adam.yggdrasil.com ([61.48.52.229]) by kroah.com for ; Thu, 2 Dec 2004 19:00:02 -0800 Received: (from adam@localhost) by adam.yggdrasil.com (8.11.7/8.11.7) id iB32oZQ02969; Thu, 2 Dec 2004 18:50:35 -0800 Date: Thu, 2 Dec 2004 18:50:35 -0800 From: "Adam J. Richter" Message-Id: <200412030250.iB32oZQ02969@adam.yggdrasil.com> To: maneesh@in.ibm.com Subject: SYSFS: fix sysfs_dir_close memory leak Cc: akpm@osdl.org, chrisw@osdl.org, greg@kroah.com, linux-kernel@vger.kernel.org, viro@parcelfarce.linux.theplanet.co.uk X-SpamProbe: GOOD 0.0000016 eeb2176b8c0334a3b5814884f9ae3ba2 Status: RO Content-Length: 1383 Lines: 43 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" Signed-off-by: Greg Kroah-Hartman --- 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; }