iommu: fix a reference count leak in iommu_sva_bind_device()
PATCH 1/1 iommu: fix a reference count leak in iommu_sva_bind_device()
From: Vasant Karasulli <[email protected]>
From: Vasant Karasulli <[email protected]>
commit b34289505180 ("iommu: disable SVA when CONFIG_X86 is set") disables SVA to mitigate a security vulnerability.
Due the current placement of the condition check, function returns after iommu_group_get() without a corresponding iommu_group_put(). So move the condition check above.
This is a stable-only fix applicable to linux-5.15.y.
--- drivers/iommu/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/iommu.c +3 -3
@@ -3061,6 +3061,9 @@ iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)struct iommu_sva *handle =ERR_PTR (-EINVAL );const struct iommu_ops *ops = dev->bus->iommu_ops; +if (IS_ENABLED (CONFIG_X86 )) +return ERR_PTR (-EOPNOTSUPP ); +if (!ops || !ops->sva_bind)return ERR_PTR (-ENODEV );
@@ -3068,9 +3071,6 @@ iommu_sva_bind_device(struct device *dev, struct mm_struct *mm, void *drvdata)if (!group)return ERR_PTR (-ENODEV ); -if (IS_ENABLED (CONFIG_X86 )) -return ERR_PTR (-EOPNOTSUPP ); -/* Ensure device count and domain don't change while we're binding */ mutex_lock (&group->mutex);
base-commit: 3330a8d33e086f76608bb4e80a3dc569d04a8814
Signature · 1 line
2.34.1
Greg KH
maintainerQuoted 3 lines · On Thu, Mar 19, 2026 at 03:25:44PM +0100, [email protected] wrote:
From: Vasant Karasulli <[email protected]>
From: Vasant Karasulli <[email protected]>
Two from lines?
Quoted 3 lines
commit
b34289505180("iommu: disable SVA whenCONFIG_X86is set") disables SVA to mitigate a security vulnerability.
Trailing whitespace :(
Quoted 8 lines
Due the current placement of the condition check, function returns after
iommu_group_get()without a correspondingiommu_group_put(). So move the condition check above.This is a stable-only fix applicable to linux-5.15.y.
Fixes b34289505("iommu: disable SVA when CONFIG_X86 is set")
This needs an extra space, and the proper number of digits
Quoted 2 lines
Signed-off-by Vasant Karasulli <[email protected]>
No blank line between the two.
thanks,
greg k-h