[PATCH 02/23] arm_mpam: Fix NULL address access issue
Fenghua Yu
fenghuay at nvidia.com
Thu Jul 16 14:02:52 PDT 2026
mpam_resctrl_setup() initializes each resource's mon_domains list but
not controls. mpam_resctrl_controls[] is statically allocated, so the
controls list heads are zero-initialized rather than empty lists.
Generic resctrl walks controls with for_each_resource_ctrl(), which
dereferences through the list head's next pointer and can hit NULL on
resources that have no controls yet (for example dummy resources whose
class is unset).
Match the existing mon_domains initialization and initialize controls
with INIT_LIST_HEAD() before any resctrl setup path can walk the list.
x86 resctrl uses LIST_HEAD_INIT() at compile time for the same reason.
Signed-off-by: Fenghua Yu <fenghuay at nvidia.com>
---
drivers/resctrl/mpam_resctrl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 68b94008d38e..e2cb3384820a 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1942,6 +1942,7 @@ int mpam_resctrl_setup(void)
cpus_read_lock();
for_each_mpam_resctrl_control(res, rid) {
+ INIT_LIST_HEAD(&res->resctrl_res.controls);
INIT_LIST_HEAD_RCU(&res->resctrl_res.mon_domains);
res->resctrl_res.rid = rid;
}
--
2.43.0
More information about the linux-arm-kernel
mailing list