diff options
-rw-r--r-- | kernel/signal.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index ccf1ceedaebe..f268372c0cc0 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2454,11 +2454,9 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s | |||
2454 | stack_t oss; | 2454 | stack_t oss; |
2455 | int error; | 2455 | int error; |
2456 | 2456 | ||
2457 | if (uoss) { | 2457 | oss.ss_sp = (void __user *) current->sas_ss_sp; |
2458 | oss.ss_sp = (void __user *) current->sas_ss_sp; | 2458 | oss.ss_size = current->sas_ss_size; |
2459 | oss.ss_size = current->sas_ss_size; | 2459 | oss.ss_flags = sas_ss_flags(sp); |
2460 | oss.ss_flags = sas_ss_flags(sp); | ||
2461 | } | ||
2462 | 2460 | ||
2463 | if (uss) { | 2461 | if (uss) { |
2464 | void __user *ss_sp; | 2462 | void __user *ss_sp; |
@@ -2501,13 +2499,16 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s | |||
2501 | current->sas_ss_size = ss_size; | 2499 | current->sas_ss_size = ss_size; |
2502 | } | 2500 | } |
2503 | 2501 | ||
2502 | error = 0; | ||
2504 | if (uoss) { | 2503 | if (uoss) { |
2505 | error = -EFAULT; | 2504 | error = -EFAULT; |
2506 | if (copy_to_user(uoss, &oss, sizeof(oss))) | 2505 | if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) |
2507 | goto out; | 2506 | goto out; |
2507 | error = __put_user(oss.ss_sp, &uoss->ss_sp) | | ||
2508 | __put_user(oss.ss_size, &uoss->ss_size) | | ||
2509 | __put_user(oss.ss_flags, &uoss->ss_flags); | ||
2508 | } | 2510 | } |
2509 | 2511 | ||
2510 | error = 0; | ||
2511 | out: | 2512 | out: |
2512 | return error; | 2513 | return error; |
2513 | } | 2514 | } |