lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <170732598872.398.2550238673926493243.tip-bot2@tip-bot2>
Date: Wed, 07 Feb 2024 17:13:08 -0000
From: "tip-bot2 for Ashish Kalra" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Dan Carpenter <dan.carpenter@...aro.org>,
 Ashish Kalra <ashish.kalra@....com>, "Borislav Petkov (AMD)" <bp@...en8.de>,
 Joerg Roedel <jroedel@...e.com>, x86@...nel.org, linux-kernel@...r.kernel.org
Subject:
 [tip: x86/sev] iommu/amd: Fix failure return from snp_lookup_rmpentry()

The following commit has been merged into the x86/sev branch of tip:

Commit-ID:     45ba5b3c0a02949a4da74ead6e11c43e9b88bdca
Gitweb:        https://git.kernel.org/tip/45ba5b3c0a02949a4da74ead6e11c43e9b88bdca
Author:        Ashish Kalra <ashish.kalra@....com>
AuthorDate:    Mon, 05 Feb 2024 21:06:54 
Committer:     Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Wed, 07 Feb 2024 17:27:03 +01:00

iommu/amd: Fix failure return from snp_lookup_rmpentry()

Commit

  f366a8dac1b8: ("iommu/amd: Clean up RMP entries for IOMMU pages during SNP shutdown")

leads to the following Smatch static checker warning:

  drivers/iommu/amd/init.c:3820 iommu_page_make_shared() error: uninitialized symbol 'assigned'.

Fix it.

  [ bp: Address the other error cases too. ]

Fixes: f366a8dac1b8 ("iommu/amd: Clean up RMP entries for IOMMU pages during SNP shutdown")
Closes: https://lore.kernel.org/linux-iommu/1be69f6a-e7e1-45f9-9a74-b2550344f3fd@moroto.mountain
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Signed-off-by: Ashish Kalra <ashish.kalra@....com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Cc: Joerg Roedel <jroedel@...e.com>
Link: https://lore.kernel.org/lkml/20240126041126.1927228-20-michael.roth@amd.com
---
 drivers/iommu/amd/init.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 88bb08a..480e768 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -3813,23 +3813,28 @@ static int iommu_page_make_shared(void *page)
 		bool assigned;
 
 		ret = snp_lookup_rmpentry(pfn, &assigned, &level);
-		if (ret)
-			pr_warn("IOMMU PFN %lx RMP lookup failed, ret %d\n",
-				pfn, ret);
+		if (ret) {
+			pr_warn("IOMMU PFN %lx RMP lookup failed, ret %d\n", pfn, ret);
+			return ret;
+		}
 
-		if (!assigned)
-			pr_warn("IOMMU PFN %lx not assigned in RMP table\n",
-				pfn);
+		if (!assigned) {
+			pr_warn("IOMMU PFN %lx not assigned in RMP table\n", pfn);
+			return -EINVAL;
+		}
 
 		if (level > PG_LEVEL_4K) {
 			ret = psmash(pfn);
-			if (ret) {
-				pr_warn("IOMMU PFN %lx had a huge RMP entry, but attempted psmash failed, ret: %d, level: %d\n",
-					pfn, ret, level);
-			}
+			if (!ret)
+				goto done;
+
+			pr_warn("PSMASH failed for IOMMU PFN %lx huge RMP entry, ret: %d, level: %d\n",
+				pfn, ret, level);
+			return ret;
 		}
 	}
 
+done:
 	return rmp_make_shared(pfn, PG_LEVEL_4K);
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ