]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/memremap: avoid calling kasan_remove_zero_shadow() for device private memory
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 22 Mar 2022 21:39:25 +0000 (14:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2022 22:57:01 +0000 (15:57 -0700)
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>
mm/memremap.c

index 6aa5f0c2d11fda56628243cbbf38561ae3bc03b9..4d73533d8ca79a51550c333267890f436bf37d8c 100644 (file)
@@ -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: