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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5edd0874f40b5d720816dce34dd85b2c5e498f34.camel@mellanox.com>
Date:   Tue, 20 Aug 2019 21:00:28 +0000
From:   Saeed Mahameed <saeedm@...lanox.com>
To:     "wenwen@...uga.edu" <wenwen@...uga.edu>
CC:     "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "leon@...nel.org" <leon@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net/mlx5: Fix a memory leak bug

On Tue, 2019-08-13 at 03:21 -0500, Wenwen Wang wrote:
> In mlx5_cmd_invoke(), 'ent' is allocated through kzalloc() in
> alloc_cmd().
> After the work is queued, wait_func() is invoked to wait the
> completion of
> the work. If wait_func() returns -ETIMEDOUT, the following execution
> will
> be terminated. However, the allocated 'ent' is not deallocated on
> this
> program path, leading to a memory leak bug.
> 
> To fix the above issue, free 'ent' before returning the error.

Hi Wenewn, sorry i have to nack this.

As Moshe already pointed out, we intentionally don't free ent, since
even if the driver decided to timeout, FW might still send a
completion, until the FW sends the completion, this entry shouldn't be
freed and is not reusable by driver.

So this is not a memory leak, it just means that only FW completion is
allowed to free this entry or driver shutdown.. otherwise this command
entry is just dead until next fw completion.

Thanks,
Saeed.


> 
> Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> index 8cdd7e6..90cdb9a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> @@ -1036,7 +1036,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev
> *dev, struct mlx5_cmd_msg *in,
>  
>  	err = wait_func(dev, ent);
>  	if (err == -ETIMEDOUT)
> -		goto out;
> +		goto out_free;
>  
>  	ds = ent->ts2 - ent->ts1;
>  	op = MLX5_GET(mbox_in, in->first.data, opcode);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ