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

Commit 9e17632c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull misc vfs cleanups from Al Viro:
 "Assorted cleanups and fixes all over the place"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  coredump: only charge written data against RLIMIT_CORE
  coredump: get rid of coredump_params->written
  ecryptfs_lookup(): try either only encrypted or plaintext name
  ecryptfs: avoid multiple aliases for directories
  bpf: reject invalid names right in ->lookup()
  __d_alloc(): treat NULL name as QSTR("/", 1)
  mtd: switch ubi_open_volume_path() to vfs_stat()
  mtd: switch open_mtd_by_chdev() to use of vfs_stat()
parents 69370471 2c4cb043
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
	char *name;
	char fullname[80], *buf;
	struct elf_note en;
	size_t skip;

	buf = (void *)get_zeroed_page(GFP_KERNEL);
	if (!buf)
@@ -171,8 +172,8 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
	if (rc < 0)
		goto out;

	if (!dump_skip(cprm,
		       roundup(cprm->written - total + sz, 4) - cprm->written))
	skip = roundup(cprm->file->f_pos - total + sz, 4) - cprm->file->f_pos;
	if (!dump_skip(cprm, skip))
		goto Eio;
out:
	free_page((unsigned long)buf);
+5 −8
Original line number Diff line number Diff line
@@ -1142,22 +1142,19 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
 */
static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)
{
	int err, major, minor, mode;
	struct path path;
	struct kstat stat;
	int err, minor;

	/* Probably this is an MTD character device node path */
	err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path);
	err = vfs_stat(mtd_dev, &stat);
	if (err)
		return ERR_PTR(err);

	/* MTD device number is defined by the major / minor numbers */
	major = imajor(d_backing_inode(path.dentry));
	minor = iminor(d_backing_inode(path.dentry));
	mode = d_backing_inode(path.dentry)->i_mode;
	path_put(&path);
	if (major != MTD_CHAR_MAJOR || !S_ISCHR(mode))
	if (MAJOR(stat.rdev) != MTD_CHAR_MAJOR || !S_ISCHR(stat.mode))
		return ERR_PTR(-EINVAL);

	minor = MINOR(stat.rdev);
	if (minor & 1)
		/*
		 * Just do not think the "/dev/mtdrX" devices support is need,
+8 −11
Original line number Diff line number Diff line
@@ -301,27 +301,24 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm);
 */
struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
{
	int error, ubi_num, vol_id, mod;
	struct inode *inode;
	struct path path;
	int error, ubi_num, vol_id;
	struct kstat stat;

	dbg_gen("open volume %s, mode %d", pathname, mode);

	if (!pathname || !*pathname)
		return ERR_PTR(-EINVAL);

	error = kern_path(pathname, LOOKUP_FOLLOW, &path);
	error = vfs_stat(pathname, &stat);
	if (error)
		return ERR_PTR(error);

	inode = d_backing_inode(path.dentry);
	mod = inode->i_mode;
	ubi_num = ubi_major2num(imajor(inode));
	vol_id = iminor(inode) - 1;
	path_put(&path);

	if (!S_ISCHR(mod))
	if (!S_ISCHR(stat.mode))
		return ERR_PTR(-EINVAL);

	ubi_num = ubi_major2num(MAJOR(stat.rdev));
	vol_id = MINOR(stat.rdev) - 1;

	if (vol_id >= 0 && ubi_num >= 0)
		return ubi_open_volume(ubi_num, vol_id, mode);
	return ERR_PTR(-ENODEV);
+1 −1
Original line number Diff line number Diff line
@@ -2273,7 +2273,7 @@ static int elf_core_dump(struct coredump_params *cprm)
		goto end_coredump;

	/* Align to page */
	if (!dump_skip(cprm, dataoff - cprm->written))
	if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
		goto end_coredump;

	for (i = 0, vma = first_vma(current, gate_vma); vma != NULL;
+1 −1
Original line number Diff line number Diff line
@@ -1787,7 +1787,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
				goto end_coredump;
	}

	if (!dump_skip(cprm, dataoff - cprm->written))
	if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
		goto end_coredump;

	if (!elf_fdpic_dump_segments(cprm))
Loading