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

Commit 79360ddd authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pile 2 of vfs updates from Al Viro:
 "Stuff in this one - assorted fixes, lglock tidy-up, death to
  lock_super().

  There'll be a VFS pile tomorrow (with patches from Jeff Layton,
  sanitizing getname() and related parts of audit and preparing for
  ESTALE fixes), but I'd rather push the stuff in this one ASAP - some
  of the bugs closed here are quite unpleasant."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  vfs: bogus warnings in fs/namei.c
  consitify do_mount() arguments
  lglock: add DEFINE_STATIC_LGLOCK()
  lglock: make the per_cpu locks static
  lglock: remove unused DEFINE_LGLOCK_LOCKDEP()
  MAX_LFS_FILESIZE definition for 64bit needs LL...
  tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checking
  vfs: drop lock/unlock super
  ufs: drop lock/unlock super
  sysv: drop lock/unlock super
  hpfs: drop lock/unlock super
  fat: drop lock/unlock super
  ext3: drop lock/unlock super
  exofs: drop lock/unlock super
  dup3: Return an error when oldfd == newfd.
  fs: handle failed audit_log_start properly
  fs: prevent use after free in auditing when symlink following was denied
parents 8213a2f3 98f6ef64
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -99,7 +99,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
 * FIXME: we should try harder by querying the mds for the ino.
 * FIXME: we should try harder by querying the mds for the ino.
 */
 */
static struct dentry *__fh_to_dentry(struct super_block *sb,
static struct dentry *__fh_to_dentry(struct super_block *sb,
				     struct ceph_nfs_fh *fh)
				     struct ceph_nfs_fh *fh, int fh_len)
{
{
	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
	struct inode *inode;
	struct inode *inode;
@@ -107,6 +107,9 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
	struct ceph_vino vino;
	struct ceph_vino vino;
	int err;
	int err;


	if (fh_len < sizeof(*fh) / 4)
		return ERR_PTR(-ESTALE);

	dout("__fh_to_dentry %llx\n", fh->ino);
	dout("__fh_to_dentry %llx\n", fh->ino);
	vino.ino = fh->ino;
	vino.ino = fh->ino;
	vino.snap = CEPH_NOSNAP;
	vino.snap = CEPH_NOSNAP;
@@ -150,7 +153,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
 * convert connectable fh to dentry
 * convert connectable fh to dentry
 */
 */
static struct dentry *__cfh_to_dentry(struct super_block *sb,
static struct dentry *__cfh_to_dentry(struct super_block *sb,
				      struct ceph_nfs_confh *cfh)
				      struct ceph_nfs_confh *cfh, int fh_len)
{
{
	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
	struct inode *inode;
	struct inode *inode;
@@ -158,6 +161,9 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb,
	struct ceph_vino vino;
	struct ceph_vino vino;
	int err;
	int err;


	if (fh_len < sizeof(*cfh) / 4)
		return ERR_PTR(-ESTALE);

	dout("__cfh_to_dentry %llx (%llx/%x)\n",
	dout("__cfh_to_dentry %llx (%llx/%x)\n",
	     cfh->ino, cfh->parent_ino, cfh->parent_name_hash);
	     cfh->ino, cfh->parent_ino, cfh->parent_name_hash);


@@ -207,9 +213,11 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid,
					int fh_len, int fh_type)
					int fh_len, int fh_type)
{
{
	if (fh_type == 1)
	if (fh_type == 1)
		return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw);
		return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw,
								fh_len);
	else
	else
		return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw);
		return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw,
								fh_len);
}
}


/*
/*
@@ -230,6 +238,8 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,


	if (fh_type == 1)
	if (fh_type == 1)
		return ERR_PTR(-ESTALE);
		return ERR_PTR(-ESTALE);
	if (fh_len < sizeof(*cfh) / 4)
		return ERR_PTR(-ESTALE);


	pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino,
	pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino,
		 cfh->parent_name_hash);
		 cfh->parent_name_hash);
+0 −4
Original line number Original line Diff line number Diff line
@@ -389,8 +389,6 @@ static int exofs_sync_fs(struct super_block *sb, int wait)
	if (unlikely(ret))
	if (unlikely(ret))
		goto out;
		goto out;


	lock_super(sb);

	ios->length = offsetof(struct exofs_fscb, s_dev_table_oid);
	ios->length = offsetof(struct exofs_fscb, s_dev_table_oid);
	memset(fscb, 0, ios->length);
	memset(fscb, 0, ios->length);
	fscb->s_nextid = cpu_to_le64(sbi->s_nextid);
	fscb->s_nextid = cpu_to_le64(sbi->s_nextid);
@@ -406,8 +404,6 @@ static int exofs_sync_fs(struct super_block *sb, int wait)
	if (unlikely(ret))
	if (unlikely(ret))
		EXOFS_ERR("%s: ore_write failed.\n", __func__);
		EXOFS_ERR("%s: ore_write failed.\n", __func__);



	unlock_super(sb);
out:
out:
	EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);
	EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);
	ore_put_io_state(ios);
	ore_put_io_state(ios);
+0 −6
Original line number Original line Diff line number Diff line
@@ -2578,11 +2578,9 @@ static int ext3_freeze(struct super_block *sb)
static int ext3_unfreeze(struct super_block *sb)
static int ext3_unfreeze(struct super_block *sb)
{
{
	if (!(sb->s_flags & MS_RDONLY)) {
	if (!(sb->s_flags & MS_RDONLY)) {
		lock_super(sb);
		/* Reser the needs_recovery flag before the fs is unlocked. */
		/* Reser the needs_recovery flag before the fs is unlocked. */
		EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
		EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
		ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1);
		ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1);
		unlock_super(sb);
		journal_unlock_updates(EXT3_SB(sb)->s_journal);
		journal_unlock_updates(EXT3_SB(sb)->s_journal);
	}
	}
	return 0;
	return 0;
@@ -2602,7 +2600,6 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
#endif
#endif


	/* Store the original options */
	/* Store the original options */
	lock_super(sb);
	old_sb_flags = sb->s_flags;
	old_sb_flags = sb->s_flags;
	old_opts.s_mount_opt = sbi->s_mount_opt;
	old_opts.s_mount_opt = sbi->s_mount_opt;
	old_opts.s_resuid = sbi->s_resuid;
	old_opts.s_resuid = sbi->s_resuid;
@@ -2708,8 +2705,6 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
		    old_opts.s_qf_names[i] != sbi->s_qf_names[i])
		    old_opts.s_qf_names[i] != sbi->s_qf_names[i])
			kfree(old_opts.s_qf_names[i]);
			kfree(old_opts.s_qf_names[i]);
#endif
#endif
	unlock_super(sb);

	if (enable_quota)
	if (enable_quota)
		dquot_resume(sb, -1);
		dquot_resume(sb, -1);
	return 0;
	return 0;
@@ -2728,7 +2723,6 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
		sbi->s_qf_names[i] = old_opts.s_qf_names[i];
		sbi->s_qf_names[i] = old_opts.s_qf_names[i];
	}
	}
#endif
#endif
	unlock_super(sb);
	return err;
	return err;
}
}


+2 −2
Original line number Original line Diff line number Diff line
@@ -571,7 +571,7 @@ static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent,
	int short_len = 0, fill_len = 0;
	int short_len = 0, fill_len = 0;
	int ret = 0;
	int ret = 0;


	lock_super(sb);
	mutex_lock(&sbi->s_lock);


	cpos = filp->f_pos;
	cpos = filp->f_pos;
	/* Fake . and .. for the root directory. */
	/* Fake . and .. for the root directory. */
@@ -693,7 +693,7 @@ static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent,
	if (unicode)
	if (unicode)
		__putname(unicode);
		__putname(unicode);
out:
out:
	unlock_super(sb);
	mutex_unlock(&sbi->s_lock);
	return ret;
	return ret;
}
}


+3 −2
Original line number Original line Diff line number Diff line
@@ -71,6 +71,7 @@ struct msdos_sb_info {
	unsigned long root_cluster;   /* first cluster of the root directory */
	unsigned long root_cluster;   /* first cluster of the root directory */
	unsigned long fsinfo_sector;  /* sector number of FAT32 fsinfo */
	unsigned long fsinfo_sector;  /* sector number of FAT32 fsinfo */
	struct mutex fat_lock;
	struct mutex fat_lock;
	struct mutex s_lock;
	unsigned int prev_free;      /* previously allocated cluster number */
	unsigned int prev_free;      /* previously allocated cluster number */
	unsigned int free_clusters;  /* -1 if undefined */
	unsigned int free_clusters;  /* -1 if undefined */
	unsigned int free_clus_valid; /* is free_clusters valid? */
	unsigned int free_clus_valid; /* is free_clusters valid? */
Loading