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: <VI1P190MB0317E11D22D2A7F03878D532953F9@VI1P190MB0317.EURP190.PROD.OUTLOOK.COM>
Date:   Tue, 08 Nov 2022 12:00:31 +0200
From:   Vadym Kochan <vadym.kochan@...ision.eu>
To:     Zhengchao Shao <shaozhengchao@...wei.com>, netdev@...r.kernel.org,
        tchornyi@...vell.com, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com
Cc:     andrii.savka@...ision.eu, oleksandr.mazur@...ision.eu,
        weiyongjun1@...wei.com, yuehaibing@...wei.com,
        shaozhengchao@...wei.com
Subject: Re: [PATCH net] net: marvell: prestera: fix memory leak in
 prestera_rxtx_switch_init()

Hi Shao,

On Tue, 8 Nov 2022 10:56:07 +0800, Zhengchao Shao <shaozhengchao@...wei.com> wrote:
> When prestera_sdma_switch_init() failed, the memory pointed to by
> sw->rxtx isn't released. Fix it. Only be compiled, not be tested.
> 
> Fixes: 501ef3066c89 ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
> Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_rxtx.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_rxtx.c b/drivers/net/ethernet/marvell/prestera/prestera_rxtx.c
> index 42ee963e9f75..9277a8fd1339 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_rxtx.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_rxtx.c
> @@ -776,6 +776,7 @@ static netdev_tx_t prestera_sdma_xmit(struct prestera_sdma *sdma,
>  int prestera_rxtx_switch_init(struct prestera_switch *sw)
>  {
>  	struct prestera_rxtx *rxtx;
> +	int err;
>  
>  	rxtx = kzalloc(sizeof(*rxtx), GFP_KERNEL);
>  	if (!rxtx)
> @@ -783,7 +784,11 @@ int prestera_rxtx_switch_init(struct prestera_switch *sw)
>  
>  	sw->rxtx = rxtx;
>  
> -	return prestera_sdma_switch_init(sw);
> +	err = prestera_sdma_switch_init(sw);
> +	if (err)
> +		kfree(rxtx);
> +
> +	return err;
>  }

Thanks, it makes sense.

Reviewed-by: Vadym Kochan <vadym.kochan@...ision.eu>

>  
>  void prestera_rxtx_switch_fini(struct prestera_switch *sw)
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ