Due to typo, utrace_attach_delay() always succeeds if the caller
is not traced. The creator must have the valid ->utrace != NULL
and utrace->cloning should be target.

Signed-off-by: Oleg Nesterov <o...@redhat.com>
---

 kernel/utrace.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

--- UTRACE-PTRACE/kernel/utrace.c~2_ATTACH_DELAY_TYPO   2009-12-05 
16:02:50.000000000 +0100
+++ UTRACE-PTRACE/kernel/utrace.c       2009-12-12 16:49:26.000000000 +0100
@@ -184,14 +184,18 @@ static struct utrace_engine *matching_en
  */
 static inline int utrace_attach_delay(struct task_struct *target)
 {
-       if ((target->flags & PF_STARTING) &&
-           task_utrace_struct(current) &&
-           task_utrace_struct(current)->cloning != target)
-               do {
-                       schedule_timeout_interruptible(1);
-                       if (signal_pending(current))
-                               return -ERESTARTNOINTR;
-               } while (target->flags & PF_STARTING);
+       if (!unlikely(target->flags & PF_STARTING))
+               return 0;
+
+       if (task_utrace_struct(current) &&
+           task_utrace_struct(current)->cloning == target)
+               return 0;
+
+       do {
+               schedule_timeout_interruptible(1);
+               if (signal_pending(current))
+                       return -ERESTARTNOINTR;
+       } while (target->flags & PF_STARTING);
 
        return 0;
 }

Reply via email to