linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup
@ 2016-04-19 10:18 Kautuk Consul
  2017-10-08  8:43 ` [1/1] " Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Kautuk Consul @ 2016-04-19 10:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Anton Blanchard, Cyril Bur, Michael Neuling, Anshuman Khandual
  Cc: linuxppc-dev, linux-kernel, Kautuk Consul

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup
  2016-04-19 10:18 [PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup Kautuk Consul
@ 2017-10-08  8:43 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-10-08  8:43 UTC (permalink / raw)
  To: Kautuk Consul, Benjamin Herrenschmidt, Paul Mackerras,
	Anton Blanchard, Cyril Bur, Michael Neuling, Anshuman Khandual
  Cc: linuxppc-dev, linux-kernel, Kautuk Consul

On Tue, 2016-04-19 at 10:18:21 UTC, Kautuk Consul wrote:
> 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>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/4ca360f3dbf2036d964cdf3a6c4a45

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-08  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-19 10:18 [PATCH 1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup Kautuk Consul
2017-10-08  8:43 ` [1/1] " Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).