diff mbox series

[8/8,SRU,OEM-5.17] mm/memremap: avoid calling kasan_remove_zero_shadow() for device private memory

Message ID 20220921031924.2354693-9-acelan.kao@canonical.com
State New
Headers show
Series System hang during S3 test | expand

Commit Message

AceLan Kao Sept. 21, 2022, 3:19 a.m. UTC
From: Miaohe Lin <linmiaohe@huawei.com>

BugLink: https://launchpad.net/bugs/1990330

For device private memory, we do not create a linear mapping for the
memory because the device memory is un-accessible.  Thus we do not add
kasan zero shadow for it.  So it's unnecessary to do
kasan_remove_zero_shadow() for it.

Link: https://lkml.kernel.org/r/20220126092602.1425-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit a74c6c00b1cb56386a98c2f2615f8966b3d1034d)
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
---
 mm/memremap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/memremap.c b/mm/memremap.c
index e8f4d22d650f..618991026ab9 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -282,7 +282,8 @@  static int pagemap_range(struct dev_pagemap *pgmap, struct mhp_params *params,
 	return 0;
 
 err_add_memory:
-	kasan_remove_zero_shadow(__va(range->start), range_len(range));
+	if (!is_private)
+		kasan_remove_zero_shadow(__va(range->start), range_len(range));
 err_kasan:
 	untrack_pfn(NULL, PHYS_PFN(range->start), range_len(range));
 err_pfn_remap: