From: Naveen N. Rao Date: Fri, 6 Jul 2012 01:30:58 +0000 (+0000) Subject: powerpc/hw_breakpoints: Fix incorrect pointer access X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ac84aa2b3b9b791eac45174d1966d5fdf3bbba1c;p=linux-beck.git powerpc/hw_breakpoints: Fix incorrect pointer access 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 Signed-off-by: Naveen N. Rao Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index 2bc0584be81c..f3a82dde61db 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; }