aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/kprobes.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2008-01-18 11:20:46 -0500
committerTony Luck <tony.luck@intel.com>2008-02-04 18:09:39 -0500
commit97075c4b3b7fdd6a083eea075c3a4a601f0d64d8 (patch)
tree300e612c7810901e721c594846d8ad2bfaf60a7c /arch/ia64/kernel/kprobes.c
parenta23fe55e132cd85108ab55b3fafb4b5060d847c7 (diff)
[IA64] Fix the order of atomic operations in restore_previous_kprobes on ia64
Fix the order of atomic operations to prevent overwriting prev_kprobe[0]. To pop values from stack, we must decrement stack index right AFTER reading values. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/kprobes.c')
-rw-r--r--arch/ia64/kernel/kprobes.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index fc4d2676264f..b618487cdc85 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -381,9 +381,10 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
381static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) 381static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
382{ 382{
383 unsigned int i; 383 unsigned int i;
384 i = atomic_sub_return(1, &kcb->prev_kprobe_index); 384 i = atomic_read(&kcb->prev_kprobe_index);
385 __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i].kp; 385 __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i-1].kp;
386 kcb->kprobe_status = kcb->prev_kprobe[i].status; 386 kcb->kprobe_status = kcb->prev_kprobe[i-1].status;
387 atomic_sub(1, &kcb->prev_kprobe_index);
387} 388}
388 389
389static void __kprobes set_current_kprobe(struct kprobe *p, 390static void __kprobes set_current_kprobe(struct kprobe *p,