Commit 0f102935 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

sysfs: sysfs_sd_setattr set iattrs unconditionally

commit 7c0ff870 upstream.

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: default avatarEric W. Biederman <ebiederm@xmission.com>
Tested-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 458c2928
...@@ -94,7 +94,7 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) ...@@ -94,7 +94,7 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
if (!sd_attrs) if (!sd_attrs)
return -ENOMEM; return -ENOMEM;
sd->s_iattr = sd_attrs; sd->s_iattr = sd_attrs;
} else { }
/* attributes were changed at least once in past */ /* attributes were changed at least once in past */
iattrs = &sd_attrs->ia_iattr; iattrs = &sd_attrs->ia_iattr;
...@@ -118,7 +118,6 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) ...@@ -118,7 +118,6 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
mode &= ~S_ISGID; mode &= ~S_ISGID;
iattrs->ia_mode = sd->s_mode = mode; iattrs->ia_mode = sd->s_mode = mode;
} }
}
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment