From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] net/mlx5: Fix divide by zero when a function has no completion EQs
Date: Thu, 03 Dec 2026 13:05:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-247821@kernel.org> (raw)
In-Reply-To: <20261202130435.3442321-1-tariqt@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] net/mlx5: checking max_comp_eqs in alloc_rmap() aborts probe or
misses SFs and !CONFIG_RFS_ACCEL
--
commit f8141098642e0cdde28ad4ddb5d332f35642c1ce
Author: Yishai Hadas <yishaih@nvidia.com>
net/mlx5: Fix divide by zero when a function has no completion EQs
This commit returns -EINVAL from alloc_rmap() when eq_table->max_comp_eqs
is zero to avoid passing zero to alloc_irq_cpu_rmap().
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> index d11ec263d53c9..0795ee24ad7f2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> @@ -930,6 +930,9 @@ static int alloc_rmap(struct mlx5_core_dev *mdev)
> if (mlx5_core_is_sf(mdev))
> return 0;
>
> + if (!eq_table->max_comp_eqs)
> + return -EINVAL;
> +
> eq_table->rmap = alloc_irq_cpu_rmap(eq_table->max_comp_eqs);
> if (!eq_table->rmap)
> return -ENOMEM;
[Severity: High]
Should eq_table->max_comp_eqs == 0 fail device probe or only skip aRFS
rmap allocation, and why is it checked only here?
mlx5_eq_table_create() treats any error from alloc_rmap() as fatal,
tearing down the control EQs and aborting mlx5_load():
drivers/net/ethernet/mellanox/mlx5/core/eq.c:mlx5_eq_table_create() {
...
err = alloc_rmap(dev);
if (err) {
mlx5_core_err(dev, "Failed to allocate rmap\n");
goto err_rmap;
}
return 0;
err_rmap:
destroy_async_eqs(dev);
...
}
If the function is meant to keep running with only control EQs and
without aRFS (where rmap consumers already tolerate a NULL rmap),
returning -EINVAL here aborts the entire mlx5_core load when
CONFIG_RFS_ACCEL=y.
Conversely, if probing with zero completion EQs is not supported and is
intended to fail mlx5_eq_table_create(), placing the check inside the
CONFIG_RFS_ACCEL version of alloc_rmap() after the mlx5_core_is_sf(mdev)
return misses both !CONFIG_RFS_ACCEL builds and SFs (which also wire up
mlx5_devlink_port_fn_max_io_eqs_set()). In those cases,
mlx5_eq_table_create() succeeds with max_comp_eqs == 0, which still
triggers a divide-by-zero in callers such as mlx5vf_create_cq()
(raw_smp_processor_id() % mlx5_comp_vectors_max(mdev)) or
ib_cq_pool_get() when ib_dev.num_comp_vectors is set to 0.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202130435.3442321-1-tariqt@nvidia.com?part=1
next prev parent reply other threads:[~2026-12-03 13:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 13:04 [PATCH net] net/mlx5: Fix divide by zero when a function has no completion EQs Tariq Toukan
2026-12-02 13:08 ` netdev-bot+sinfo
2026-12-03 13:05 ` sashiko-bot [this message]
2026-12-03 13:13 ` netdev-bot+sashiko
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=sashiko-outbox-247821@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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