]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/amd: Check return value of mmu_notifier_register()
authorDenis Arefev <arefev@swemel.ru>
Fri, 18 Nov 2022 10:42:52 +0000 (13:42 +0300)
committerJoerg Roedel <jroedel@suse.de>
Sat, 19 Nov 2022 10:00:41 +0000 (11:00 +0100)
Аdded 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.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
Link: https://lore.kernel.org/r/20221118104252.122809-1-arefev@swemel.ru
[joro: Fix commit message ]
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu_v2.c

index 9f7fab49a5a905b7c36dab797ca9373046bb0245..864e4ffb6aa94ecb154b76c861c4eda3fdd11ec4 100644 (file)
@@ -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)