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 | |
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
-rw-r--r-- | arch/microblaze/include/asm/namei.h | 22 | ||||
-rw-r--r-- | drivers/staging/iio/industrialio-core.c | 10 | ||||
-rw-r--r-- | fs/namespace.c | 6 |
3 files changed, 13 insertions, 25 deletions
diff --git a/arch/microblaze/include/asm/namei.h b/arch/microblaze/include/asm/namei.h deleted file mode 100644 index 61d60b8a07d5..000000000000 --- a/arch/microblaze/include/asm/namei.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_NAMEI_H | ||
10 | #define _ASM_MICROBLAZE_NAMEI_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | /* This dummy routine maybe changed to something useful | ||
15 | * for /usr/gnemul/ emulation stuff. | ||
16 | * Look at asm-sparc/namei.h for details. | ||
17 | */ | ||
18 | #define __emul_prefix() NULL | ||
19 | |||
20 | #endif /* __KERNEL__ */ | ||
21 | |||
22 | #endif /* _ASM_MICROBLAZE_NAMEI_H */ | ||
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 326e967d54ef..26564094e33b 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c | |||
@@ -242,6 +242,8 @@ static const struct file_operations iio_event_chrdev_fileops = { | |||
242 | 242 | ||
243 | static int iio_event_getfd(struct iio_dev *indio_dev) | 243 | static int iio_event_getfd(struct iio_dev *indio_dev) |
244 | { | 244 | { |
245 | int fd; | ||
246 | |||
245 | if (indio_dev->event_interface == NULL) | 247 | if (indio_dev->event_interface == NULL) |
246 | return -ENODEV; | 248 | return -ENODEV; |
247 | 249 | ||
@@ -252,9 +254,15 @@ static int iio_event_getfd(struct iio_dev *indio_dev) | |||
252 | return -EBUSY; | 254 | return -EBUSY; |
253 | } | 255 | } |
254 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | 256 | mutex_unlock(&indio_dev->event_interface->event_list_lock); |
255 | return anon_inode_getfd("iio:event", | 257 | fd = anon_inode_getfd("iio:event", |
256 | &iio_event_chrdev_fileops, | 258 | &iio_event_chrdev_fileops, |
257 | indio_dev->event_interface, O_RDONLY); | 259 | indio_dev->event_interface, O_RDONLY); |
260 | if (fd < 0) { | ||
261 | mutex_lock(&indio_dev->event_interface->event_list_lock); | ||
262 | clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); | ||
263 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | ||
264 | } | ||
265 | return fd; | ||
258 | } | 266 | } |
259 | 267 | ||
260 | static int __init iio_init(void) | 268 | static int __init iio_init(void) |
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 | } |