Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306005
b: refs/heads/master
c: 52137ab
h: refs/heads/master
i:
  306003: 39fb951
v: v3
  • Loading branch information
Eric W. Biederman committed May 3, 2012
1 parent cea7c3b commit bddba60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e96e3b7b8407be794ab1fd8e4b332818a358e78
refs/heads/master: 52137abe1820196d956bfd51edebc571b3427deb
13 changes: 11 additions & 2 deletions trunk/fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,24 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
struct inode *inode = path->dentry->d_inode;
int error;
struct iattr newattrs;
kuid_t uid;
kgid_t gid;

uid = make_kuid(current_user_ns(), user);
gid = make_kgid(current_user_ns(), group);

newattrs.ia_valid = ATTR_CTIME;
if (user != (uid_t) -1) {
if (!uid_valid(uid))
return -EINVAL;
newattrs.ia_valid |= ATTR_UID;
newattrs.ia_uid = user;
newattrs.ia_uid = uid;
}
if (group != (gid_t) -1) {
if (!gid_valid(gid))
return -EINVAL;
newattrs.ia_valid |= ATTR_GID;
newattrs.ia_gid = group;
newattrs.ia_gid = gid;
}
if (!S_ISDIR(inode->i_mode))
newattrs.ia_valid |=
Expand Down

0 comments on commit bddba60

Please sign in to comment.