Re: [PATCH 2.6.10-rc2-bk15] sysfs_dir_close memory leak

From: Greg KH
Date: Fri Dec 03 2004 - 13:59:12 EST


On Fri, Dec 03, 2004 at 03:05:20AM -0800, Adam J. Richter wrote:
> Chris Wright wrote:
> >* Adam J. Richter (adam@xxxxxxxxxxxxx) wrote:
> >> 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.
>
> >Yeah, I noticed this as well. Why the BUGON()?
>
> My thinking was that the preconditions in my tree for
> calling release_sysfs_dirent are dirent->s_dentry == NULL and
> list_empty(&dirent->s_sibling). The latter should be apparent
> from two lines above, but the former is less obvious, although
> it is also theoretically always true.
>
> I'm OK with deleting the BUG_ON(). It was not verifying
> anything passed in by an outside caller.

Thanks, I've deleted the BUG_ON() and will be sending the patch on to
Linus in a bit.

(oh, care to add a "Signed-off-by:" line to your patches?)

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/