Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Nov 22, 2011
2 parents 866d43c + d31da0f commit 2db1125
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
22 changes: 0 additions & 22 deletions arch/microblaze/include/asm/namei.h

This file was deleted.

10 changes: 9 additions & 1 deletion drivers/staging/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ static const struct file_operations iio_event_chrdev_fileops = {

static int iio_event_getfd(struct iio_dev *indio_dev)
{
int fd;

if (indio_dev->event_interface == NULL)
return -ENODEV;

Expand All @@ -252,9 +254,15 @@ static int iio_event_getfd(struct iio_dev *indio_dev)
return -EBUSY;
}
mutex_unlock(&indio_dev->event_interface->event_list_lock);
return anon_inode_getfd("iio:event",
fd = anon_inode_getfd("iio:event",
&iio_event_chrdev_fileops,
indio_dev->event_interface, O_RDONLY);
if (fd < 0) {
mutex_lock(&indio_dev->event_interface->event_list_lock);
clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
mutex_unlock(&indio_dev->event_interface->event_list_lock);
}
return fd;
}

static int __init iio_init(void)
Expand Down
6 changes: 4 additions & 2 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2493,6 +2493,7 @@ EXPORT_SYMBOL(create_mnt_ns);
struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
{
struct mnt_namespace *ns;
struct super_block *s;
struct path path;
int err;

Expand All @@ -2509,10 +2510,11 @@ struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
return ERR_PTR(err);

/* trade a vfsmount reference for active sb one */
atomic_inc(&path.mnt->mnt_sb->s_active);
s = path.mnt->mnt_sb;
atomic_inc(&s->s_active);
mntput(path.mnt);
/* lock the sucker */
down_write(&path.mnt->mnt_sb->s_umount);
down_write(&s->s_umount);
/* ... and return the root of (sub)tree on it */
return path.dentry;
}
Expand Down

0 comments on commit 2db1125

Please sign in to comment.