[PATCH rc] iommu/arm-smmu-v3: Revert vmaster in the error path

Jason Gunthorpe jgg at nvidia.com
Fri Jul 11 09:42:26 PDT 2025


On Thu, Jul 10, 2025 at 04:30:03PM -0700, Nicolin Chen wrote:
> The error path in the arm_smmu_attach_prepare() was introduced with the
> arm_smmu_enable_iopf(). Due to a rebase issue, it forgot to include the
> revert of the vmaster.
> 
> Move kfree(state->vmaster) to the error path, to prevent memory leak.
> 
> Fixes: cfea71aea921 ("iommu/arm-smmu-v3: Put iopf enablement in the domain attach path")
> Cc: stable at vger.kernel.org
> Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

The patch is fine but the commit message is a bit confusing

The error path for err_free_master_domain leaks the vmaster. Move all
the kfrees for vmaster into the goto error section..

Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>

Jason




More information about the linux-arm-kernel mailing list