Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75f44d14 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Avoid a NULL dereference in kgsl_iommu_destroy_pagetable



In kgsl_iommu_destroy_pagetable we attempt to get the physical base of the
pagetable without verifying the validity of the iommu_pt->domain pointer.

Change-Id: Ic0dedbad8f09ed09c1fab49c9d0cf1a73b5b33a5
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 87095ed6
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -636,12 +636,13 @@ static int kgsl_iommu_pt_equal(struct kgsl_mmu *mmu,
static void kgsl_iommu_destroy_pagetable(struct kgsl_pagetable *pt)
{
	struct kgsl_iommu_pt *iommu_pt = pt->priv;
	phys_addr_t domain_ptbase = iommu_get_pt_base_addr(iommu_pt->domain);

	if (iommu_pt->domain)
		msm_unregister_domain(iommu_pt->domain);

	if (iommu_pt->domain) {
		phys_addr_t domain_ptbase =
			iommu_get_pt_base_addr(iommu_pt->domain);
		trace_kgsl_pagetable_destroy(domain_ptbase, pt->name);
		msm_unregister_domain(iommu_pt->domain);
	}

	kfree(iommu_pt);
	iommu_pt = NULL;