summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_kse.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-12-10 01:59:23 +0000
committermarcel <marcel@FreeBSD.org>2003-12-10 01:59:23 +0000
commitb6631c500b60af6940dbcee6a8ac4439d2491f07 (patch)
tree0be9d3954bbeb43fd1472bd3c16e9facdccca175 /sys/kern/kern_kse.c
parent1f8c5c54fd77f203bfb1e19b8afcae1b868d3008 (diff)
downloadFreeBSD-src-b6631c500b60af6940dbcee6a8ac4439d2491f07.zip
FreeBSD-src-b6631c500b60af6940dbcee6a8ac4439d2491f07.tar.gz
Write the thread pointer (val) in the kse mailbox (loc) before we
set the new context in kse_switchin(2). This allows us to return an error to the calling context when the suword() fails.
Diffstat (limited to 'sys/kern/kern_kse.c')
-rw-r--r--sys/kern/kern_kse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index f47beec..a08805e 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -399,10 +399,10 @@ kse_switchin(struct thread *td, struct kse_switchin_args *uap)
error = (uap->mcp == NULL) ? EINVAL : 0;
if (!error)
error = copyin(uap->mcp, &mc, sizeof(mc));
+ if (!error && uap->loc != NULL)
+ error = (suword(uap->loc, uap->val) != 0) ? EINVAL : 0;
if (!error)
error = set_mcontext(td, &mc);
- if (!error && uap->loc != NULL)
- suword(uap->loc, uap->val);
return ((error == 0) ? EJUSTRETURN : error);
}
OpenPOWER on IntegriCloud