From: Ben Horgan <ben.horgan@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: james.morse@arm.com, reinette.chatre@intel.com,
fenghuay@nvidia.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, dave.martin@arm.com,
will@kernel.org, catalin.marinas@kernel.org
Subject: Re: [PATCH v1 1/2] arm_mpam: Fix a NULL pointer dereference on unbinding after an error interrupt
Date: Thu, 6 Aug 2026 20:36:30 +0100 [thread overview]
Message-ID: <0b7702a8-8ffd-468a-b328-755000bd71f2@arm.com> (raw)
In-Reply-To: <51f5d369-9491-49cb-957a-dd70ad42ecd6@arm.com>
Hi Andre,
On 8/6/26 16:38, Andre Przywara wrote:
> Hi,
>
> On 8/6/26 16:46, Ben Horgan wrote:
>> If a user unbinds an MSC after mpam_disable() has been run in response
>> to an error interrupt then a dereference of a NULL pointer occurs as
>> mpam_disable() sets the drvdata to NULL. Add an early return to the
>> driver
>> remove callback to avoid this.
>
> Yes, I added a very similar patch to my stack yesterday, in response to
> a Sashiko complaint.
> However I was still calling mpam_free_garbage() at the end, to me it
> looks like this is not depending on any MSC?
mpam_free_garbage() doesn't depend on any MSC but it won't have any work
to do unless something in the driver has been destroyed and
mpam_disable() already calls mpam_free_garbage() after it calls the
_destroy() functions. Hence, I think it's ok either way.
Thanks,
Ben
>
> Cheers,
> Andre
>
>> Fixes: f04046f2577a ("arm_mpam: Add probe/remove for mpam msc driver
>> and kbuild boiler plate")
>> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
>> ---
>> drivers/resctrl/mpam_devices.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/
>> mpam_devices.c
>> index 2f09f4b78bd3..bc6cc0b5c96b 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -2025,6 +2025,9 @@ static void mpam_msc_drv_remove(struct
>> platform_device *pdev)
>> {
>> struct mpam_msc *msc = platform_get_drvdata(pdev);
>> + if (!msc)
>> + return;
>> +
>> mutex_lock(&mpam_list_lock);
>> mpam_msc_destroy(msc);
>> mutex_unlock(&mpam_list_lock);
>
next prev parent reply other threads:[~2026-08-06 19:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 14:46 [PATCH v1 0/2] MPAM Fixes for UAF and NPE on unbind Ben Horgan
2026-08-06 14:46 ` [PATCH v1 1/2] arm_mpam: Fix a NULL pointer dereference on unbinding after an error interrupt Ben Horgan
2026-08-06 15:38 ` Andre Przywara
2026-08-06 19:36 ` Ben Horgan [this message]
2026-08-06 14:46 ` [PATCH v1 2/2] arm_mpam: Disable driver unbind to avoid UAF Ben Horgan
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=0b7702a8-8ffd-468a-b328-755000bd71f2@arm.com \
--to=ben.horgan@arm.com \
--cc=andre.przywara@arm.com \
--cc=catalin.marinas@kernel.org \
--cc=dave.martin@arm.com \
--cc=fenghuay@nvidia.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=will@kernel.org \
/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