Commit c0648e02 authored by Ralf Baechle's avatar Ralf Baechle

MIPS: VPE: Fix build after the credential changes a while ago.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent b7a05871
...@@ -172,13 +172,20 @@ static unsigned int translate_open_flags(int flags) ...@@ -172,13 +172,20 @@ static unsigned int translate_open_flags(int flags)
} }
static void sp_setfsuidgid( uid_t uid, gid_t gid) static int sp_setfsuidgid(uid_t uid, gid_t gid)
{ {
current->cred->fsuid = uid; struct cred *new;
current->cred->fsgid = gid;
key_fsuid_changed(current); new = prepare_creds();
key_fsgid_changed(current); if (!new)
return -ENOMEM;
new->fsuid = uid;
new->fsgid = gid;
commit_creds(new);
return 0;
} }
/* /*
...@@ -196,7 +203,7 @@ void sp_work_handle_request(void) ...@@ -196,7 +203,7 @@ void sp_work_handle_request(void)
mm_segment_t old_fs; mm_segment_t old_fs;
struct timeval tv; struct timeval tv;
struct timezone tz; struct timezone tz;
int cmd; int err, cmd;
char *vcwd; char *vcwd;
int size; int size;
...@@ -225,8 +232,11 @@ void sp_work_handle_request(void) ...@@ -225,8 +232,11 @@ void sp_work_handle_request(void)
/* Run the syscall at the privilege of the user who loaded the /* Run the syscall at the privilege of the user who loaded the
SP program */ SP program */
if (vpe_getuid(tclimit)) if (vpe_getuid(tclimit)) {
sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit)); err = sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
if (!err)
pr_err("Change of creds failed\n");
}
switch (sc.cmd) { switch (sc.cmd) {
/* needs the flags argument translating from SDE kit to /* needs the flags argument translating from SDE kit to
...@@ -283,8 +293,11 @@ void sp_work_handle_request(void) ...@@ -283,8 +293,11 @@ void sp_work_handle_request(void)
break; break;
} /* switch */ } /* switch */
if (vpe_getuid(tclimit)) if (vpe_getuid(tclimit)) {
sp_setfsuidgid( 0, 0); err = sp_setfsuidgid(0, 0);
if (!err)
pr_err("restoring old creds failed\n");
}
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
......
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