diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2005-09-29 00:06:47 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-09-29 00:06:47 -0400 |
commit | efdc1e2083e04cc70721d55803889b346c1a3de2 (patch) | |
tree | 9f24fab33f795a69bb2dc43a8f3613392762ff02 /arch/sparc64/mm | |
parent | 5fd29752f09cabff582f65c0ce35518db4c64937 (diff) |
[SPARC64]: Simplify user fault fixup handling.
Instead of doing byte-at-a-time user accesses to figure
out where the fault occurred, read the saved fault_address
from the current thread structure.
For the sake of defensive programming, if the fault_address
does not fall into the user buffer range, simply assume the
whole area faulted. This will cause the fixup for
copy_from_user() to clear the entire kernel side buffer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/mm')
-rw-r--r-- | arch/sparc64/mm/fault.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 59dc9a2ece5a..4a52e79d515f 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c | |||
@@ -457,7 +457,7 @@ good_area: | |||
457 | } | 457 | } |
458 | 458 | ||
459 | up_read(&mm->mmap_sem); | 459 | up_read(&mm->mmap_sem); |
460 | goto fault_done; | 460 | return; |
461 | 461 | ||
462 | /* | 462 | /* |
463 | * Something tried to access memory that isn't in our memory map.. | 463 | * Something tried to access memory that isn't in our memory map.. |
@@ -469,8 +469,7 @@ bad_area: | |||
469 | 469 | ||
470 | handle_kernel_fault: | 470 | handle_kernel_fault: |
471 | do_kernel_fault(regs, si_code, fault_code, insn, address); | 471 | do_kernel_fault(regs, si_code, fault_code, insn, address); |
472 | 472 | return; | |
473 | goto fault_done; | ||
474 | 473 | ||
475 | /* | 474 | /* |
476 | * We ran out of memory, or some other thing happened to us that made | 475 | * We ran out of memory, or some other thing happened to us that made |
@@ -501,9 +500,4 @@ do_sigbus: | |||
501 | /* Kernel mode? Handle exceptions or die */ | 500 | /* Kernel mode? Handle exceptions or die */ |
502 | if (regs->tstate & TSTATE_PRIV) | 501 | if (regs->tstate & TSTATE_PRIV) |
503 | goto handle_kernel_fault; | 502 | goto handle_kernel_fault; |
504 | |||
505 | fault_done: | ||
506 | /* These values are no longer needed, clear them. */ | ||
507 | set_thread_fault_code(0); | ||
508 | current_thread_info()->fault_address = 0; | ||
509 | } | 503 | } |