 iommu/s390: Fix memory corruption when using identity domain · gregkh/linux@b3506e9 · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection  EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events &amp; webinars Ebooks &amp; reports Business insights GitHub Skills SUPPORT &amp; SERVICES Documentation Customer support Community forum Trust center Partners View all resources Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator GitHub Stars Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously.  Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gregkh / linux Public Notifications You must be signed in to change notification settings Fork 686 Star 644 Code Actions Security and quality 0 Insights Additional navigation options Code Actions Security and quality Insights Commit b3506e9 Browse files Browse files rosatomj authored and joergroedel committed 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: 64af12c ("iommu/s390: implement iommu passthrough via identity domain") Reported-by: Cam Miller &lt;cam@linux.ibm.com&gt; Signed-off-by: Matthew Rosato &lt;mjrosato@linux.ibm.com&gt; Tested-by: Cam Miller &lt;cam@linux.ibm.com&gt; Reviewed-by: Farhan Ali &lt;alifm@linux.ibm.com&gt; Reviewed-by: Niklas Schnelle &lt;schnelle@linux.ibm.com&gt; Link: https://lore.kernel.org/r/20250827210828.274527-1-mjrosato@linux.ibm.com Signed-off-by: Joerg Roedel &lt;joerg.roedel@amd.com&gt; 1 parent 923b705 commit b3506e9 Copy full SHA for b3506e9 1 file changed + 2 - 1 Lines changed: 2 additions &amp; 1 deletion File tree Expand file tree Collapse file tree Open diff view settings Filter options drivers/iommu s390-iommu.c Expand file tree Collapse file tree Open diff view settings Collapse file ‎ drivers/iommu/s390-iommu.c ‎ Copy file name to clipboard Expand all lines: drivers/iommu/s390-iommu.c + 2 - 1 Lines changed: 2 additions &amp; 1 deletion Original file line number Diff line number Diff line change @@ -1032,7 +1032,8 @@ struct zpci_iommu_ctrs *zpci_get_iommu_ctrs(struct zpci_dev *zdev) 1032 1032 1033 1033 lockdep_assert_held ( &amp; zdev -&gt; dom_lock ); 1034 1034 1035 - if ( zdev -&gt; s390_domain -&gt; type == IOMMU_DOMAIN_BLOCKED ) 1035 + if ( zdev -&gt; s390_domain -&gt; type == IOMMU_DOMAIN_BLOCKED || 1036 + zdev -&gt; s390_domain -&gt; type == IOMMU_DOMAIN_IDENTITY ) 1036 1037 return NULL ; 1037 1038 1038 1039 s390_domain = to_s390_domain ( zdev -&gt; s390_domain ); 0 commit comments Comments 0 ( 0 ) Footer &copy; 2026 GitHub,&nbsp;Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. 