Commit d514d18f authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

Don't stomp on old ia_valid when changing user/group.

Found by Andrew Morton <akpm@zip.com.au>
parent cfd14b9e
...@@ -524,11 +524,11 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group) ...@@ -524,11 +524,11 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
goto out; goto out;
newattrs.ia_valid = ATTR_CTIME; newattrs.ia_valid = ATTR_CTIME;
if (user != (uid_t) -1) { if (user != (uid_t) -1) {
newattrs.ia_valid = ATTR_UID; newattrs.ia_valid |= ATTR_UID;
newattrs.ia_uid = user; newattrs.ia_uid = user;
} }
if (group != (gid_t) -1) { if (group != (gid_t) -1) {
newattrs.ia_valid = ATTR_GID; newattrs.ia_valid |= ATTR_GID;
newattrs.ia_gid = group; newattrs.ia_gid = group;
} }
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
......
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