Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1382364 > unrolled thread

[PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup

Started byKautuk Consul <kautuk.consul.1980@gmail.com>
First post2016-04-19 12:20 +0200
Last post2016-04-19 12:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup Kautuk Consul <kautuk.consul.1980@gmail.com> - 2016-04-19 12:20 +0200

#1382364 — [PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup

FromKautuk Consul <kautuk.consul.1980@gmail.com>
Date2016-04-19 12:20 +0200
Subject[PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup
Message-ID<rpAVc-5ed-7@gated-at.bofh.it>
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>
---
 arch/powerpc/kernel/process.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index b8500b4..f233352 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1785,7 +1785,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];
-- 
1.7.9.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web