]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu: Keep dev->iommu state consistent
authorRobin Murphy <robin.murphy@arm.com>
Fri, 28 Feb 2025 15:46:32 +0000 (15:46 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:12:47 +0000 (11:12 +0200)
commit51b3750da27ab93f70f34196ab80ab8d6285e53b
treeb014ec75c1445a2a3fc8723ff5f00e5ab1e9f156
parent4250baf4d47f996abfbafc237aa762e45315040b
iommu: Keep dev->iommu state consistent

[ Upstream commit 3832862eb9c4dfa0e80b2522bfaedbc8a43de97d ]

At the moment, if of_iommu_configure() allocates dev->iommu itself via
iommu_fwspec_init(), then suffers a DT parsing failure, it cleans up the
fwspec but leaves the empty dev_iommu hanging around. So far this is
benign (if a tiny bit wasteful), but we'd like to be able to reason
about dev->iommu having a consistent and unambiguous lifecycle. Thus
make sure that the of_iommu cleanup undoes precisely whatever it did.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/d219663a3f23001f23d520a883ac622d70b4e642.1740753261.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/iommu-priv.h
drivers/iommu/iommu.c
drivers/iommu/of_iommu.c