video/rockchip: rga2: fix rga_dma_flush_page crash issue

Unable to handle kernel paging request at virtual address
ffffffc000000000
PC is at __dma_flush_range+0x18/0x30
LR is at rga_dma_flush_page+0x40/0x48

Change-Id: I6c15bc60edac042884ad14611485f0380e3bd355
Signed-off-by: Shixiang Zheng <shixiang.zheng@rock-chips.com>
Signed-off-by: Li Huang <putin.li@rock-chips.com>
This commit is contained in:
Shixiang Zheng
2019-08-26 08:55:39 +08:00
committed by Tao Huang
parent 0745fcace7
commit 7f00098197

View File

@@ -489,7 +489,7 @@ static int rga2_MapUserMemory(struct page **pages, uint32_t *pageTable,
pte = pte_offset_map_lock(current->mm, pmd,
(Memory + i) << PAGE_SHIFT,
&ptl);
if (!pte) {
if (pte_none(*pte)) {
pr_err("RGA2 failed to get pte\n");
pte_unmap_unlock(pte, ptl);
status = RGA2_OUT_OF_RESOURCES;
@@ -498,9 +498,9 @@ static int rga2_MapUserMemory(struct page **pages, uint32_t *pageTable,
pfn = pte_pfn(*pte);
Address = ((pfn << PAGE_SHIFT) | (((unsigned long)((Memory + i)
<< PAGE_SHIFT)) & ~PAGE_MASK));
pte_unmap_unlock(pte, ptl);
pageTable[i] = (uint32_t)Address;
rga2_dma_flush_page(pfn_to_page(pfn));
pte_unmap_unlock(pte, ptl);
}
up_read(&current->mm->mmap_sem);
return status;