From: Ben Horgan <ben.horgan@arm.com>
To: Guangshuo Li <lgs201920130244@gmail.com>,
James Morse <james.morse@arm.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Fenghua Yu <fenghuay@nvidia.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
Zeng Heng <zengheng4@huawei.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm_mpam: guard MBWU state before adding it to garbage
Date: Wed, 8 Jul 2026 10:13:04 +0100 [thread overview]
Message-ID: <dd40ba39-008f-4e52-82ad-280fbe7dce13@arm.com> (raw)
In-Reply-To: <20260708082323.736350-1-lgs201920130244@gmail.com>
Hi Guangshuo,
On 7/8/26 09:23, Guangshuo Li wrote:
> __destroy_component_cfg() adds each RIS mbwu_state object to the MPAM
> garbage list when destroying component configuration.
>
> However, mbwu_state is allocated per RIS and only for RISes with MBWU
> monitors. A component can therefore have comp->cfg allocated while some
> RISes still have ris->mbwu_state set to NULL.
>
> Passing a NULL mbwu_state to add_to_garbage() dereferences the NULL
> pointer inside the macro.
>
> Skip RISes that do not have an mbwu_state object before adding them to
> the garbage list.
>
> Fixes: 41e8a14950e1 ("arm_mpam: Track bandwidth counter state for power management")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Good spot and thanks for the fix.
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
> ---
> drivers/resctrl/mpam_devices.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index b69f99488111..59225694255f 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -2606,8 +2606,10 @@ static void __destroy_component_cfg(struct mpam_component *comp)
> msc = vmsc->msc;
>
> if (mpam_mon_sel_lock(msc)) {
> - list_for_each_entry(ris, &vmsc->ris, vmsc_list)
> - add_to_garbage(ris->mbwu_state);
> + list_for_each_entry(ris, &vmsc->ris, vmsc_list) {
> + if (ris->mbwu_state)
> + add_to_garbage(ris->mbwu_state);
> + }
> mpam_mon_sel_unlock(msc);
> }
> }
prev parent reply other threads:[~2026-07-08 9:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 8:23 [PATCH] arm_mpam: guard MBWU state before adding it to garbage Guangshuo Li
2026-07-08 9:13 ` Ben Horgan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd40ba39-008f-4e52-82ad-280fbe7dce13@arm.com \
--to=ben.horgan@arm.com \
--cc=catalin.marinas@arm.com \
--cc=fenghuay@nvidia.com \
--cc=james.morse@arm.com \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tan.shaopeng@jp.fujitsu.com \
--cc=zengheng4@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox