BACKPORT: msm: mdss: Fix invalid dma attachment during fb shutdown

If DMA attachment fail during fb_mmap, all ION memory will get free. It
is necessary to reset the fbmem and fb_attachemnt pointer to NULL,
otherwise during shutdown will perform another free and causing issue.

CRs-Fixed: 1090244
Bug: 36251984
Change-Id: If998615655f69d9d867d7655d617083d3d9c03eb
Signed-off-by: Benjamin Chan <bkchan@codeaurora.org>
Signed-off-by: Jonathan Solnit <jsolnit@google.com>
This commit is contained in:
Jonathan Solnit 2017-04-05 16:42:52 -07:00 committed by syphyr
parent b120be7119
commit 6bebfb8b74

View file

@ -1896,7 +1896,7 @@ int mdss_fb_alloc_fb_ion_memory(struct msm_fb_data_type *mfd, size_t fb_size)
ion_unmap_iommu(mfd->fb_ion_client, mfd->fb_ion_handle,
mfd->mdp.fb_mem_get_iommu_domain(), 0);
}
goto fb_mmap_failed;
goto err_put;
}
pr_debug("alloc 0x%zuB vaddr = %pK (%pa iova) for fb%d\n", fb_size,
@ -1908,8 +1908,12 @@ int mdss_fb_alloc_fb_ion_memory(struct msm_fb_data_type *mfd, size_t fb_size)
return rc;
err_put:
dma_buf_put(mfd->fbmem_buf);
fb_mmap_failed:
ion_free(mfd->fb_ion_client, mfd->fb_ion_handle);
mfd->fb_ion_handle = NULL;
mfd->fbmem_buf = NULL;
return rc;
}