diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-22 16:19:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-22 16:19:21 -0500 |
commit | 2db1125d51c4752ca68d1f015347b6f5b55e9fca (patch) | |
tree | 6f63b43c99b9b612b4ec3f8a673160fa3fe75111 /fs | |
parent | 866d43c9ea88daa3751b58aba16a2a9b7f7aa067 (diff) | |
parent | d31da0f0ba3bc0a827a63879310818c22d9a95be (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
mount_subtree() pointless use-after-free
iio: fix a leak due to improper use of anon_inode_getfd()
microblaze: bury asm/namei.h
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namespace.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 50ee30345b4f..6d3a1963879b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -2493,6 +2493,7 @@ EXPORT_SYMBOL(create_mnt_ns); | |||
2493 | struct dentry *mount_subtree(struct vfsmount *mnt, const char *name) | 2493 | struct dentry *mount_subtree(struct vfsmount *mnt, const char *name) |
2494 | { | 2494 | { |
2495 | struct mnt_namespace *ns; | 2495 | struct mnt_namespace *ns; |
2496 | struct super_block *s; | ||
2496 | struct path path; | 2497 | struct path path; |
2497 | int err; | 2498 | int err; |
2498 | 2499 | ||
@@ -2509,10 +2510,11 @@ struct dentry *mount_subtree(struct vfsmount *mnt, const char *name) | |||
2509 | return ERR_PTR(err); | 2510 | return ERR_PTR(err); |
2510 | 2511 | ||
2511 | /* trade a vfsmount reference for active sb one */ | 2512 | /* trade a vfsmount reference for active sb one */ |
2512 | atomic_inc(&path.mnt->mnt_sb->s_active); | 2513 | s = path.mnt->mnt_sb; |
2514 | atomic_inc(&s->s_active); | ||
2513 | mntput(path.mnt); | 2515 | mntput(path.mnt); |
2514 | /* lock the sucker */ | 2516 | /* lock the sucker */ |
2515 | down_write(&path.mnt->mnt_sb->s_umount); | 2517 | down_write(&s->s_umount); |
2516 | /* ... and return the root of (sub)tree on it */ | 2518 | /* ... and return the root of (sub)tree on it */ |
2517 | return path.dentry; | 2519 | return path.dentry; |
2518 | } | 2520 | } |