All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/spufs: Fix coredump of SPU contexts
@ 2017-05-29 10:26 Michael Ellerman
  2017-05-29 10:35 ` Jeremy Kerr
  2017-06-01 13:31 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-05-29 10:26 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: jk, viro

If a process dumps core while it has SPU contexts active then we have
code to also dump information about the SPU contexts.

Unfortunately it's been broken for 3 1/2 years, and we didn't notice. In
commit 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers") the nread
variable was removed and rc used instead. That means when the loop exits
successfully, rc has the number of bytes read, but it's then used as the
return value for the function, which should return 0 on success.

So fix it by setting rc = 0 before returning in the success case.

Fixes: 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/platforms/cell/spufs/coredump.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index e5a891ae80ee..84b7ac926ce6 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -175,6 +175,8 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i,
 	skip = roundup(cprm->pos - total + sz, 4) - cprm->pos;
 	if (!dump_skip(cprm, skip))
 		goto Eio;
+
+	rc = 0;
 out:
 	free_page((unsigned long)buf);
 	return rc;
-- 
2.7.4

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

* Re: [PATCH] powerpc/spufs: Fix coredump of SPU contexts
  2017-05-29 10:26 [PATCH] powerpc/spufs: Fix coredump of SPU contexts Michael Ellerman
@ 2017-05-29 10:35 ` Jeremy Kerr
  2017-06-01 13:31 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Kerr @ 2017-05-29 10:35 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: viro

Hi Michael,

> So fix it by setting rc = 0 before returning in the success case.
> 
> Fixes: 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Looks good to me, thanks.

Acked-by: Jeremy Kerr <jk@ozlabs.org>

Cheers,


Jeremy

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

* Re: powerpc/spufs: Fix coredump of SPU contexts
  2017-05-29 10:26 [PATCH] powerpc/spufs: Fix coredump of SPU contexts Michael Ellerman
  2017-05-29 10:35 ` Jeremy Kerr
@ 2017-06-01 13:31 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-06-01 13:31 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: jk, viro

On Mon, 2017-05-29 at 10:26:07 UTC, Michael Ellerman wrote:
> If a process dumps core while it has SPU contexts active then we have
> code to also dump information about the SPU contexts.
> 
> Unfortunately it's been broken for 3 1/2 years, and we didn't notice. In
> commit 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers") the nread
> variable was removed and rc used instead. That means when the loop exits
> successfully, rc has the number of bytes read, but it's then used as the
> return value for the function, which should return 0 on success.
> 
> So fix it by setting rc = 0 before returning in the success case.
> 
> Fixes: 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Acked-by: Jeremy Kerr <jk@ozlabs.org>

Applied to powerpc fixes.

https://git.kernel.org/powerpc/c/99acc9bede06bbb2662aafff51f5b9

cheers

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

end of thread, other threads:[~2017-06-01 13:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-29 10:26 [PATCH] powerpc/spufs: Fix coredump of SPU contexts Michael Ellerman
2017-05-29 10:35 ` Jeremy Kerr
2017-06-01 13:31 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.