From: Michal Kubiak <michal.kubiak@intel.com>
To: Saeed Mahameed <saeed@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
"Saeed Mahameed" <saeedm@nvidia.com>, <netdev@vger.kernel.org>,
Tariq Toukan <tariqt@nvidia.com>,
Zhengchao Shao <shaozhengchao@huawei.com>,
Simon Horman <simon.horman@corigine.com>,
Rahul Rameshbabu <rrameshbabu@nvidia.com>
Subject: Re: [net V2 2/9] net/mlx5e: fix memory leak in mlx5e_fs_tt_redirect_any_create
Date: Wed, 5 Jul 2023 21:29:27 +0200 [thread overview]
Message-ID: <ZKXEl3NOQhjrrbrV@localhost.localdomain> (raw)
In-Reply-To: <20230705175757.284614-3-saeed@kernel.org>
On Wed, Jul 05, 2023 at 10:57:50AM -0700, Saeed Mahameed wrote:
> From: Zhengchao Shao <shaozhengchao@huawei.com>
>
> The memory pointed to by the fs->any pointer is not freed in the error
> path of mlx5e_fs_tt_redirect_any_create, which can lead to a memory leak.
> Fix by freeing the memory in the error path, thereby making the error path
> identical to mlx5e_fs_tt_redirect_any_destroy().
>
> Fixes: 0f575c20bf06 ("net/mlx5e: Introduce Flow Steering ANY API")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c b/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
> index 03cb79adf912..be83ad9db82a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
> @@ -594,7 +594,7 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs)
>
> err = fs_any_create_table(fs);
> if (err)
> - return err;
> + goto err_free_any;
>
> err = fs_any_enable(fs);
> if (err)
> @@ -606,8 +606,8 @@ int mlx5e_fs_tt_redirect_any_create(struct mlx5e_flow_steering *fs)
>
> err_destroy_table:
> fs_any_destroy_table(fs_any);
> -
> - kfree(fs_any);
> +err_free_any:
> mlx5e_fs_set_any(fs, NULL);
> + kfree(fs_any);
> return err;
> }
Looks OK to me.
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
next prev parent reply other threads:[~2023-07-05 19:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-05 17:57 [pull request][net V2 0/9] mlx5 fixes 2023-07-05 Saeed Mahameed
2023-07-05 17:57 ` [net V2 1/9] net/mlx5e: fix double free in mlx5e_destroy_flow_table Saeed Mahameed
2023-07-05 19:23 ` Michal Kubiak
2023-07-07 2:20 ` patchwork-bot+netdevbpf
2023-07-05 17:57 ` [net V2 2/9] net/mlx5e: fix memory leak in mlx5e_fs_tt_redirect_any_create Saeed Mahameed
2023-07-05 19:29 ` Michal Kubiak [this message]
2023-07-05 17:57 ` [net V2 3/9] net/mlx5e: fix memory leak in mlx5e_ptp_open Saeed Mahameed
2023-07-05 19:31 ` Michal Kubiak
2023-07-05 17:57 ` [net V2 4/9] net/mlx5e: RX, Fix flush and close release flow of regular rq for legacy rq Saeed Mahameed
2023-07-05 17:57 ` [net V2 5/9] net/mlx5: Register a unique thermal zone per device Saeed Mahameed
2023-07-05 19:48 ` Michal Kubiak
2023-07-06 3:20 ` Jakub Kicinski
2023-07-06 6:09 ` Saeed Mahameed
2023-07-06 15:42 ` Jakub Kicinski
2023-07-05 17:57 ` [net V2 6/9] net/mlx5e: Check for NOT_READY flag state after locking Saeed Mahameed
2023-07-05 17:57 ` [net V2 7/9] net/mlx5e: TC, CT: Offload ct clear only once Saeed Mahameed
2023-07-05 17:57 ` [net V2 8/9] net/mlx5: Query hca_cap_2 only when supported Saeed Mahameed
2023-07-05 19:51 ` Michal Kubiak
2023-07-05 17:57 ` [net V2 9/9] net/mlx5e: RX, Fix page_pool page fragment tracking for XDP Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZKXEl3NOQhjrrbrV@localhost.localdomain \
--to=michal.kubiak@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rrameshbabu@nvidia.com \
--cc=saeed@kernel.org \
--cc=saeedm@nvidia.com \
--cc=shaozhengchao@huawei.com \
--cc=simon.horman@corigine.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).