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  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:   Fri, 22 Mar 2019 14:03:53 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     Chengguang Xu <cgxu519@....com>, davem@...emloft.net
Cc:     keescook@...omium.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] netlink: fix a memory leak on error path

Hi, Chengguang,

On 22.03.2019 13:58, Chengguang Xu wrote:
> In genl_register_family(), when idr_alloc() fails,
> we forget to free family->attrbuf.
> 
> Note, some callers call genl_unregister_family() to clean up
> on error path, it doesn't work because the family is inserted
> to the global list in the nearly last step.
> 
> Fixes: 2ae0f17df1c ("genetlink: use idr to track families").
> Signed-off-by: Chengguang Xu <cgxu519@....com>

have you seen https://patchwork.ozlabs.org/patch/1059834/ ?

Kirill
> ---
>  net/netlink/genetlink.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
> index 25eeb6d2a75a..f0ec068e1d02 100644
> --- a/net/netlink/genetlink.c
> +++ b/net/netlink/genetlink.c
> @@ -366,7 +366,7 @@ int genl_register_family(struct genl_family *family)
>  			       start, end + 1, GFP_KERNEL);
>  	if (family->id < 0) {
>  		err = family->id;
> -		goto errout_locked;
> +		goto errout_free;
>  	}
> 
>  	err = genl_validate_assign_mc_groups(family);
> @@ -385,6 +385,7 @@ int genl_register_family(struct genl_family *family)
> 
>  errout_remove:
>  	idr_remove(&genl_fam_idr, family->id);
> +errout_free:
>  	kfree(family->attrbuf);
>  errout_locked:
>  	genl_unlock_all();
> --
> 2.20.1
> 

Powered by blists - more mailing lists