Patch "iommu/mediatek: Flush IOTLB completely only if domain has been attached" has been added to the 6.3-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/mediatek: Flush IOTLB completely only if domain has been attached

to the 6.3-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-mediatek-flush-iotlb-completely-only-if-domain.patch
and it can be found in the queue-6.3 subdirectory.

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



commit aab94b0a0eb0c855bb6ca02ddd12f83266a27842
Author: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
Date:   Fri May 26 16:53:59 2023 +0800

    iommu/mediatek: Flush IOTLB completely only if domain has been attached
    
    [ Upstream commit b3fc95709c54ffbe80f16801e0a792a4d2b3d55e ]
    
    If an IOMMU domain was never attached, it lacks any linkage to the
    actual IOMMU hardware. Attempting to do flush_iotlb_all() on it will
    result in a NULL pointer dereference. This seems to happen after the
    recent IOMMU core rework in v6.4-rc1.
    
        Unable to handle kernel read from unreadable memory at virtual address 0000000000000018
        Call trace:
         mtk_iommu_flush_iotlb_all+0x20/0x80
         iommu_create_device_direct_mappings.part.0+0x13c/0x230
         iommu_setup_default_domain+0x29c/0x4d0
         iommu_probe_device+0x12c/0x190
         of_iommu_configure+0x140/0x208
         of_dma_configure_id+0x19c/0x3c0
         platform_dma_configure+0x38/0x88
         really_probe+0x78/0x2c0
    
    Check if the "bank" field has been filled in before actually attempting
    the IOTLB flush to avoid it. The IOTLB is also flushed when the device
    comes out of runtime suspend, so it should have a clean initial state.
    
    Fixes: 08500c43d4f7 ("iommu/mediatek: Adjust the structure")
    Signed-off-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
    Reviewed-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230526085402.394239-1-wenst@xxxxxxxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 6a00ce208dc2b..248b8c2bc4071 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -738,7 +738,8 @@ static void mtk_iommu_flush_iotlb_all(struct iommu_domain *domain)
 {
 	struct mtk_iommu_domain *dom = to_mtk_domain(domain);
 
-	mtk_iommu_tlb_flush_all(dom->bank->parent_data);
+	if (dom->bank)
+		mtk_iommu_tlb_flush_all(dom->bank->parent_data);
 }
 
 static void mtk_iommu_iotlb_sync(struct iommu_domain *domain,



[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