ptrace_notify_stop() forgets to put engine.

Also, move WARN_ON() into do_ptrace_notify_stop().

---

 kernel/ptrace.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

--- PU/kernel/ptrace.c~80_FIX_ENGINE_LEAK       2009-10-10 17:09:34.000000000 
+0200
+++ PU/kernel/ptrace.c  2009-10-10 17:10:07.000000000 +0200
@@ -859,6 +859,8 @@ static void do_ptrace_notify_stop(struct
                                        struct task_struct *tracee)
 {
        tracee->exit_code = context->stop_code & PTRACE_EVENT_MASK;
+       if (WARN_ON(!tracee->exit_code))
+               return;
 
        read_lock(&tasklist_lock);
        /*
@@ -876,7 +878,6 @@ static void do_ptrace_notify_stop(struct
 void ptrace_notify_stop(struct task_struct *tracee)
 {
        struct utrace_engine *engine = ptrace_lookup_engine(tracee);
-       struct ptrace_context *context;
 
        if (IS_ERR(engine)) {
                // XXX: temporary check, wrong with mutlitracing
@@ -884,10 +885,8 @@ void ptrace_notify_stop(struct task_stru
                return;
        }
 
-       context = ptrace_context(engine);
-       if (WARN_ON(!ptrace_event_pending(context)))
-               return;
-       do_ptrace_notify_stop(context, tracee);
+       do_ptrace_notify_stop(ptrace_context(engine), tracee);
+       utrace_engine_put(engine);
 }
 
 static void ptrace_wake_up(struct utrace_engine *engine,

Reply via email to