Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 151481
b: refs/heads/master
c: 2f38d70
h: refs/heads/master
i:
  151479: 63a3b35
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jun 16, 2009
1 parent 33fa5e2 commit b1df980
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 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: b3fec0fe35a4ff048484f1408385a27695d4273b
refs/heads/master: 2f38d70fb4e97e7d00e12eaac45790cf6ebd7b22
17 changes: 10 additions & 7 deletions trunk/fs/fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,33 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
}

static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
uid_t uid, uid_t euid, int force)
int force)
{
write_lock_irq(&filp->f_owner.lock);
if (force || !filp->f_owner.pid) {
put_pid(filp->f_owner.pid);
filp->f_owner.pid = get_pid(pid);
filp->f_owner.pid_type = type;
filp->f_owner.uid = uid;
filp->f_owner.euid = euid;

if (pid) {
const struct cred *cred = current_cred();
filp->f_owner.uid = cred->uid;
filp->f_owner.euid = cred->euid;
}
}
write_unlock_irq(&filp->f_owner.lock);
}

int __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
int force)
{
const struct cred *cred = current_cred();
int err;

err = security_file_set_fowner(filp);
if (err)
return err;

f_modown(filp, pid, type, cred->uid, cred->euid, force);
f_modown(filp, pid, type, force);
return 0;
}
EXPORT_SYMBOL(__f_setown);
Expand All @@ -247,7 +250,7 @@ EXPORT_SYMBOL(f_setown);

void f_delown(struct file *filp)
{
f_modown(filp, NULL, PIDTYPE_PID, 0, 0, 1);
f_modown(filp, NULL, PIDTYPE_PID, 1);
}

pid_t f_getown(struct file *filp)
Expand Down

0 comments on commit b1df980

Please sign in to comment.