]> Pileus Git - ~andy/linux/commit
sysfs: fix namespace refcnt leak
authorLi Zefan <lizefan@huawei.com>
Tue, 25 Feb 2014 11:28:44 +0000 (19:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Feb 2014 15:37:52 +0000 (07:37 -0800)
commitfed95bab8d29b928fcf6225be72d37ded452e8a2
tree45acbc72b0e58cc47d261b6346f99a5896dea85e
parent6d0abeca3242a88cab8232e4acd7e2bf088f3bc2
sysfs: fix namespace refcnt leak

As mount() and kill_sb() is not a one-to-one match, we shoudn't get
ns refcnt unconditionally in sysfs_mount(), and instead we should
get the refcnt only when kernfs_mount() allocated a new superblock.

v2:
- Changed the name of the new argument, suggested by Tejun.
- Made the argument optional, suggested by Tejun.

v3:
- Make the new argument as second-to-last arg, suggested by Tejun.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
 ---
 fs/kernfs/mount.c      | 8 +++++++-
 fs/sysfs/mount.c       | 5 +++--
 include/linux/kernfs.h | 9 +++++----
 3 files changed, 15 insertions(+), 7 deletions(-)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/kernfs/mount.c
fs/sysfs/mount.c
include/linux/kernfs.h