mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net 0/4] ionic: fix register reads racing the BAR unmap on PCI reset
@ 2026-12-02  0:38 Nikhil P. Rao
  2026-12-02  0:38 ` [PATCH net 1/4] ionic: fix devcmds " Nikhil P. Rao
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nikhil P. Rao @ 2026-12-02  0:38 UTC (permalink / raw)
  To: Brett Creeley, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran
  Cc: netdev, linux-kernel, Eric Joyner, Abhijit Gangurde, Allen Hubbe,
	Nikhil P. Rao

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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-02  0:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02  0:38 [PATCH net 0/4] ionic: fix register reads racing the BAR unmap on PCI reset Nikhil P. Rao
2026-12-02  0:38 ` [PATCH net 1/4] ionic: fix devcmds " 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

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®