diff --git a/mm/memremap.c b/mm/memremap.c index 6aa5f0c2d11f..4d73533d8ca7 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: