Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Nick Piggin and committed by
Al Viro
8718d36c 5b54470d

+8 -7
+4 -5
fs/configfs/inode.c
··· 72 72 if (!sd) 73 73 return -EINVAL; 74 74 75 - error = simple_setattr(dentry, iattr); 76 - if (error) 77 - return error; 78 - 79 75 sd_iattr = sd->s_iattr; 80 76 if (!sd_iattr) { 81 77 /* setting attributes for the first time, allocate now */ ··· 85 89 sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME; 86 90 sd->s_iattr = sd_iattr; 87 91 } 88 - 89 92 /* attributes were changed atleast once in past */ 93 + 94 + error = simple_setattr(dentry, iattr); 95 + if (error) 96 + return error; 90 97 91 98 if (ia_valid & ATTR_UID) 92 99 sd_iattr->ia_uid = iattr->ia_uid;
+4 -2
fs/sysfs/inode.c
··· 117 117 if (error) 118 118 goto out; 119 119 120 + error = sysfs_sd_setattr(sd, iattr); 121 + if (error) 122 + goto out; 123 + 120 124 /* this ignores size changes */ 121 125 generic_setattr(inode, iattr); 122 - 123 - error = sysfs_sd_setattr(sd, iattr); 124 126 125 127 out: 126 128 mutex_unlock(&sysfs_mutex);