mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
iommu/rockchip: avoid accessing null pointers
kernel panic log: [ 6841.591067] rk_iommu ff360480.iommu: Page fault at 0x0000000000001340 of type read [ 6841.591121] Unable to handle kernel paging request at virtual address ffffffc000000000 [ 6841.592463] pgd = ffffffc013b84000 [ 6841.592774] [ffffffc000000000] *pgd=0000000000000000, *pud=0000000000000000 [ 6841.593410] Internal error: Oops: 96000006 [#1] PREEMPT SMP [ 6841.593906] Modules linked in: 8822bs [ 6841.594258] CPU: 0 PID: 29403 Comm: stressapptest Not tainted 4.4.120 #1 [ 6841.594852] Hardware name: Rockchip RK3328 box (DT) [ 6841.595282] task: ffffffc049310d80 task.stack: ffffffc06160c000 [ 6841.595820] PC is at rk_iommu_irq+0x134/0x380 [ 6841.596207] LR is at rk_iommu_irq+0x104/0x380 Change-Id: I5dcc4616dfe34749561dda75cf5f5d26907c7a16 Signed-off-by: Huang jianzhi <jesse.huang@rock-chips.com>
This commit is contained in:
@@ -531,6 +531,15 @@ static void log_iova(struct rk_iommu *iommu, int index, dma_addr_t iova)
|
||||
page_offset = rk_iova_page_offset(iova);
|
||||
|
||||
mmu_dte_addr = rk_iommu_read(base, RK_MMU_DTE_ADDR);
|
||||
/*
|
||||
* Iommu register may be reset by master's reset before processing
|
||||
* the iommu interrupt,Then cpu would get NULL pointer to dump the
|
||||
* iommu page table,add check to avoid this
|
||||
*/
|
||||
if (mmu_dte_addr == 0) {
|
||||
dev_err(iommu->dev, "failed to read mmu_dte_addr, get 0x0\n");
|
||||
return;
|
||||
}
|
||||
mmu_dte_addr_phys = (phys_addr_t)mmu_dte_addr;
|
||||
|
||||
dte_addr_phys = mmu_dte_addr_phys + (4 * dte_index);
|
||||
|
||||
Reference in New Issue
Block a user