lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260126033029.7923-2-baisheng.gao@unisoc.com>
Date: Mon, 26 Jan 2026 11:30:28 +0800
From: Baisheng Gao <baisheng.gao@...soc.com>
To: Robin Murphy <robin.murphy@....com>, Will Deacon <will@...nel.org>,
        Mark
 Rutland <mark.rutland@....com>, Rob Herring <robh@...nel.org>,
        Krzysztof
 Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>
CC: <cixi.geng@...ux.dev>, <hao_hao.wang@...soc.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <devicetree@...r.kernel.org>
Subject: [PATCH 1/2] perf/arm-ni: Don't crash in probing clock domains without a PMU instance

The NULL pmusela pointer implies that current clock domain doesn't have
a PMU instance. Return 0 for probing the next clock domain. Otherwise a
kernel crash will happen.

Signed-off-by: Baisheng Gao <baisheng.gao@...soc.com>
---
 drivers/perf/arm-ni.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c
index 66858c65215d..53b656983da1 100644
--- a/drivers/perf/arm-ni.c
+++ b/drivers/perf/arm-ni.c
@@ -526,6 +526,7 @@ static int arm_ni_init_cd(struct arm_ni *ni, struct arm_ni_node *node, u64 res_s
 {
 	struct arm_ni_cd *cd = ni->cds + node->id;
 	const char *name;
+	static atomic_t id;
 
 	cd->id = node->id;
 	cd->num_units = node->num_components;
@@ -562,6 +563,11 @@ static int arm_ni_init_cd(struct arm_ni *ni, struct arm_ni_node *node, u64 res_s
 		case NI_TMNI:
 		case NI_CMNI:
 			unit->pmusela = arm_ni_get_pmusel(ni, unit_base);
+			if (!unit->pmusela) {
+				dev_info(ni->dev, "No have PMU %d\n", cd->id);
+				devm_kfree(ni->dev, cd->units);
+				return 0;
+			}
 			writel_relaxed(1, unit->pmusela);
 			if (readl_relaxed(unit->pmusela) != 1)
 				dev_info(ni->dev, "No access to node 0x%04x%04x\n", unit->id, unit->type);
@@ -591,7 +597,7 @@ static int arm_ni_init_cd(struct arm_ni *ni, struct arm_ni_node *node, u64 res_s
 	writel_relaxed(U32_MAX, cd->pmu_base + NI_PMCNTENCLR);
 	writel_relaxed(U32_MAX, cd->pmu_base + NI_PMOVSCLR);
 
-	cd->irq = platform_get_irq(to_platform_device(ni->dev), cd->id);
+	cd->irq = platform_get_irq(to_platform_device(ni->dev), atomic_fetch_inc(&id));
 	if (cd->irq < 0)
 		return cd->irq;
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ