* [PATCH 1/2] arm64: perf: Don't use of_node after putting it
@ 2015-06-03 20:53 Stephen Boyd
2015-06-03 20:53 ` [PATCH 2/2] arm: " Stephen Boyd
2015-06-05 14:45 ` [PATCH 1/2] arm64: " Will Deacon
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Boyd @ 2015-06-03 20:53 UTC (permalink / raw)
To: linux-arm-kernel
It's possible, albeit unlikely, that using the of_node here will
reference freed memory. Call of_node_put() after printing the
name to be safe.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
arch/arm64/kernel/perf_event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 702591f6180a..8af7784a8e35 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1340,12 +1340,13 @@ static int armpmu_device_probe(struct platform_device *pdev)
if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
break;
- of_node_put(dn);
if (cpu >= nr_cpu_ids) {
pr_warn("Failed to find logical CPU for %s\n",
dn->name);
+ of_node_put(dn);
break;
}
+ of_node_put(dn);
irqs[i] = cpu;
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] arm: perf: Don't use of_node after putting it
2015-06-03 20:53 [PATCH 1/2] arm64: perf: Don't use of_node after putting it Stephen Boyd
@ 2015-06-03 20:53 ` Stephen Boyd
2015-06-05 14:45 ` [PATCH 1/2] arm64: " Will Deacon
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2015-06-03 20:53 UTC (permalink / raw)
To: linux-arm-kernel
It's possible, albeit unlikely, that using the of_node here will
reference freed memory. Call of_node_put() after printing the
name to be safe.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
arch/arm/kernel/perf_event.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 357f57ea83f4..54272e0be713 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -818,12 +818,13 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
break;
- of_node_put(dn);
if (cpu >= nr_cpu_ids) {
pr_warn("Failed to find logical CPU for %s\n",
dn->name);
+ of_node_put(dn);
break;
}
+ of_node_put(dn);
irqs[i] = cpu;
cpumask_set_cpu(cpu, &pmu->supported_cpus);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/2] arm64: perf: Don't use of_node after putting it
2015-06-03 20:53 [PATCH 1/2] arm64: perf: Don't use of_node after putting it Stephen Boyd
2015-06-03 20:53 ` [PATCH 2/2] arm: " Stephen Boyd
@ 2015-06-05 14:45 ` Will Deacon
2015-06-05 18:53 ` Stephen Boyd
1 sibling, 1 reply; 4+ messages in thread
From: Will Deacon @ 2015-06-05 14:45 UTC (permalink / raw)
To: linux-arm-kernel
Hi Stephen,
On Wed, Jun 03, 2015 at 09:53:37PM +0100, Stephen Boyd wrote:
> It's possible, albeit unlikely, that using the of_node here will
> reference freed memory. Call of_node_put() after printing the
> name to be safe.
>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
> arch/arm64/kernel/perf_event.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> index 702591f6180a..8af7784a8e35 100644
> --- a/arch/arm64/kernel/perf_event.c
> +++ b/arch/arm64/kernel/perf_event.c
> @@ -1340,12 +1340,13 @@ static int armpmu_device_probe(struct platform_device *pdev)
> if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
> break;
>
> - of_node_put(dn);
> if (cpu >= nr_cpu_ids) {
> pr_warn("Failed to find logical CPU for %s\n",
> dn->name);
> + of_node_put(dn);
> break;
> }
> + of_node_put(dn);
>
> irqs[i] = cpu;
> }
Yeah, I agree this needs changing but given (a) the CPU node isn't going
to disappear and (b) this patch will conflict horribly with my queue for
4.2, do you mind if I sit on this until after the merge window (as a fix
for 4.2)?
Will
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] arm64: perf: Don't use of_node after putting it
2015-06-05 14:45 ` [PATCH 1/2] arm64: " Will Deacon
@ 2015-06-05 18:53 ` Stephen Boyd
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2015-06-05 18:53 UTC (permalink / raw)
To: linux-arm-kernel
On 06/05/2015 07:45 AM, Will Deacon wrote:
> On Wed, Jun 03, 2015 at 09:53:37PM +0100, Stephen Boyd wrote:
>> arch/arm64/kernel/perf_event.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
>> index 702591f6180a..8af7784a8e35 100644
>> --- a/arch/arm64/kernel/perf_event.c
>> +++ b/arch/arm64/kernel/perf_event.c
>> @@ -1340,12 +1340,13 @@ static int armpmu_device_probe(struct platform_device *pdev)
>> if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
>> break;
>>
>> - of_node_put(dn);
>> if (cpu >= nr_cpu_ids) {
>> pr_warn("Failed to find logical CPU for %s\n",
>> dn->name);
>> + of_node_put(dn);
>> break;
>> }
>> + of_node_put(dn);
>>
>> irqs[i] = cpu;
>> }
> Yeah, I agree this needs changing but given (a) the CPU node isn't going
> to disappear and (b) this patch will conflict horribly with my queue for
> 4.2, do you mind if I sit on this until after the merge window (as a fix
> for 4.2)?
>
>
Sure, no problem.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-05 18:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03 20:53 [PATCH 1/2] arm64: perf: Don't use of_node after putting it Stephen Boyd
2015-06-03 20:53 ` [PATCH 2/2] arm: " Stephen Boyd
2015-06-05 14:45 ` [PATCH 1/2] arm64: " Will Deacon
2015-06-05 18:53 ` Stephen Boyd
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).