On Sat, Mar 16, 2013 at 11:22 PM, Ming Lei <tom.leim...@gmail.com> wrote: > On Sat, Mar 16, 2013 at 11:07 PM, Sasha Levin <levinsasha...@gmail.com> wrote: >> >> Hi Ming, >> >> With your patch: >> >> >> [ 1525.874312] release_sysfs_dirent sysfs_dirent use after free: ptysb-uevent > > Sasha, thanks for your test. > > So is the oops always triggered on this node of 'ptysb-uevent' or the node > name > is changed every time?
Also, we may dump stack on the release path with the below patch to see who did the ugly free. -- diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 2fbdff6..993671d 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -281,6 +281,12 @@ void release_sysfs_dirent(struct sysfs_dirent * sd) */ parent_sd = sd->s_parent; + if(!(sd->s_flags & SYSFS_FLAG_REMOVED)) { + printk("%s sysfs_dirent use after free: %s-%s\n", + __func__, parent_sd->s_name, sd->s_name); + dump_stack(); + } + if (sysfs_type(sd) == SYSFS_KOBJ_LINK) sysfs_put(sd->s_symlink.target_sd); if (sysfs_type(sd) & SYSFS_COPY_NAME) @@ -962,6 +968,9 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns, int valid = !(pos->s_flags & SYSFS_FLAG_REMOVED) && pos->s_parent == parent_sd && hash == pos->s_hash; + if (valid && (atomic_read(&pos->s_count) <= 1)) + printk("%s sysfs_dirent use after free: %s-%s\n", + __func__, parent_sd->s_name, pos->s_name); sysfs_put(pos); if (!valid) pos = NULL; Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/