From: "Nikhil P. Rao" <nikhil.rao@amd.com>
To: Brett Creeley <brett.creeley@amd.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>,
Richard Cochran <richardcochran@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Eric Joyner <eric.joyner@amd.com>,
Abhijit Gangurde <abhijit.gangurde@amd.com>,
"Allen Hubbe" <allen.hubbe@amd.com>,
"Nikhil P. Rao" <nikhil.rao@amd.com>
Subject: [PATCH net 0/4] ionic: fix register reads racing the BAR unmap on PCI reset
Date: Wed, 2 Dec 2026 00:38:21 +0000 [thread overview]
Message-ID: <20261202-b4-pr60-v1-0-b1f6706e065b@amd.com> (raw)
A PCI reset of an ionic device runs ionic_reset_prepare(), which ends
in ionic_clear_pci(): it clears the driver's pointers into BAR0 and
unmaps it. Several readers test one of those pointers and then read
through it without synchronizing with that teardown, so a reset that
lands between the test and the read makes them access the unmapped
BAR. This series closes those windows.
Patch 1 clears and sets the device command registers under
dev_cmd_lock and takes the lock in the two readers that did not.
Patch 2 turns the lockless device info readers (firmware status,
heartbeat and the ethtool register dump) into RCU readers and has the
teardown wait for them.
Patch 3 clears the PHC counter registers under phc->lock when the
reset starts and has the PHC operations check them under that lock.
Patch 4 holds queue_lock while ethtool -C writes the interrupt control
registers, so the update cannot race the queue teardown.
The races in patches 1-3 were reproduced on an AMD Pensando NIC under
KASAN by holding the reader between its check and its access with a
test-only kprobe module while a PCI reset ran: without the series the
access faults on the unmapped BAR, with it the reset waits for the
reader or the reader backs off. The race in patch 4 was not reproduced.
The series was also run through 30 PCI resets per test under concurrent
ethtool, devlink and PHC load with lockdep enabled, without regressions.
The races in patches 1-3 were found by Sashiko and the one in patch 4
by a Claude Code review; Claude Code was also used in developing and
testing the fixes.
Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com>
---
Nikhil P. Rao (4):
ionic: fix devcmds racing the BAR unmap on PCI reset
ionic: fix device info register reads racing the BAR unmap on PCI reset
ionic: fix PHC reads racing the BAR unmap on PCI reset
ionic: fix ethtool coalesce updates racing a PCI reset
.../net/ethernet/pensando/ionic/ionic_bus_pci.c | 21 ++++++++++++-
drivers/net/ethernet/pensando/ionic/ionic_dev.c | 34 +++++++++++++---------
.../net/ethernet/pensando/ionic/ionic_ethtool.c | 18 ++++++++++--
drivers/net/ethernet/pensando/ionic/ionic_fw.c | 6 ++++
drivers/net/ethernet/pensando/ionic/ionic_lif.h | 2 +-
drivers/net/ethernet/pensando/ionic/ionic_phc.c | 20 +++++++++++--
6 files changed, 80 insertions(+), 21 deletions(-)
---
base-commit: 0e4c3240b03093264d501ab24c65726d29921987
change-id: 20261118-b4-pr60-5fd83c966e7a
Best regards,
--
Nikhil P. Rao <nikhil.rao@amd.com>
next reply other threads:[~2026-12-02 0:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 0:38 Nikhil P. Rao [this message]
2026-12-02 0:38 ` [PATCH net 1/4] ionic: fix devcmds racing the BAR unmap on PCI reset Nikhil P. Rao
2026-12-02 0:38 ` [PATCH net 2/4] ionic: fix device info register reads " Nikhil P. Rao
2026-12-02 0:38 ` [PATCH net 3/4] ionic: fix PHC " Nikhil P. Rao
2026-12-02 0:38 ` [PATCH net 4/4] ionic: fix ethtool coalesce updates racing a " Nikhil P. Rao
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=20261202-b4-pr60-v1-0-b1f6706e065b@amd.com \
--to=nikhil.rao@amd.com \
--cc=abhijit.gangurde@amd.com \
--cc=allen.hubbe@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eric.joyner@amd.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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