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]
Message-ID: <0ea0057771c623ca3a37a79fc953fd34c54aa815.camel@redhat.com>
Date:   Tue, 25 Oct 2022 13:55:20 +0200
From:   Paolo Abeni <pabeni@...hat.com>
To:     Yang Yingliang <yangyingliang@...wei.com>, netdev@...r.kernel.org
Cc:     dougmill@...ux.ibm.com, davem@...emloft.net, kuba@...nel.org
Subject: Re: [PATCH net] net: ehea: fix possible memory leak in
 ehea_register_port()

Hello,

On Sat, 2022-10-22 at 19:37 +0800, Yang Yingliang wrote:
> dev_set_name() in ehea_register_port() allocates memory for name,
> it need be freed when of_device_register() fails, call put_device()
> to give up the reference that hold in device_initialize(), so that
> it can be freed in kobject_cleanup() when the refcount hit to 0.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>  drivers/net/ethernet/ibm/ehea/ehea_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
> index 294bdbbeacc3..b4aff59b3eb4 100644
> --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
> +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
> @@ -2900,6 +2900,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
>  	ret = of_device_register(&port->ofdev);
>  	if (ret) {
>  		pr_err("failed to register device. ret=%d\n", ret);
> +		put_device(&port->ofdev.dev);
>  		goto out;
>  	}

You need to include a suitable Fixes tag into the commit message.
Additionally, if you have a kmemleak splat handy, please include even
that in the commit message.

Thanks!

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ