From: Potin Lai <potin.lai.pt@gmail.com>
To: Samuel Mendoza-Jonas <sam@mendozajonas.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Patrick Williams <patrick@stwcx.xyz>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Cosmo Chou <cosmo.chou@quantatw.com>,
Potin Lai <potin.lai@quantatw.com>,
Cosmo Chou <chou.cosmo@gmail.com>,
Potin Lai <potin.lai.pt@gmail.com>
Subject: [PATCH v4] net/ncsi: fix state race during channel probe completion
Date: Tue, 14 Jan 2025 10:51:39 +0800 [thread overview]
Message-ID: <20250114-fix-ncsi-mac-v4-1-4f058b7f8a99@gmail.com> (raw)
From: Cosmo Chou <chou.cosmo@gmail.com>
During channel probing, the last NCSI_PKT_CMD_DP command can trigger
an unnecessary schedule_work() via ncsi_free_request(). We observed
that subsequent config states were triggered before the scheduled
work completed, causing potential state handling issues.
Fix this by clearing req_flags when processing the last package.
Fixes: 8e13f70be05e ("net/ncsi: Probe single packages to avoid conflict")
Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
---
Fix state race during channel probe completion.
Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
---
Changes in v4:
- Remove Paul's patch due to two patches are solving different issues.
- Link to v3: https://lore.kernel.org/r/20250113-fix-ncsi-mac-v3-0-564c8277eb1d@gmail.com
Changes in v3:
- Fix compile error by removing non-exist variable.
- Link to v2: https://lore.kernel.org/r/20250111-fix-ncsi-mac-v2-0-838e0a1a233a@gmail.com
Changes in v2:
- Add second patch for fixing state handling issue.
- Link to v1: https://lore.kernel.org/all/20250109145054.30925-1-fercerpav@gmail.com/
---
net/ncsi/ncsi-manage.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 5cf55bde366d..2feff885eeff 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1479,7 +1479,10 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
}
break;
case ncsi_dev_state_probe_dp:
- ndp->pending_req_num = 1;
+ if (ndp->package_probe_id + 1 < 8)
+ ndp->pending_req_num = 1;
+ else
+ nca.req_flags = 0;
/* Deselect the current package */
nca.type = NCSI_PKT_CMD_DP;
---
base-commit: 56e6a3499e14716b9a28a307bb6d18c10e95301e
change-id: 20250111-fix-ncsi-mac-1e4b3df431f1
Best regards,
--
Potin Lai <potin.lai.pt@gmail.com>
reply other threads:[~2025-01-14 2:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250114-fix-ncsi-mac-v4-1-4f058b7f8a99@gmail.com \
--to=potin.lai.pt@gmail.com \
--cc=chou.cosmo@gmail.com \
--cc=cosmo.chou@quantatw.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=patrick@stwcx.xyz \
--cc=potin.lai@quantatw.com \
--cc=sam@mendozajonas.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®