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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 Oct 2021 11:46:02 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Miaohe Lin <linmiaohe@...wei.com>, akpm@...ux-foundation.org,
        cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
        iamjoonsoo.kim@....com
Cc:     gregkh@...uxfoundation.org, faiyazm@...eaurora.org,
        andreyknvl@...il.com, ryabinin.a.a@...il.com, thgarnie@...gle.com,
        keescook@...omium.org, bharata@...ux.ibm.com, guro@...com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] mm, slub: fix two bugs in slab_debug_trace_open()

On 9/16/21 14:39, Miaohe Lin wrote:
> It's possible that __seq_open_private() will return NULL. So we should
> check t before using lest dereferencing NULL pointer. And in error paths,
> we forgot to release private buffer via seq_release_private(). Memory
> will leak in these paths.
> 
> Fixes: 64dd68497be7 ("mm: slub: move sysfs slab alloc/free interfaces to debugfs")
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>

Reviewed-by: Vlastimil Babka <vbabka@...e.cz>

> ---
>  mm/slub.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 3d2025f7163b..ed160b6c54f8 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6108,9 +6108,14 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep)
>  	struct kmem_cache *s = file_inode(filep)->i_private;
>  	unsigned long *obj_map;
>  
> +	if (!t)
> +		return -ENOMEM;
> +
>  	obj_map = bitmap_alloc(oo_objects(s->oo), GFP_KERNEL);
> -	if (!obj_map)
> +	if (!obj_map) {
> +		seq_release_private(inode, filep);
>  		return -ENOMEM;
> +	}
>  
>  	if (strcmp(filep->f_path.dentry->d_name.name, "alloc_traces") == 0)
>  		alloc = TRACK_ALLOC;
> @@ -6119,6 +6124,7 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep)
>  
>  	if (!alloc_loc_track(t, PAGE_SIZE / sizeof(struct location), GFP_KERNEL)) {
>  		bitmap_free(obj_map);
> +		seq_release_private(inode, filep);
>  		return -ENOMEM;
>  	}
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ