Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH net] net/mlx5: Fix divide by zero when a function has no completion EQs
@ 2026-12-02 13:04 Tariq Toukan
  2026-12-02 13:08 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Tariq Toukan @ 2026-12-02 13:04 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Willem de Bruijn
  Cc: Dragos Tatulea, Gal Pressman, Jiri Pirko, Leon Romanovsky,
	linux-rdma, Mark Bloch, Parav Pandit, Saeed Mahameed,
	Shahar Shitrit, Shay Drory, Tariq Toukan, Yishai Hadas

From: Yishai Hadas <yishaih@nvidia.com>

Since max_io_eqs was added, an administrator can set it to 0 for a VF,
or for the host PF from the ECPF. The function then gets only the
control EQs, and with ODP enabled get_num_eqs() returns 0 completion
EQs.

The aRFS version of alloc_rmap() passes the zero value to
alloc_irq_cpu_rmap() which results in a divide by zero.

Handle the zero case by returning an error for non SFs: aRFS
can't function without it.

Fixes: 93197c7c509d ("mlx5/core: Support max_io_eqs for a function")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Shahar Shitrit <shshitrit@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index d11ec263d53c..0795ee24ad7f 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;

base-commit: b6c8f45ed340f00bf2004d407cf7316fe3e24c48
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net/mlx5: Fix divide by zero when a function has no completion EQs
  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
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-12-02 13:08 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Willem de Bruijn, Dragos Tatulea,
	Gal Pressman, Jiri Pirko, Leon Romanovsky, linux-rdma, Mark Bloch,
	Parav Pandit, Saeed Mahameed, Shahar Shitrit, Shay Drory,
	Yishai Hadas

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox