]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iommu/amd: Fix illegal cap/mmio access in IOMMU debugfs
authorGuanghui Feng <guanghuifeng@linux.alibaba.com>
Thu, 19 Mar 2026 07:37:54 +0000 (15:37 +0800)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 27 Mar 2026 08:26:59 +0000 (09:26 +0100)
commit0e59645683b7b6fa20eceb21a6f420e4f7412943
tree48f31fe4336a38f185e390e85193d6af2110aceb
parente4172c5b53fba04fa48b13bc3afde809d0087a7f
iommu/amd: Fix illegal cap/mmio access in IOMMU debugfs

In the current AMD IOMMU debugfs, when multiple processes simultaneously
access the IOMMU mmio/cap registers using the IOMMU debugfs, illegal
access issues can occur in the following execution flow:

1. CPU1: Sets a valid access address using iommu_mmio/capability_write,
and verifies the access address's validity in iommu_mmio/capability_show

2. CPU2: Sets an invalid address using iommu_mmio/capability_write

3. CPU1: accesses the IOMMU mmio/cap registers based on the invalid
address, resulting in an illegal access.

This patch modifies the execution process to first verify the address's
validity and then access it based on the same address, ensuring
correctness and robustness.

Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/amd/debugfs.c