Patch "iommu/vt-d: Clean up si_domain in the init_dmars() error path" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iommu/vt-d: Clean up si_domain in the init_dmars() error path

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-vt-d-clean-up-si_domain-in-the-init_dmars-erro.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ae123e32d0af7507f3bcc2929df90460c40693d4
Author: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Date:   Wed Oct 19 08:44:47 2022 +0800

    iommu/vt-d: Clean up si_domain in the init_dmars() error path
    
    [ Upstream commit 620bf9f981365c18cc2766c53d92bf8131c63f32 ]
    
    A splat from kmem_cache_destroy() was seen with a kernel prior to
    commit ee2653bbe89d ("iommu/vt-d: Remove domain and devinfo mempool")
    when there was a failure in init_dmars(), because the iommu_domain
    cache still had objects. While the mempool code is now gone, there
    still is a leak of the si_domain memory if init_dmars() fails. So
    clean up si_domain in the init_dmars() error path.
    
    Cc: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
    Cc: Joerg Roedel <joro@xxxxxxxxxx>
    Cc: Will Deacon <will@xxxxxxxxxx>
    Cc: Robin Murphy <robin.murphy@xxxxxxx>
    Fixes: 86080ccc223a ("iommu/vt-d: Allocate si_domain in init_dmars()")
    Signed-off-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221010144842.308890-1-jsnitsel@xxxxxxxxxx
    Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index c48cf737b521..f23329b7f97c 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2846,6 +2846,7 @@ static int __init si_domain_init(int hw)
 
 	if (md_domain_init(si_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) {
 		domain_exit(si_domain);
+		si_domain = NULL;
 		return -EFAULT;
 	}
 
@@ -3505,6 +3506,10 @@ static int __init init_dmars(void)
 		disable_dmar_iommu(iommu);
 		free_dmar_iommu(iommu);
 	}
+	if (si_domain) {
+		domain_exit(si_domain);
+		si_domain = NULL;
+	}
 
 	kfree(g_iommus);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux