linux/drivers/resctrl
James Morse 6ccbb613b4 arm_mpam: Check whether the config array is allocated before destroying it
__destroy_component_cfg() is called to free the configuration array.
It uses the embedded 'garbage' structure, which means the array has
to be allocated.

If __destroy_component_cfg() is called from mpam_disable() before the
configuration was ever allocated, then a NULL pointer is dereferenced.

Check for this case and return early if the configuration is not
allocated.

__destroy_component_cfg() also frees the mbwu_state as this is allocated
by __allocate_component_cfg(). As the mbwu_state is allocated after
comp->cfg is set, and is also under mpam_list_lock, only the first
pointer needs checking.

Fixes: 3bd04fe7d8 ("arm_mpam: Extend reset logic to allow devices to be reset any time")
Cc: <stable@vger.kernel.org>
Signed-off-by: James Morse <james.morse@arm.com>
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2026-05-14 09:52:05 +01:00
..
Kconfig arm64: mpam: Select ARCH_HAS_CPU_RESCTRL 2026-03-27 15:32:11 +00:00
Makefile arm64: mpam: Select ARCH_HAS_CPU_RESCTRL 2026-03-27 15:32:11 +00:00
mpam_devices.c arm_mpam: Check whether the config array is allocated before destroying it 2026-05-14 09:52:05 +01:00
mpam_internal.h arm_mpam: Pretend that NRDY is always hardware managed 2026-05-14 09:51:50 +01:00
mpam_resctrl.c arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static 2026-04-17 17:48:07 +01:00
test_mpam_devices.c arm_mpam: Force __iomem casts 2026-03-13 14:17:30 +00:00
test_mpam_resctrl.c arm_mpam: resctrl: Add kunit test for control format conversions 2026-03-27 15:31:04 +00:00