sysfs: sysfs_sd_setattr set iattrs unconditionally
There is currently a bug in sysfs_sd_setattr inherited from sysfs_setattr in 2.6.32 where the first time we set the attributes on a sysfs file we allocate backing store but do not set the backing store attributes. Resulting in overly restrictive permissions on sysfs files. The fix is to simply modify the code so that it always executes when we update the sysfs attributes, as we did in 2.6.31 and earlier. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Tested-by: Jean Delvare <khali@linux-fr.org> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
0813e22d4e
commit
7c0ff870d1
|
@ -81,7 +81,7 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)
|
|||
if (!sd_attrs)
|
||||
return -ENOMEM;
|
||||
sd->s_iattr = sd_attrs;
|
||||
} else {
|
||||
}
|
||||
/* attributes were changed at least once in past */
|
||||
iattrs = &sd_attrs->ia_iattr;
|
||||
|
||||
|
@ -99,7 +99,6 @@ int sysfs_sd_setattr(struct sysfs_dirent *sd, struct iattr * iattr)
|
|||
umode_t mode = iattr->ia_mode;
|
||||
iattrs->ia_mode = sd->s_mode = mode;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue