aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorTom Musta <tommusta@gmail.com>2014-08-12 13:53:38 -0500
committerRiku Voipio <riku.voipio@linaro.org>2014-08-22 15:06:35 +0300
commita1d5c5b25d06b68aec76e4b0eb7d8aacb5fbd191 (patch)
treec7f81864e6f7755cedc7e883d5af8ab472ad9749 /linux-user/syscall.c
parentedcc5f9dc39309d32f4b3737e6b750ae967f5bbd (diff)
linux-user: Handle NULL sched_param argument to sched_*
The sched_getparam, sched_setparam and sched_setscheduler system calls take a pointer argument to a sched_param structure. When this pointer is null, errno should be set to EINVAL. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2549249a08..4424b63c86 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7736,6 +7736,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
struct sched_param *target_schp;
struct sched_param schp;
+ if (arg2 == 0) {
+ return -TARGET_EINVAL;
+ }
if (!lock_user_struct(VERIFY_READ, target_schp, arg2, 1))
goto efault;
schp.sched_priority = tswap32(target_schp->sched_priority);
@@ -7747,6 +7750,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
{
struct sched_param *target_schp;
struct sched_param schp;
+
+ if (arg2 == 0) {
+ return -TARGET_EINVAL;
+ }
ret = get_errno(sched_getparam(arg1, &schp));
if (!is_error(ret)) {
if (!lock_user_struct(VERIFY_WRITE, target_schp, arg2, 0))
@@ -7760,6 +7767,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
{
struct sched_param *target_schp;
struct sched_param schp;
+ if (arg3 == 0) {
+ return -TARGET_EINVAL;
+ }
if (!lock_user_struct(VERIFY_READ, target_schp, arg3, 1))
goto efault;
schp.sched_priority = tswap32(target_schp->sched_priority);