From 06171bdc5bd2583ec315e47c297443dc94567120 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 12 Jun 2012 16:20:31 +0200 Subject: [PATCH] --- yaml --- r: 320979 b: refs/heads/master c: e24f17da3560781e274699f066fb788ad52f4402 h: refs/heads/master i: 320977: 103ec96b1336d3571b906a2d36b29e29df5e56fe 320975: 6c5db1e1936cde51372c13c0eb5df1662aa160ad v: v3 --- [refs] | 2 +- trunk/fs/fat/file.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index f4650c3be17e..6f07194b4887 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c30dabfe5d10c5fd70d882e5afb8f59f2942b194 +refs/heads/master: e24f17da3560781e274699f066fb788ad52f4402 diff --git a/trunk/fs/fat/file.c b/trunk/fs/fat/file.c index a71fe3715ee8..e007b8bd8e5e 100644 --- a/trunk/fs/fat/file.c +++ b/trunk/fs/fat/file.c @@ -43,10 +43,10 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) if (err) goto out; - mutex_lock(&inode->i_mutex); err = mnt_want_write_file(file); if (err) - goto out_unlock_inode; + goto out; + mutex_lock(&inode->i_mutex); /* * ATTR_VOLUME and ATTR_DIR cannot be changed; this also @@ -73,14 +73,14 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) /* The root directory has no attributes */ if (inode->i_ino == MSDOS_ROOT_INO && attr != ATTR_DIR) { err = -EINVAL; - goto out_drop_write; + goto out_unlock_inode; } if (sbi->options.sys_immutable && ((attr | oldattr) & ATTR_SYS) && !capable(CAP_LINUX_IMMUTABLE)) { err = -EPERM; - goto out_drop_write; + goto out_unlock_inode; } /* @@ -90,12 +90,12 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) */ err = security_inode_setattr(file->f_path.dentry, &ia); if (err) - goto out_drop_write; + goto out_unlock_inode; /* This MUST be done before doing anything irreversible... */ err = fat_setattr(file->f_path.dentry, &ia); if (err) - goto out_drop_write; + goto out_unlock_inode; fsnotify_change(file->f_path.dentry, ia.ia_valid); if (sbi->options.sys_immutable) { @@ -107,10 +107,9 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) fat_save_attrs(inode, attr); mark_inode_dirty(inode); -out_drop_write: - mnt_drop_write_file(file); out_unlock_inode: mutex_unlock(&inode->i_mutex); + mnt_drop_write_file(file); out: return err; }