🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Wentao Liang Tue, 03 Nov 2026 10:28
[PATCH] mlxsw: core_hwmon: unregister the hwmon device on event ops failure
#10215
Author: Wentao Liang
Date: Tue, 03 Nov 2026 10:28
33 lines
9353 bytes
If mlxsw_linecards_event_ops_register() fails, the error path calls
hwmon_device_unregister() with line_cards[0].hwmon_dev, but that field
is assigned only after the registration succeeds and is therefore
still NULL. The hwmon device returned by
hwmon_device_register_with_groups() is never unregistered, and the
error path dereferences a NULL device.

Unregister the hwmon_dev local variable instead.

Fixes: 99a03b3193f6 ("mlxsw: core_hwmon: Add interfaces for line card initialization and de-initialization")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
index a5e7aee730d6..16644f367df6 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
@@ -920,7 +920,7 @@ int mlxsw_hwmon_init(struct mlxsw_core *mlxsw_core,
 	return 0;
 
 err_linecards_event_ops_register:
-	hwmon_device_unregister(mlxsw_hwmon->line_cards[0].hwmon_dev);
+	hwmon_device_unregister(hwmon_dev);
 err_hwmon_register:
 err_temp_gearbox_init:
 err_temp_module_init:
-- 
2.34.1
Re: [PATCH] mlxsw: core_hwmon: unregister the hwmon device on event ops failure
#10231
Author: netdev-bot+sinfo
Date: Tue, 03 Nov 2026 10:33
26 lines
8921 bytes
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.
Re: [PATCH] mlxsw: core_hwmon: unregister the hwmon device on event ops failure
#12358
Author: patchwork-bot+netdevbpf
Date: Fri, 06 Nov 2026 23:10
24 lines
8704 bytes
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  3 Nov 2026 10:28:50 +0000 you wrote:
> If mlxsw_linecards_event_ops_register() fails, the error path calls
> hwmon_device_unregister() with line_cards[0].hwmon_dev, but that field
> is assigned only after the registration succeeds and is therefore
> still NULL. The hwmon device returned by
> hwmon_device_register_with_groups() is never unregistered, and the
> error path dereferences a NULL device.
> 
> [...]

Here is the summary with links:
  - mlxsw: core_hwmon: unregister the hwmon device on event ops failure
    https://git.kernel.org/netdev/net-next/c/08f643794931

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads