Skip to contentSkip to conversation

net/mlx5: Only set num_doorbells on a fully initialized SF

PATCH Applied Tariq Toukan 5 participants 5 messages Oct 26 – Oct 29

Subsystems (4)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

PATCH 1/1 net/mlx5: Only set num_doorbells on a fully initialized SF

From: Cosmin Ratiu <[email protected]>

The validation for the num_doorbells devlink param rejects values greater than num_channels. For lightweight SFs, this ends up accessing a NULL priv->eq_table, leading to a crash.

Fix that by rejecting setting num_doorbells on uninitialized SFs.

Fixes 11bbcfb7668c ("net/mlx5e: Use the 'num_doorbells' devlink param")
---
 drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +6 -0
index b9026cc64383..30a97e48dda7 100644
@@ -542,6 +542,12 @@ static int mlx5_devlink_num_doorbells_validate(struct devlink *devlink, u32 id,
 	u32 val32 = val->vu32;
 	u32 max_num_channels;
 
+	if (mlx5_dev_is_lightweight(mdev)) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "Setting num_doorbells requires full device initialization; reload the device first");
+		return -EOPNOTSUPP;
+	}
+
 	max_num_channels = mlx5e_get_max_num_channels(mdev);
 	if (val32 > max_num_channels) {
 		NL_SET_ERR_MSG_FMT_MOD(extack,

base-commit: f4377bf85887f57b59abb5479f7660a81ffe4449

Signature · 1 line
2.44.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

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 code inspection). If it was triggered please include the symptoms, like the stack trace or error 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. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

#2 lore raw
In reply to Tariq Toukan
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

From: Cosmin Ratiu <[email protected]>

The validation for the num_doorbells devlink param rejects values greater than num_channels. For lightweight SFs, this ends up accessing a NULL priv->eq_table, leading to a crash.

Quoted 6 lines

Fix that by rejecting setting num_doorbells on uninitialized SFs.

Fixes 11bbcfb7668c ("net/mlx5e: Use the 'num_doorbells' devlink param")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#3 lore raw
In reply to Tariq Toukan
Quoted 6 lines

From: Cosmin Ratiu <[email protected]>

The validation for the num_doorbells devlink param rejects values greater than num_channels. For lightweight SFs, this ends up accessing a NULL priv->eq_table, leading to a crash.

Quoted 6 lines

Fix that by rejecting setting num_doorbells on uninitialized SFs.

Fixes 11bbcfb7668c ("net/mlx5e: Use the 'num_doorbells' devlink param")
#4 lore raw
In reply to Tariq Toukan
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Mon, 26 Oct 2026 10:45:03 +0200 you wrote:

From: Cosmin Ratiu <[email protected]>

The validation for the num_doorbells devlink param rejects values greater than num_channels. For lightweight SFs, this ends up accessing a NULL priv->eq_table, leading to a crash.

Fix that by rejecting setting num_doorbells on uninitialized SFs.

[...]

Here is the summary with links:
- [net] net/mlx5: Only set num_doorbells on a fully initialized SF

    https://git.kernel.org/netdev/net/c/fa503935c2d6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html