[PATCH] iommu/mediatek: check return value after calling platform_get_resource()

2022-07-04 Thread Yang Yingliang via iommu
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: 42d57fc58aeb ("iommu/mediatek: Initialise/Remove for multi bank dev") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/iommu/mtk_iommu.c | 2 ++ 1 file changed, 2

[PATCH -next] iommu/dma: Fix missing mutex_init() in iommu_get_msi_cookie()

2022-06-27 Thread Yang Yingliang via iommu
cookie_alloc() is called by iommu_get_dma_cookie() and iommu_get_msi_cookie(), but the mutex is only initialized in iommu_get_dma_cookie(), move mutex_init() into cookie_alloc() to make sure the mutex will be initialized. Fixes: ac9a5d522bb8 ("iommu/dma: Fix race condition during iova_domain

[PATCH] iommu/arm-smmu-v3: check return value after calling platform_get_resource()

2022-04-25 Thread Yang Yingliang via iommu
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Signed-off-by: Yang Yingliang --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH] iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe()

2022-04-25 Thread Yang Yingliang via iommu
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref. And use devm_platform_get_and_ioremap_resource() to simplify code. Fixes: 9648cbc9625b ("iommu/arm-smmu: Make use

[PATCH] iommu/dart: check return value after calling platform_get_resource()

2022-04-25 Thread Yang Yingliang via iommu
It will cause null-ptr-deref in resource_size(), if platform_get_resource() returns NULL, move calling resource_size() after devm_ioremap_resource() that will check 'res' to avoid null-ptr-deref. And use devm_platform_get_and_ioremap_resource() to simplify code. Fixes: 46d1fb072e76 ("iommu/dart: