lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220513143246.jfqvxwr6rejsdfou@revolver>
Date:   Fri, 13 May 2022 14:32:57 +0000
From:   Liam Howlett <liam.howlett@...cle.com>
To:     "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     Qian Cai <quic_qiancai@...cinc.com>
Subject: Re: [PATCH] mm/mmap: Fix potential leak on do_mas_align_munmap()

* Liam Howlett <liam.howlett@...cle.com> [220513 10:16]:
> There is a leak when the system is low on resources and fails to
> allocate enough memory to complete the munmap task.  Fix this by adding
> the necessary free operations in the unwinding.
> 
> Fixes: a760774e7b7b (mm: start tracking VMAs with maple tree)

This is the wrong fixes.  It fixes "67/69 mm: remove the vma
linked list".


> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
> ---
>  mm/mmap.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index ebfd71a79814..9d41df730b22 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2365,7 +2365,7 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma,
>  		return -ENOMEM;
>  
>  	if (mas_preallocate(&mas_detach, vma, GFP_KERNEL))
> -		return -ENOMEM;
> +		goto detach_alloc_fail;
>  
>  	mas->last = end - 1;
>  	/*
> @@ -2504,6 +2504,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma,
>  map_count_exceeded:
>  split_failed:
>  userfaultfd_error:
> +	mas_destroy(&mas_detach);
> +detach_alloc_fail:
>  	mas_destroy(mas);
>  	return error;
>  }
> -- 
> 2.35.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ