diff mbox series

mm/memremap: fix missing call to untrack_pfn() in pagemap_range()

Message ID 20220531122643.25249-1-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series mm/memremap: fix missing call to untrack_pfn() in pagemap_range() | expand

Commit Message

Miaohe Lin May 31, 2022, 12:26 p.m. UTC
We forget to call untrack_pfn() to pair with track_pfn_remap() when range
is not allowed to hotplug. Fix it by jump err_kasan.

Fixes: bca3feaa0764 ("mm/memory_hotplug: prevalidate the address range being added with platform")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Hildenbrand May 31, 2022, 12:48 p.m. UTC | #1
On 31.05.22 14:26, Miaohe Lin wrote:
> We forget to call untrack_pfn() to pair with track_pfn_remap() when range
> is not allowed to hotplug. Fix it by jump err_kasan.
> 
> Fixes: bca3feaa0764 ("mm/memory_hotplug: prevalidate the address range being added with platform")
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/memremap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memremap.c b/mm/memremap.c
> index 2b92e97cb25b..b870a659eee6 100644
> --- a/mm/memremap.c
> +++ b/mm/memremap.c
> @@ -214,7 +214,7 @@ static int pagemap_range(struct dev_pagemap *pgmap, struct mhp_params *params,
>  
>  	if (!mhp_range_allowed(range->start, range_len(range), !is_private)) {
>  		error = -EINVAL;
> -		goto err_pfn_remap;
> +		goto err_kasan;
>  	}
>  
>  	mem_hotplug_begin();

Thanks!

Reviewed-by: David Hildenbrand <david@redhat.com>
Muchun Song May 31, 2022, 3:30 p.m. UTC | #2
On Tue, May 31, 2022 at 08:26:43PM +0800, Miaohe Lin wrote:
> We forget to call untrack_pfn() to pair with track_pfn_remap() when range
> is not allowed to hotplug. Fix it by jump err_kasan.
> 
> Fixes: bca3feaa0764 ("mm/memory_hotplug: prevalidate the address range being added with platform")
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Good catch.

Acked-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/mm/memremap.c b/mm/memremap.c
index 2b92e97cb25b..b870a659eee6 100644
--- a/mm/memremap.c
+++ b/mm/memremap.c
@@ -214,7 +214,7 @@  static int pagemap_range(struct dev_pagemap *pgmap, struct mhp_params *params,
 
 	if (!mhp_range_allowed(range->start, range_len(range), !is_private)) {
 		error = -EINVAL;
-		goto err_pfn_remap;
+		goto err_kasan;
 	}
 
 	mem_hotplug_begin();