[no subject]

From: Tejun Heo
Date: Tue Dec 10 2013 - 10:16:30 EST


While restructuring the [u]mount path, 4b93dc9b1c68 ("sysfs, kernfs:
prepare mount path for kernfs") incorrectly updated sysfs_kill_sb() so
that it first kills super_block and then tries to dereference its
namespace tag to drop it. Fix it by caching namespace tag before
killing the superblock and then drop the cached namespace tag.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
Reported-by: Yuanhan Liu <yuanhan.liu@xxxxxxxxxxxxxxx>
Tested-by: Yuanhan Liu <yuanhan.liu@xxxxxxxxxxxxxxx>
Tested-by: Vlastimil Babka <vbabka@xxxxxxx>
Link: http://lkml.kernel.org/g/20131205031051.GC5135@xxxxxxxxxxxxxxxxxxxxx
---
fs/sysfs/mount.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index e7e3aa8..8d07527 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -45,8 +45,10 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,

static void sysfs_kill_sb(struct super_block *sb)
{
+ void *ns = (void *)kernfs_super_ns(sb);
+
kernfs_kill_sb(sb);
- kobj_ns_drop(KOBJ_NS_TYPE_NET, (void *)kernfs_super_ns(sb));
+ kobj_ns_drop(KOBJ_NS_TYPE_NET, ns);
}

static struct file_system_type sysfs_fs_type = {
--
1.8.4.2

--
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/