include/linux/freezer.h | 4 ++++ kernel/power/process.c | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) Index: linux-2.6.20-mm2/include/linux/freezer.h =================================================================== --- linux-2.6.20-mm2.orig/include/linux/freezer.h +++ linux-2.6.20-mm2/include/linux/freezer.h @@ -40,11 +40,15 @@ static inline void do_not_freeze(struct */ static inline int thaw_process(struct task_struct *p) { + task_lock(p); if (frozen(p)) { p->flags &= ~PF_FROZEN; + task_unlock(p); wake_up_process(p); return 1; } + clear_tsk_thread_flag(p, TIF_FREEZE); + task_unlock(p); return 0; } Index: linux-2.6.20-mm2/kernel/power/process.c =================================================================== --- linux-2.6.20-mm2.orig/kernel/power/process.c +++ linux-2.6.20-mm2/kernel/power/process.c @@ -39,10 +39,18 @@ void refrigerator(void) /* Hmm, should we be allowed to suspend when there are realtime processes around? */ long save; + + task_lock(current); + if (freezing(current)) { + frozen_process(current); + task_unlock(current); + } else { + task_unlock(current); + return; + } save = current->state; pr_debug("%s entered refrigerator\n", current->comm); - frozen_process(current); spin_lock_irq(¤t->sighand->siglock); recalc_sigpending(); /* We sent fake signal, clean it up */ spin_unlock_irq(¤t->sighand->siglock); @@ -79,12 +87,16 @@ static void cancel_freezing(struct task_ { unsigned long flags; + task_lock(p); if (freezing(p)) { pr_debug(" clean up: %s\n", p->comm); do_not_freeze(p); + task_unlock(p); spin_lock_irqsave(&p->sighand->siglock, flags); recalc_sigpending_tsk(p); spin_unlock_irqrestore(&p->sighand->siglock, flags); + } else { + task_unlock(p); } }