mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ruoyu Wang <ruoyuw560@gmail.com>
To: Potnuri Bharat Teja <bharat@chelsio.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jeff Garzik <jeff@garzik.org>, Divy Le Ray <divy@chelsio.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ruoyu Wang <ruoyuw560@gmail.com>
Subject: [PATCH net] net: cxgb3: Ignore link changes on PHY read errors
Date: Fri, 14 Aug 2026 21:39:59 +0800	[thread overview]
Message-ID: <20260814133959.1386234-1-ruoyuw560@gmail.com> (raw)

PHY link-status callbacks can fail before initializing all their output
parameters. For example, an MI1 timeout in get_link_status_r() leaves
link_ok unset, but t3_link_changed() then uses it to update MAC and
carrier state.

Return without changing link state when the callback fails. A later poll
or PHY event can retry the update with valid values.

This issue was found by a static analysis checker and confirmed by
manual source review.

Fixes: 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3.")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
 drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
index a06003bfa04b9..cc04d21564253 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
@@ -1180,7 +1180,8 @@ void t3_link_changed(struct adapter *adapter, int port_id)
 	struct cmac *mac = &pi->mac;
 	struct link_config *lc = &pi->link_config;
 
-	phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc);
+	if (phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc))
+		return;
 
 	if (!lc->link_ok && link_ok) {
 		u32 rx_cfg, rx_hash_high, rx_hash_low;
-- 
2.51.0

             reply	other threads:[~2026-08-14 13:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 13:39 Ruoyu Wang [this message]
2026-08-18 16:40 ` Jakub Kicinski

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=20260814133959.1386234-1-ruoyuw560@gmail.com \
    --to=ruoyuw560@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bharat@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=divy@chelsio.com \
    --cc=edumazet@google.com \
    --cc=jeff@garzik.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®