netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Wentao Liang <vulab@iscas.ac.cn>,
	saeedm@nvidia.com, leon@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>
Subject: Re: [PATCH net v3] net/mlx5: handle errors in mlx5_chains_create_table()
Date: Sun, 9 Mar 2025 13:46:19 +0200	[thread overview]
Message-ID: <d415dada-f1cb-486d-b018-171777bfaab6@gmail.com> (raw)
In-Reply-To: <20250307021820.2646-1-vulab@iscas.ac.cn>



On 07/03/2025 4:18, Wentao Liang wrote:
> In mlx5_chains_create_table(), the return value of mlx5_get_fdb_sub_ns()
> and mlx5_get_flow_namespace() must be checked to prevent NULL pointer
> dereferences. If either function fails, the function should log error
> message with mlx5_core_warn() and return error pointer.
> 
> Fixes: 39ac237ce009 ("net/mlx5: E-Switch, Refactor chains and priorities")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> [v1]->[v2]: Add Fixes tag and branch target. Change return value.
> [v2]->[v3]: Change Fixes tag. Move change history.
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
> index a80ecb672f33..711d14dea248 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
> @@ -196,6 +196,11 @@ mlx5_chains_create_table(struct mlx5_fs_chains *chains,
>   		ns = mlx5_get_flow_namespace(chains->dev, chains->ns);
>   	}
>   
> +	if (!ns) {
> +		mlx5_core_warn(chains->dev, "Failed to get flow namespace\n");
> +		return ERR_PTR(-EOPNOTSUPP);
> +	}
> +
>   	ft_attr.autogroup.num_reserved_entries = 2;
>   	ft_attr.autogroup.max_num_groups = chains->group_num;
>   	ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

Thanks.

  parent reply	other threads:[~2025-03-09 11:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07  2:18 [PATCH net v3] net/mlx5: handle errors in mlx5_chains_create_table() Wentao Liang
2025-03-07 13:45 ` [PATCH net v4?] " Markus Elfring
2025-03-09 11:46 ` Tariq Toukan [this message]
2025-03-10 20:10 ` [PATCH net v3] " 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=d415dada-f1cb-486d-b018-171777bfaab6@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vulab@iscas.ac.cn \
    /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).