Skip to content

Commit 3701220

Browse files
Tomer Tayarsmb49
Tomer Tayar
authored andcommitted
habanalabs: fix nullifying of destroyed mmu pgt pool
BugLink: https://bugs.launchpad.net/bugs/1949397 [ Upstream commit 89aad77 ] 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: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Kelsey Skunberg <[email protected]>
1 parent 9cd027f commit 3701220

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/misc/habanalabs/common/mmu_v1.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,13 @@ static void hl_mmu_v1_fini(struct hl_device *hdev)
470470
if (!ZERO_OR_NULL_PTR(hdev->mmu_priv.hr.mmu_shadow_hop0)) {
471471
kvfree(hdev->mmu_priv.dr.mmu_shadow_hop0);
472472
gen_pool_destroy(hdev->mmu_priv.dr.mmu_pgt_pool);
473-
}
474473

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

482482
/**

0 commit comments

Comments
 (0)