From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Aleksandr Mishin <amishin@t-argos.ru>, Mark Bloch <mbloch@nvidia.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maor Gottlieb <maorg@nvidia.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Shay Drory <shayd@nvidia.com>, Jianbo Liu <jianbol@nvidia.com>,
Jinjie Ruan <ruanjinjie@huawei.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: Re: [PATCH net] net/mlx5: Fix tainted pointer delete is case of flow rules creation fail
Date: Wed, 5 Jun 2024 08:14:10 +0300 [thread overview]
Message-ID: <4e7a80f7-d650-4deb-b331-b9de7951cfa1@gmail.com> (raw)
In-Reply-To: <20240604100552.25201-1-amishin@t-argos.ru>
On 04/06/2024 13:05, Aleksandr Mishin wrote:
> In case of flow rule creation fail in mlx5_lag_create_port_sel_table(),
> instead of previously created rules, the tainted pointer is deleted
> deveral times.
> Fix this bug by using correct flow rules pointers.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 352899f384d4 ("net/mlx5: Lag, use buckets in hash mode")
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
> index c16b462ddedf..ab2717012b79 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c
> @@ -88,9 +88,13 @@ static int mlx5_lag_create_port_sel_table(struct mlx5_lag *ldev,
> &dest, 1);
> if (IS_ERR(lag_definer->rules[idx])) {
> err = PTR_ERR(lag_definer->rules[idx]);
> - while (i--)
> - while (j--)
> + do {
> + while (j--) {
> + idx = i * ldev->buckets + j;
> mlx5_del_flow_rules(lag_definer->rules[idx]);
> + }
> + j = ldev->buckets;
> + } while (i--);
> goto destroy_fg;
> }
> }
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks.
next prev parent reply other threads:[~2024-06-05 5:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 10:05 [PATCH net] net/mlx5: Fix tainted pointer delete is case of flow rules creation fail Aleksandr Mishin
2024-06-04 21:58 ` Jacob Keller
2024-06-05 5:14 ` Tariq Toukan [this message]
2024-06-05 21:30 ` patchwork-bot+netdevbpf
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=4e7a80f7-d650-4deb-b331-b9de7951cfa1@gmail.com \
--to=ttoukan.linux@gmail.com \
--cc=amishin@t-argos.ru \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=jianbol@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=maorg@nvidia.com \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ruanjinjie@huawei.com \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.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