iommu/arm-smmu-v3: Don't free page table ops twice
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Thu, 14 Dec 2017 11:03:01 +0000 (11:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jan 2018 08:31:20 +0000 (09:31 +0100)
commit3ea9d6d0ad67c6a978604e5f16af5683c435e082
treede4e1a48b4053f2bd9955058f8e48ebaa93057ac
parent289b51d3c17be8855c5b4be87d8e0e78cc70d511
iommu/arm-smmu-v3: Don't free page table ops twice

commit 57d72e159b60456c8bb281736c02ddd3164037aa upstream.

Kasan reports a double free when finalise_stage_fn fails: the io_pgtable
ops are freed by arm_smmu_domain_finalise and then again by
arm_smmu_domain_free. Prevent this by leaving pgtbl_ops empty on failure.

Fixes: 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices")
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/arm-smmu-v3.c