diff options
author | Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> | 2012-07-05 21:30:58 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-07-11 00:20:20 -0400 |
commit | ac84aa2b3b9b791eac45174d1966d5fdf3bbba1c (patch) | |
tree | ae7fae6ae9aced79d6bb2e9a30a36cd0920a17bf | |
parent | 1d5a436d2ce9d1b65c905f69a33e78d69245993e (diff) |
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 <emachado@linux.vnet.ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/hw_breakpoint.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
111 | * and the single_step_dabr_instruction(), then cleanup the breakpoint | 111 | * and the single_step_dabr_instruction(), then cleanup the breakpoint |
112 | * restoration variables to prevent dangling pointers. | 112 | * restoration variables to prevent dangling pointers. |
113 | */ | 113 | */ |
114 | if (bp->ctx->task) | 114 | if (bp->ctx && bp->ctx->task) |
115 | bp->ctx->task->thread.last_hit_ubp = NULL; | 115 | bp->ctx->task->thread.last_hit_ubp = NULL; |
116 | } | 116 | } |
117 | 117 | ||