diff mbox

[1/3] ARM: perf: Check that current->mm is alive before getting user callchain

Message ID 1403881067-22690-2-git-send-email-jean.pihet@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jean Pihet June 27, 2014, 2:57 p.m. UTC
An event may occur when an mm is already released.

As per commit 20afc60f892d285fde179ead4b24e6a7938c2f1b
 'x86, perf: Check that current->mm is alive before getting user callchain'

Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm/kernel/perf_event.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Will Deacon July 3, 2014, 5:53 p.m. UTC | #1
On Fri, Jun 27, 2014 at 03:57:45PM +0100, Jean Pihet wrote:
> An event may occur when an mm is already released.
> 
> As per commit 20afc60f892d285fde179ead4b24e6a7938c2f1b
>  'x86, perf: Check that current->mm is alive before getting user callchain'
> 
> Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
> Cc: Will Deacon <will.deacon@arm.com>
> ---

Acked-by: Will Deacon <will.deacon@arm.com>

>  arch/arm/kernel/perf_event.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> index 4238bcb..6493c4c 100644
> --- a/arch/arm/kernel/perf_event.c
> +++ b/arch/arm/kernel/perf_event.c
> @@ -590,6 +590,10 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
>  	}
>  
>  	perf_callchain_store(entry, regs->ARM_pc);
> +
> +	if (!current->mm)
> +		return;
> +
>  	tail = (struct frame_tail __user *)regs->ARM_fp - 1;
>  
>  	while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
> -- 
> 1.8.1.2
> 
>
diff mbox

Patch

diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 4238bcb..6493c4c 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -590,6 +590,10 @@  perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
 	}
 
 	perf_callchain_store(entry, regs->ARM_pc);
+
+	if (!current->mm)
+		return;
+
 	tail = (struct frame_tail __user *)regs->ARM_fp - 1;
 
 	while ((entry->nr < PERF_MAX_STACK_DEPTH) &&