Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5fcc57f2d5d558056668159f9153bf21d2c53d16
Commit:     5fcc57f2d5d558056668159f9153bf21d2c53d16
Parent:     a076e4bca2fdabb9e45d86722cc72c0944da5f94
Author:     Gautham R Shenoy <[EMAIL PROTECTED]>
AuthorDate: Wed May 23 13:57:28 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 23 20:14:11 2007 -0700

    freezer: fix PF_NOFREEZE vs freezeable race
    
    This patch fixes the race pointed out by Oleg Nesterov.
    
    * Freezer marks a thread as freezeable.
    * The thread now marks itself PF_NOFREEZE, but it will be frozen on
      on calling try_to_freeze(). Thus the task is frozen, even though it 
doesn't
      want to.
    * Subsequent thaw_processes() will also fail to thaw the task since it is
      marked PF_NOFREEZE.
    
    Avoid this problem by checking the task's PF_NOFREEZE status in
    frozen_processes() before marking the task as frozen.
    
    Signed-off-by: Gautham R Shenoy <[EMAIL PROTECTED]>
    Signed-off-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
    Cc: Oleg Nesterov <[EMAIL PROTECTED]>
    Cc: Pavel Machek <[EMAIL PROTECTED]>
    Cc: "Eric W. Biederman" <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/linux/freezer.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index c943525..1045ee9 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -63,8 +63,10 @@ static inline int thaw_process(struct task_struct *p)
  */
 static inline void frozen_process(struct task_struct *p)
 {
-       p->flags |= PF_FROZEN;
-       wmb();
+       if (!unlikely(p->flags & PF_NOFREEZE)) {
+               p->flags |= PF_FROZEN;
+               wmb();
+       }
        clear_tsk_thread_flag(p, TIF_FREEZE);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to