All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] mlxsw: core_hwmon: unregister the hwmon device on event ops failure
Date: Fri, 6 Nov 2026 17:24:19 +0100	[thread overview]
Message-ID: <875wya2aj0.fsf@pmachata.org> (raw)
In-Reply-To: <20261103102850.1340455-1-vulab@iscas.ac.cn> (Wentao Liang's message of "Tue, 3 Nov 2026 10:28:50 +0000")

Wentao Liang <vulab@iscas.ac.cn> writes:

> 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>

Reviewed-by: Petr Machata <petrm@nvidia.com>

  parent reply	other threads:[~2026-11-06 16:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:28 [PATCH] mlxsw: core_hwmon: unregister the hwmon device on event ops failure Wentao Liang
2026-11-03 10:33 ` netdev-bot+sinfo
2026-11-06 16:24 ` Petr Machata [this message]
2026-11-06 23:10 ` 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=875wya2aj0.fsf@pmachata.org \
    --to=petrm@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.