From c947dfcf2033e5f0820a95ab032afdc2bcf50118 Mon Sep 17 00:00:00 2001 From: Zhou Guanghui Date: Mon, 31 Aug 2020 20:41:10 +0800 Subject: [PATCH] iommu: fix NULL pointer when release iopf queue ascend inclusion category: bugfix bugzilla: NA CVE: NA ---------------------------------- The iopf_queue should be checked when release the related resources. Since, the value of iopf_queue may be NULL. For example, when the SMMU does not support the STALL and PRI features or the driver fails to initialize, the iopf_queue will be NULL pointer. Signed-off-by: Zhou Guanghui Signed-off-by: Bixuan Cui Signed-off-by: chenjiankang Signed-off-by: xiangrui Reviewed-by: Hanjun Guo Signed-off-by: Yang Yingliang --- drivers/iommu/arm-smmu-v3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index e8f7bd3a5ee5..18445a3535cd 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -3782,7 +3782,9 @@ static int arm_smmu_device_remove(struct platform_device *pdev) { struct arm_smmu_device *smmu = platform_get_drvdata(pdev); - iopf_queue_free(smmu->iopf_queue); + if (smmu->iopf_queue) + iopf_queue_free(smmu->iopf_queue); + arm_smmu_device_disable(smmu); return 0; -- GitLab