Skip to contentSkip to conversation

iommu/amd: Check return value of mmu_notifier_register()

PATCH New Denis Arefev 1 participant 1 message Nov 25 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/amd: Check return value of mmu_notifier_register()

From: Denis Arefev <[email protected]>

commit b09b56734fae28be9332021ae3e84c9b05020fda upstream.

Added a return value check for the function mmu_notifier_register().

Return value of a function 'mmu_notifier_register' called at iommu_v2.c:642 is not checked,
but it is usually checked for this function

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 drivers/iommu/amd/iommu_v2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/amd/iommu_v2.c +3 -1
index 16776e3c6eab..8704c2c89556 100644
@@ -640,7 +640,9 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, u32 pasid,
 	if (pasid_state->mm == NULL)
 		goto out_free;
 
-	mmu_notifier_register(&pasid_state->mn, mm);
+	ret = mmu_notifier_register(&pasid_state->mn, mm);
+	if (ret)
+		goto out_free;
 
 	ret = set_pasid_state(dev_state, pasid_state, pasid);
 	if (ret)
Signature · 1 line
2.43.0