From: Fabian Frederick Date: Fri, 20 Feb 2015 18:12:53 +0000 (+0100) Subject: powerpc/pmac: replace current->state by set_current_state() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=111fbc68fd895ba437bcb03d5dcc4dd21bc61df8;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git powerpc/pmac: replace current->state by set_current_state() Use helper functions to access current->state. Direct assignments are prone to races and therefore buggy. current->state = TASK_RUNNING can be replaced by __set_current_state() Thanks to Peter Zijlstra for the exact definition of the problem. Suggested-By: Peter Zijlstra Signed-off-by: Fabian Frederick Signed-off-by: Benjamin Herrenschmidt --- diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index aed3cb07a6fa..f9512bfa6c3c 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -2112,7 +2112,7 @@ pmu_read(struct file *file, char __user *buf, spin_lock_irqsave(&pp->lock, flags); add_wait_queue(&pp->wait, &wait); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); for (;;) { ret = -EAGAIN; @@ -2141,7 +2141,7 @@ pmu_read(struct file *file, char __user *buf, schedule(); spin_lock_irqsave(&pp->lock, flags); } - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue(&pp->wait, &wait); spin_unlock_irqrestore(&pp->lock, flags);