[PATCH v3 1/2] iommu/arm-smmu-v3: Manage teardown with devm
Jason Gunthorpe
jgg at ziepe.ca
Fri Jul 10 10:00:23 PDT 2026
On Mon, Jun 29, 2026 at 10:41:05AM +0100, Shameer Kolothum wrote:
> arm_smmu_device_remove() manually frees the IOPF queue, destroys the
> vmid_map and disables the device, while the IRQs and queues are devm
> managed. devm unwinds only after remove() returns, so the cleanup runs
> in the wrong order. The IOPF queue is freed before the event-queue IRQ
> whose handler uses it.
>
> Manage all of it with devm so the unwind order is correct. Free the IOPF
> queue and vmid_map via devm actions, and disable the device from one
> registered after arm_smmu_device_reset().
>
> This is also a prerequisite for fixing a Tegra241 CMDQV CMD_SYNC
> use-after-free in the subsequent patch.
>
> Cc: stable at vger.kernel.org
> Suggested-by: Jason Gunthorpe <jgg at ziepe.ca>
> Reviewed-by: Nicolin Chen <nicolinc at nvidia.com>
> Signed-off-by: Shameer Kolothum <skolothumtho at nvidia.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 56 +++++++++++++++------
> 1 file changed, 40 insertions(+), 16 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>
Jason
More information about the linux-arm-kernel
mailing list