Commit 89aad770 authored by Tomer Tayar's avatar Tomer Tayar Committed by Oded Gabbay
Browse files

habanalabs: fix nullifying of destroyed mmu pgt pool



In case of host-resident MMU, when the page tables pool is destroyed,
its pointer is not nullified correctly.
As a result, on a device fini which happens after a failing reset, the
already destroyed pool is accessed, which leads to a kernel panic.
The patch fixes the setting of the pool pointer to NULL.

Signed-off-by: default avatarTomer Tayar <ttayar@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 1ee8e2ba
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -470,14 +470,14 @@ static void hl_mmu_v1_fini(struct hl_device *hdev)
	if (!ZERO_OR_NULL_PTR(hdev->mmu_priv.hr.mmu_shadow_hop0)) {
		kvfree(hdev->mmu_priv.dr.mmu_shadow_hop0);
		gen_pool_destroy(hdev->mmu_priv.dr.mmu_pgt_pool);
	}

	/* Make sure that if we arrive here again without init was called we
	 * won't cause kernel panic. This can happen for example if we fail
	 * during hard reset code at certain points
		/* Make sure that if we arrive here again without init was
		 * called we won't cause kernel panic. This can happen for
		 * example if we fail during hard reset code at certain points
		 */
		hdev->mmu_priv.dr.mmu_shadow_hop0 = NULL;
	}
}

/**
 * hl_mmu_ctx_init() - initialize a context for using the MMU module.