diff options
author | Matthew Rosato <mjrosato@linux.ibm.com> | 2025-08-28 00:08:27 +0300 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2025-09-05 16:11:07 +0300 |
commit | b3506e9bcc777ed6af2ab631c86a9990ed97b474 (patch) | |
tree | d6cf84e51c98226e73a87d1edc913e6362c180d0 /tools/testing/shared/xarray-shared.c | |
parent | 923b70581cb6acede90f8aaf4afe5d1c58c67b71 (diff) | |
download | linux-b3506e9bcc777ed6af2ab631c86a9990ed97b474.tar.xz |
iommu/s390: Fix memory corruption when using identity domain
zpci_get_iommu_ctrs() returns counter information to be reported as part
of device statistics; these counters are stored as part of the s390_domain.
The problem, however, is that the identity domain is not backed by an
s390_domain and so the conversion via to_s390_domain() yields a bad address
that is zero'd initially and read on-demand later via a sysfs read.
These counters aren't necessary for the identity domain; just return NULL
in this case.
This issue was discovered via KASAN with reports that look like:
BUG: KASAN: global-out-of-bounds in zpci_fmb_enable_device
when using the identity domain for a device on s390.
Cc: stable@vger.kernel.org
Fixes: 64af12c6ec3a ("iommu/s390: implement iommu passthrough via identity domain")
Reported-by: Cam Miller <cam@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Tested-by: Cam Miller <cam@linux.ibm.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Link: https://lore.kernel.org/r/20250827210828.274527-1-mjrosato@linux.ibm.com
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'tools/testing/shared/xarray-shared.c')
0 files changed, 0 insertions, 0 deletions