From 65a78bdd3abc1be5c8094068bb5402f1e5228639 Mon Sep 17 00:00:00 2001 From: Zhou Guanghui Date: Wed, 12 Aug 2020 15:04:08 +0000 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 a7dd00cdb90b..c0728bc12cf8 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -3784,7 +3784,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