diff options
author | Tony Luck <tony.luck@intel.com> | 2012-05-16 16:58:29 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2012-05-16 16:58:29 -0400 |
commit | 7411d89535ce803404678eaf7e2f7ce095cf46b2 (patch) | |
tree | 98341b09e8e1a24639c1cb47f8e332b5811ba2ce /arch/ia64/kernel | |
parent | c7173271f3f63738e7ec5a2f074472c5feed3518 (diff) |
[IA64] Fix fast syscall version of getcpu()
GETCPU(2) says:
int getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache);
...
When either cpu or node is NULL nothing is written to the respective pointer.
But the fast system call path had no checks for NULL, and would
thus return -EFAULT if either (or both) of these were NULL.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel')
-rw-r--r-- | arch/ia64/kernel/fsys.S | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index cc26edac0ec6..e2dfae24c0f4 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S | |||
@@ -559,11 +559,15 @@ ENTRY(fsys_getcpu) | |||
559 | ;; | 559 | ;; |
560 | tnat.nz p7,p0 = r33 // I guard against NaT argument | 560 | tnat.nz p7,p0 = r33 // I guard against NaT argument |
561 | (p7) br.cond.spnt.few .fail_einval // B | 561 | (p7) br.cond.spnt.few .fail_einval // B |
562 | ;; | ||
563 | cmp.ne p6,p0=r32,r0 | ||
564 | cmp.ne p7,p0=r33,r0 | ||
565 | ;; | ||
562 | #ifdef CONFIG_NUMA | 566 | #ifdef CONFIG_NUMA |
563 | movl r17=cpu_to_node_map | 567 | movl r17=cpu_to_node_map |
564 | ;; | 568 | ;; |
565 | EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles | 569 | EX(.fail_efault, (p6) probe.w.fault r32, 3) // M This takes 5 cycles |
566 | EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles | 570 | EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles |
567 | shladd r18=r3,1,r17 | 571 | shladd r18=r3,1,r17 |
568 | ;; | 572 | ;; |
569 | ld2 r20=[r18] // r20 = cpu_to_node_map[cpu] | 573 | ld2 r20=[r18] // r20 = cpu_to_node_map[cpu] |
@@ -573,20 +577,20 @@ EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles | |||
573 | (p8) br.spnt.many fsys_fallback_syscall | 577 | (p8) br.spnt.many fsys_fallback_syscall |
574 | ;; | 578 | ;; |
575 | ;; | 579 | ;; |
576 | EX(.fail_efault, st4 [r32] = r3) | 580 | EX(.fail_efault, (p6) st4 [r32] = r3) |
577 | EX(.fail_efault, st2 [r33] = r20) | 581 | EX(.fail_efault, (p7) st2 [r33] = r20) |
578 | mov r8=0 | 582 | mov r8=0 |
579 | ;; | 583 | ;; |
580 | #else | 584 | #else |
581 | EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles | 585 | EX(.fail_efault, (p6) probe.w.fault r32, 3) // M This takes 5 cycles |
582 | EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles | 586 | EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles |
583 | and r2 = TIF_ALLWORK_MASK,r2 | 587 | and r2 = TIF_ALLWORK_MASK,r2 |
584 | ;; | 588 | ;; |
585 | cmp.ne p8,p0=0,r2 | 589 | cmp.ne p8,p0=0,r2 |
586 | (p8) br.spnt.many fsys_fallback_syscall | 590 | (p8) br.spnt.many fsys_fallback_syscall |
587 | ;; | 591 | ;; |
588 | EX(.fail_efault, st4 [r32] = r3) | 592 | EX(.fail_efault, (p6) st4 [r32] = r3) |
589 | EX(.fail_efault, st2 [r33] = r0) | 593 | EX(.fail_efault, (p7) st2 [r33] = r0) |
590 | mov r8=0 | 594 | mov r8=0 |
591 | ;; | 595 | ;; |
592 | #endif | 596 | #endif |