aboutsummaryrefslogtreecommitdiffstats
path: root/fs/configfs
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-05-31 17:58:02 +1000
committerGreg Kroah-Hartman <gregkh@suse.de>2010-06-04 13:27:53 -0700
commit75de46b98dda624397ccb17c106e51f478a79c15 (patch)
tree8c4cf43eb8f840e84a48d387928673bcccd03d66 /fs/configfs
parent743db2d903bc4e963a31496328d847d69f75047c (diff)
downloadkernel_samsung_smdk4412-75de46b98dda624397ccb17c106e51f478a79c15.zip
kernel_samsung_smdk4412-75de46b98dda624397ccb17c106e51f478a79c15.tar.gz
kernel_samsung_smdk4412-75de46b98dda624397ccb17c106e51f478a79c15.tar.bz2
fix setattr error handling in sysfs, configfs
sysfs and configfs setattr functions have error cases after the generic inode's attributes have been changed. Fix consistency by changing the generic inode attributes only when it is guaranteed to succeed. Signed-off-by: Nick Piggin <npiggin@suse.de> Acked-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/inode.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index 4164514..cf78d44 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -72,10 +72,6 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
if (!sd)
return -EINVAL;
- error = simple_setattr(dentry, iattr);
- if (error)
- return error;
-
sd_iattr = sd->s_iattr;
if (!sd_iattr) {
/* setting attributes for the first time, allocate now */
@@ -89,9 +85,12 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME;
sd->s_iattr = sd_iattr;
}
-
/* attributes were changed atleast once in past */
+ error = simple_setattr(dentry, iattr);
+ if (error)
+ return error;
+
if (ia_valid & ATTR_UID)
sd_iattr->ia_uid = iattr->ia_uid;
if (ia_valid & ATTR_GID)