diff options
author | Kautuk Consul <kautuk.consul.1980@gmail.com> | 2016-04-19 15:48:21 +0530 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-10-06 20:51:52 +1100 |
commit | 4ca360f3dbf2036d964cdf3a6c4a45a81fdf8e18 (patch) | |
tree | 410ee4122e075d177af46e049efa823b6b9f02b9 /arch/powerpc/kernel | |
parent | 06755a871314c7443a89c09650cdb3982466e1a8 (diff) | |
download | op-kernel-dev-4ca360f3dbf2036d964cdf3a6c4a45a81fdf8e18.zip op-kernel-dev-4ca360f3dbf2036d964cdf3a6c4a45a81fdf8e18.tar.gz |
powerpc: get_wchan(): solve possible race scenario due to parallel wakeup
Add a check for p->state == TASK_RUNNING so that any wake-ups on
task_struct p in the interim lead to 0 being returned by get_wchan().
Signed-off-by: Kautuk Consul <kautuk.consul.1980@gmail.com>
[mpe: Confirmed other architectures do similar]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/process.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index a0c74bb..166145b 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1898,7 +1898,8 @@ unsigned long get_wchan(struct task_struct *p) do { sp = *(unsigned long *)sp; - if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD)) + if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD) || + p->state == TASK_RUNNING) return 0; if (count > 0) { ip = ((unsigned long *)sp)[STACK_FRAME_LR_SAVE]; |