linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mm/mmap: fix error return code in do_mas_align_munmap()
@ 2022-06-23 13:42 Yang Yingliang
  2022-06-23 14:24 ` Liam Howlett
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-06-23 13:42 UTC (permalink / raw)
  To: linux-kernel, linux-mm; +Cc: akpm, liam.howlett, quic_qiancai, yuzhao

Return error code when munmap_sidetree() fails in do_mas_align_munmap().

Fixes: 81f5504dfb36 ("mm/mmap: change do_mas_align_munmap() to avoid preallocations for sidetree")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 mm/mmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 1bdf56804048..bb978061a790 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2427,7 +2427,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma,
 
 			mas_set(mas, end);
 			split = mas_prev(mas, 0);
-			if (munmap_sidetree(split, &mas_detach))
+			error = munmap_sidetree(split, &mas_detach);
+			if (error)
 				goto munmap_sidetree_failed;
 
 			count++;
@@ -2435,7 +2436,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma,
 				vma = split;
 			break;
 		}
-		if (munmap_sidetree(next, &mas_detach))
+		error = munmap_sidetree(next, &mas_detach);
+		if (error)
 			goto munmap_sidetree_failed;
 
 		count++;
-- 
2.25.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] mm/mmap: fix error return code in do_mas_align_munmap()
  2022-06-23 13:42 [PATCH -next] mm/mmap: fix error return code in do_mas_align_munmap() Yang Yingliang
@ 2022-06-23 14:24 ` Liam Howlett
  0 siblings, 0 replies; 2+ messages in thread
From: Liam Howlett @ 2022-06-23 14:24 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-mm, akpm, quic_qiancai, yuzhao, Dan Carpenter


I actually have the same patch sitting on my branch, reported by Dan.  I
have been testing this code before sending it out.

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

* Yang Yingliang <yangyingliang@huawei.com> [220623 09:32]:
> Return error code when munmap_sidetree() fails in do_mas_align_munmap().
> 
> Fixes: 81f5504dfb36 ("mm/mmap: change do_mas_align_munmap() to avoid preallocations for sidetree")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  mm/mmap.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 1bdf56804048..bb978061a790 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2427,7 +2427,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma,
>  
>  			mas_set(mas, end);
>  			split = mas_prev(mas, 0);
> -			if (munmap_sidetree(split, &mas_detach))
> +			error = munmap_sidetree(split, &mas_detach);
> +			if (error)
>  				goto munmap_sidetree_failed;
>  
>  			count++;
> @@ -2435,7 +2436,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma,
>  				vma = split;
>  			break;
>  		}
> -		if (munmap_sidetree(next, &mas_detach))
> +		error = munmap_sidetree(next, &mas_detach);
> +		if (error)
>  			goto munmap_sidetree_failed;
>  
>  		count++;
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-23 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 13:42 [PATCH -next] mm/mmap: fix error return code in do_mas_align_munmap() Yang Yingliang
2022-06-23 14:24 ` Liam Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox