From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v2 net 2/2] net: enetc: restore RX ring congestion mode for ENETC v4
Date: Sat, 22 Aug 2026 06:38:21 +0000 [thread overview]
Message-ID: <20260822063821.ACFA21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260821064140.1315611-3-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unprotected read-modify-write of the ENETC4_PM_CMD_CFG(0) register can cause configuration loss via a TOCTOU race.
--
--- Patch [2]: [PATCH v2 net 2/2] net: enetc: restore RX ring congestion mode for ENETC v4 ---
commit bd5bd2aaf8ee0b0d3b280c89c74f1cacc1556562
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: restore RX ring congestion mode for ENETC v4
This commit fixes an issue where the RX BD ring congestion mode is cleared
during runtime reconfiguration and never restored. It tracks the desired
state in a software flag and restores it when rings are re-enabled,
ensuring flow control continues to work.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index fcfbabb29d22e..9bb1004548abc 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> @@ -718,22 +718,14 @@ static void enetc4_set_rx_pause(struct enetc_pf *pf, bool rx_pause)
> enetc_port_mac_wr(si, ENETC4_PM_CMD_CFG(0), val);
> }
[Severity: High]
This is a pre-existing issue, but does this read-modify-write on
ENETC4_PM_CMD_CFG(0) need to be protected by si->gen_lock?
It appears enetc4_set_rx_pause() and enetc4_mac_tx_enable() run from the
phylink_resolve workqueue, which does not hold rtnl_lock. Meanwhile,
ethtool commands (like changing loopback) trigger enetc4_pf_set_loopback()
under rtnl_lock.
Since both paths perform lockless read-modify-write operations on the
same ENETC4_PM_CMD_CFG(0) register, could a concurrent link state change
and ethtool command result in a race condition where one of the updates
is overwritten and lost?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260821064140.1315611-1-wei.fang@oss.nxp.com?part=2
next prev parent reply other threads:[~2026-08-22 6:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 6:41 [PATCH v2 net 0/2] net: enetc: restore RX ring congestion mode after ring reconfiguration wei.fang
2026-08-21 6:41 ` [PATCH v2 net 1/2] " wei.fang
2026-08-21 6:41 ` [PATCH v2 net 2/2] net: enetc: restore RX ring congestion mode for ENETC v4 wei.fang
2026-08-22 6:38 ` sashiko-bot [this message]
2026-08-24 13:15 ` [PATCH v2 net 0/2] net: enetc: restore RX ring congestion mode after ring reconfiguration Simon Horman
2026-08-24 19:00 ` 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=20260822063821.ACFA21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.nxp.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