linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PPC Hardware Breakpoints: Fix incorrect pointer access
@ 2012-07-06 11:30 Naveen N. Rao
  2012-07-18 10:38 ` [PATCH RESEND] " Naveen N. Rao
  0 siblings, 1 reply; 2+ messages in thread
From: Naveen N. Rao @ 2012-07-06 11:30 UTC (permalink / raw)
  To: fweisbec, benh, paulus, prasad.krishnan
  Cc: linuxppc-dev, linux-kernel, emachado

If arch_validate_hwbkpt_settings() fails, bp->ctx won't be valid and the
kernel panics. Add a check to fix this.

Reported-by: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/hw_breakpoint.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 2bc0584..f3a82dd 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -111,7 +111,7 @@ void arch_unregister_hw_breakpoint(struct perf_event *bp)
 	 * and the single_step_dabr_instruction(), then cleanup the breakpoint
 	 * restoration variables to prevent dangling pointers.
 	 */
-	if (bp->ctx->task)
+	if (bp->ctx && bp->ctx->task)
 		bp->ctx->task->thread.last_hit_ubp = NULL;
 }
 

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

* [PATCH RESEND] PPC Hardware Breakpoints: Fix incorrect pointer access
  2012-07-06 11:30 [PATCH] PPC Hardware Breakpoints: Fix incorrect pointer access Naveen N. Rao
@ 2012-07-18 10:38 ` Naveen N. Rao
  0 siblings, 0 replies; 2+ messages in thread
From: Naveen N. Rao @ 2012-07-18 10:38 UTC (permalink / raw)
  To: fweisbec, benh, paulus, prasad.krishnan
  Cc: linuxppc-dev, linux-kernel, emachado

If arch_validate_hwbkpt_settings() fails, bp->ctx won't be valid and the
kernel panics. Add a check to fix this.

Reported-by: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/hw_breakpoint.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 2bc0584..f3a82dd 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -111,7 +111,7 @@ void arch_unregister_hw_breakpoint(struct perf_event *bp)
 	 * and the single_step_dabr_instruction(), then cleanup the breakpoint
 	 * restoration variables to prevent dangling pointers.
 	 */
-	if (bp->ctx->task)
+	if (bp->ctx && bp->ctx->task)
 		bp->ctx->task->thread.last_hit_ubp = NULL;
 }
 

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

end of thread, other threads:[~2012-07-18 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 11:30 [PATCH] PPC Hardware Breakpoints: Fix incorrect pointer access Naveen N. Rao
2012-07-18 10:38 ` [PATCH RESEND] " Naveen N. Rao

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).