aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/kspd.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-30 16:46:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-30 16:46:56 -0400
commite399835c349b7d8339775a004a86a492a444e230 (patch)
tree6e07f8d53e58a6442bf850097179d0202db4766c /arch/mips/kernel/kspd.c
parent9abf47f11b38f5ecf411b9a44437cad5016631ad (diff)
parentda3a7a2b9f9776f2d44ed9a4b40eabeb17c6e886 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: MIPS: Avoid spurious make includecheck message MIPS: VPE: Get rid of BKL. MIPS: VPE: Fix build after the credential changes a while ago. MIPS: Excite: Get rid of BKL. MIPS: Sibyte: Get rid of BKL. MIPS: BCM63xx: Add PCMCIA & Cardbus support. MIPS: MSP71xx: request_irq() failure ignored in msp_pcibios_config_access() MIPS: Decrease size of au1xxx_dbdma_pm_regs[][] MIPS: SMP: Inline arch_send_call_function_{single_ipi,ipi_mask} MIPS: SMP: Fix build. MIPS: MIPSxx SC: Avoid destructive invalidation on partial L2 cachelines. MIPS: Sibyte: Fix compilation error. MIPS: BCM1480: Re-apply patch lost due to bad resolution of merge conflict. MIPS: BCM63xx: Add serial driver for bcm63xx integrated UART. MIPS: Loongson2: Fix typo "enalbe" -> "enable" MIPS: SMTC: Remove duplicate structure field initialization MIPS: Remove duplicated #include MIPS: BCM63xx: Remove duplicated #include
Diffstat (limited to 'arch/mips/kernel/kspd.c')
-rw-r--r--arch/mips/kernel/kspd.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index f2397f00db43..ad4e017ed2f3 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -172,13 +172,20 @@ static unsigned int translate_open_flags(int flags)
172} 172}
173 173
174 174
175static void sp_setfsuidgid( uid_t uid, gid_t gid) 175static int sp_setfsuidgid(uid_t uid, gid_t gid)
176{ 176{
177 current->cred->fsuid = uid; 177 struct cred *new;
178 current->cred->fsgid = gid;
179 178
180 key_fsuid_changed(current); 179 new = prepare_creds();
181 key_fsgid_changed(current); 180 if (!new)
181 return -ENOMEM;
182
183 new->fsuid = uid;
184 new->fsgid = gid;
185
186 commit_creds(new);
187
188 return 0;
182} 189}
183 190
184/* 191/*
@@ -196,7 +203,7 @@ void sp_work_handle_request(void)
196 mm_segment_t old_fs; 203 mm_segment_t old_fs;
197 struct timeval tv; 204 struct timeval tv;
198 struct timezone tz; 205 struct timezone tz;
199 int cmd; 206 int err, cmd;
200 207
201 char *vcwd; 208 char *vcwd;
202 int size; 209 int size;
@@ -225,8 +232,11 @@ void sp_work_handle_request(void)
225 /* Run the syscall at the privilege of the user who loaded the 232 /* Run the syscall at the privilege of the user who loaded the
226 SP program */ 233 SP program */
227 234
228 if (vpe_getuid(tclimit)) 235 if (vpe_getuid(tclimit)) {
229 sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit)); 236 err = sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
237 if (!err)
238 pr_err("Change of creds failed\n");
239 }
230 240
231 switch (sc.cmd) { 241 switch (sc.cmd) {
232 /* needs the flags argument translating from SDE kit to 242 /* needs the flags argument translating from SDE kit to
@@ -283,8 +293,11 @@ void sp_work_handle_request(void)
283 break; 293 break;
284 } /* switch */ 294 } /* switch */
285 295
286 if (vpe_getuid(tclimit)) 296 if (vpe_getuid(tclimit)) {
287 sp_setfsuidgid( 0, 0); 297 err = sp_setfsuidgid(0, 0);
298 if (!err)
299 pr_err("restoring old creds failed\n");
300 }
288 301
289 old_fs = get_fs(); 302 old_fs = get_fs();
290 set_fs(KERNEL_DS); 303 set_fs(KERNEL_DS);