Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141742
b: refs/heads/master
c: 5dba082
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Apr 3, 2009
1 parent a55c30f commit 28bc9d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 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: 55643171de7ba429fbf2cb72fb1f2c6f2df0dcf3
refs/heads/master: 5dba0826999683fe39aa8b49480b0e953afd117a
17 changes: 14 additions & 3 deletions trunk/drivers/staging/p9auth/p9auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <linux/interrupt.h>
#include <linux/scatterlist.h>
#include <linux/crypto.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include "p9auth.h"

int cap_major = CAP_MAJOR;
Expand Down Expand Up @@ -104,6 +106,7 @@ cap_write(struct file * filp, const char __user * buf,
struct list_head *pos;
struct cap_dev *dev = filp->private_data;
ssize_t retval = -ENOMEM;
struct cred *new;
int len, target_int, source_int, flag = 0;
char *user_buf, *user_buf_running, *source_user, *target_user,
*rand_str, *hash_str, *result;
Expand Down Expand Up @@ -177,7 +180,7 @@ cap_write(struct file * filp, const char __user * buf,
/* Check whether the process writing to capuse is actually owned by
* the source owner
*/
if (source_int != current->uid) {
if (source_int != current_uid()) {
printk(KERN_ALERT
"Process is not owned by the source user of the capability.\n");
retval = -EFAULT;
Expand All @@ -187,8 +190,16 @@ cap_write(struct file * filp, const char __user * buf,
* Currently I am changing the effective user id
* since most of the authorisation decisions are based on it
*/
current->uid = (uid_t) target_int;
current->euid = (uid_t) target_int;
new = prepare_creds();
if (!new) {
retval = -ENOMEM;
goto out;
}
new->uid = (uid_t) target_int;
new->euid = (uid_t) target_int;
retval = commit_creds(new);
if (retval)
goto out;

/* Remove the capability from the list and break */
tmp =
Expand Down

0 comments on commit 28bc9d4

Please sign in to comment.