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-next>] [day] [month] [year] [list]
Message-ID: <20260109052040.938-1-dheerajkumar.srivastava@amd.com>
Date: Fri, 9 Jan 2026 10:50:40 +0530
From: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@....com>
To: <joro@...tes.org>, <suravee.suthikulpanit@....com>, <will@...nel.org>,
	<robin.murphy@....com>, <iommu@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>
CC: <Vasant.Hegde@....com>, Dheeraj Kumar Srivastava
	<dheerajkumar.srivastava@....com>, Sairaj Kodilkar
	<Sairaj.ArunKodilkar@....com>, kernel test robot <lkp@...el.com>, "Dan
 Carpenter" <error27@...il.com>
Subject: [PATCH] iommu/amd: Use array_index_nospec() for rlookup_table index

Use array_index_nospec() to prevent speculative out-of-bounds
access when indexing pci_seg->rlookup_table with a user provided
device id.

Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@....com>
Reviewed-by: Sairaj Kodilkar <Sairaj.ArunKodilkar@....com>
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <error27@...il.com>
Closes: https://lore.kernel.org/r/202510281233.q4cBnp3z-lkp@intel.com/
---
 drivers/iommu/amd/debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/amd/debugfs.c b/drivers/iommu/amd/debugfs.c
index 10fa217a7119..4990f6db99ef 100644
--- a/drivers/iommu/amd/debugfs.c
+++ b/drivers/iommu/amd/debugfs.c
@@ -174,6 +174,7 @@ static ssize_t devid_write(struct file *filp, const char __user *ubuf,
 			kfree(srcid_ptr);
 			return -EINVAL;
 		}
+		devid = array_index_nospec(devid, (u32)pci_seg->last_bdf + 1);
 		iommu = pci_seg->rlookup_table[devid];
 		if (!iommu) {
 			kfree(srcid_ptr);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ