The patch titled
     ia64: fix the order of atomic operations in restore_previous_kprobes()
has been added to the -mm tree.  Its filename is
     ia64-fix-the-order-of-atomic-operations-in-restore_previous_kprobes.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: ia64: fix the order of atomic operations in restore_previous_kprobes()
From: Masami Hiramatsu <[EMAIL PROTECTED]>

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.

Details of this issue was reported to
http://sources.redhat.com/bugzilla/show_bug.cgi?id=2071

Signed-off-by: Masami Hiramatsu <[EMAIL PROTECTED]>
Acked-by: Shaohua Li <[EMAIL PROTECTED]>
Cc: "Luck, Tony" <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 arch/ia64/kernel/kprobes.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -puN 
arch/ia64/kernel/kprobes.c~ia64-fix-the-order-of-atomic-operations-in-restore_previous_kprobes
 arch/ia64/kernel/kprobes.c
--- 
a/arch/ia64/kernel/kprobes.c~ia64-fix-the-order-of-atomic-operations-in-restore_previous_kprobes
+++ a/arch/ia64/kernel/kprobes.c
@@ -381,9 +381,10 @@ static void __kprobes save_previous_kpro
 static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
 {
        unsigned int i;
-       i = atomic_sub_return(1, &kcb->prev_kprobe_index);
-       __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i].kp;
-       kcb->kprobe_status = kcb->prev_kprobe[i].status;
+       i = atomic_read(&kcb->prev_kprobe_index);
+       __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i-1].kp;
+       kcb->kprobe_status = kcb->prev_kprobe[i-1].status;
+       atomic_sub(1, &kcb->prev_kprobe_index);
 }
 
 static void __kprobes set_current_kprobe(struct kprobe *p,
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

ia64-fix-the-order-of-atomic-operations-in-restore_previous_kprobes.patch
git-x86.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to