Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d65f5c58 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
  [PATCH] pass struct path * to do_add_mount()
  [PATCH] switch mtd and dm-table to lookup_bdev()
  [patch 3/4] vfs: remove unused nameidata argument of may_create()
  [PATCH] devpts: switch to IDA
  [PATCH 2/2] proc: switch inode number allocation to IDA
  [PATCH 1/2] proc: fix inode number bogorithmetic
  [PATCH] fix bdev leak in block_dev.c do_open()
  [PATCH] fix races and leaks in vfs_quota_on() users
  [PATCH] clean dup2() up a bit
  [PATCH] merge locate_fd() and get_unused_fd()
  [PATCH] ipv4_static_sysctl_init() should be under CONFIG_SYSCTL
  Re: BUG at security/selinux/avc.c:883 (was: Re: linux-next: Tree
parents a8086ad8 8d66bf54
Loading
Loading
Loading
Loading
+6 −23
Original line number Diff line number Diff line
@@ -316,29 +316,12 @@ static inline int check_space(struct dm_table *t)
 */
static int lookup_device(const char *path, dev_t *dev)
{
	int r;
	struct nameidata nd;
	struct inode *inode;

	if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd)))
		return r;

	inode = nd.path.dentry->d_inode;
	if (!inode) {
		r = -ENOENT;
		goto out;
	}

	if (!S_ISBLK(inode->i_mode)) {
		r = -ENOTBLK;
		goto out;
	}

	*dev = inode->i_rdev;

 out:
	path_put(&nd.path);
	return r;
	struct block_device *bdev = lookup_bdev(path);
	if (IS_ERR(bdev))
		return PTR_ERR(bdev);
	*dev = bdev->bd_dev;
	bdput(bdev);
	return 0;
}

/*
+11 −22
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
	       int (*fill_super)(struct super_block *, void *, int),
	       struct vfsmount *mnt)
{
	struct nameidata nd;
	struct block_device *bdev;
	int mtdnr, ret;

	if (!dev_name)
@@ -181,29 +181,20 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
	/* try the old way - the hack where we allowed users to mount
	 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
	 */
	ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);

	DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n",
	      ret, nd.path.dentry ? nd.path.dentry->d_inode : NULL);

	if (ret)
	bdev = lookup_bdev(dev_name);
	if (IS_ERR(bdev)) {
		ret = PTR_ERR(bdev);
		DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret);
		return ret;

	ret = -EINVAL;

	if (!S_ISBLK(nd.path.dentry->d_inode->i_mode))
		goto out;

	if (nd.path.mnt->mnt_flags & MNT_NODEV) {
		ret = -EACCES;
		goto out;
	}
	DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");

	if (imajor(nd.path.dentry->d_inode) != MTD_BLOCK_MAJOR)
	ret = -EINVAL;
	if (MAJOR(bdev->bd_dev) != MTD_BLOCK_MAJOR)
		goto not_an_MTD_device;

	mtdnr = iminor(nd.path.dentry->d_inode);
	path_put(&nd.path);
	mtdnr = MINOR(bdev->bd_dev);
	bdput(bdev);

	return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
			     mnt);
@@ -213,10 +204,8 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
		printk(KERN_NOTICE
		       "MTD: Attempt to mount non-MTD device \"%s\"\n",
		       dev_name);
out:
	path_put(&nd.path);
	bdput(bdev);
	return ret;

}

EXPORT_SYMBOL_GPL(get_sb_mtd);
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
	}

	mntget(newmnt);
	err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
	err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts);
	switch (err) {
	case 0:
		path_put(&nd->path);
+4 −1
Original line number Diff line number Diff line
@@ -941,8 +941,10 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
	 * hooks: /n/, see "layering violations".
	 */
	ret = devcgroup_inode_permission(bdev->bd_inode, perm);
	if (ret != 0)
	if (ret != 0) {
		bdput(bdev);
		return ret;
	}

	ret = -ENXIO;
	file->f_mapping = bdev->bd_inode->i_mapping;
@@ -1234,6 +1236,7 @@ struct block_device *lookup_bdev(const char *path)
	bdev = ERR_PTR(error);
	goto out;
}
EXPORT_SYMBOL(lookup_bdev);

/**
 * open_bdev_excl  -  open a block device by name and set it up for use
+1 −1
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
	int err;

	mntget(newmnt);
	err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist);
	err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags, mntlist);
	switch (err) {
	case 0:
		path_put(&nd->path);
Loading