[PATCH v3 2/4] arm_mpam: Check whether the config array is allocated before destroying it
Ben Horgan
ben.horgan at arm.com
Mon May 11 04:23:16 PDT 2026
Hi James,
On 5/8/26 17:23, James Morse wrote:
> __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: 3bd04fe7d807bb ("arm_mpam: Extend reset logic to allow devices to be reset any time")
> Signed-off-by: James Morse <james.morse at arm.com>
I checked on the FVP and with this and the previous patch and an early mpam_disable
due to an unsupported MSC version doesn't cause any problems. Additionally, the kunit
tests still run and pass.
Reviewed-by: Ben Horgan <ben.horgan at arm.com>
Thanks,
Ben
More information about the linux-arm-kernel
mailing list