iavf: Fix kernel BUG in free_msi_irqs
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jankowski
PATCH v2 1/1 iavf: Fix kernel BUG in free_msi_irqs
Quoted 59 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: pi?tek, 22 pa?dziernika 2021 10:30
To: intel-wired-lan at lists.osuosl.org
Cc: Palczewski, Mateusz <[email protected]>; Patynowski, PrzemyslawX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v2] iavf: Fix kernel BUG infree_msi_irqsFrom: Przemyslaw Patynowski <[email protected]>
Fix driver not freeing VF's traffic irqs, prior to calling
pci_disable_msixiniavf_remove.
There were possible 2 erroneous states in which,iavf_closewould not be called.
One erroneous state is fixed by allowing netdev to register, when state is already running. It was possible for VF adapter to enter state loop from running to resetting, whereiavf_openwould subsequently fail.
If user would then unload driver/remove VF pci,iavf_closewould not be called, as the netdev was not registered, leaving traffic pcis still allocated. Fixed this by breaking loop, allowing netdev to open device when adapter state is__IAVF_RUNNINGand it is not explicitily downed.
Other possiblity is entering toiavf_removefrom__IAVF_RESETTINGstate, whereiavf_closewould not free irqs, but just return 0.
Fixed this by checking for last adapter state and then removing irqs.Kernel panic: [ 2773.628585] kernel BUG at drivers/pci/msi.c:375! ... [ 2773.631567] RIP: 0010:free_msi_irqs+0x180/0x1b0 ... [ 2773.640939] Call Trace: [ 2773.641572] pci_disable_msix+0xf7/0x120 [ 2773.642224] iavf_reset_interrupt_capability.part.41+0x15/0x30 [iavf] [ 2773.642897] iavf_remove+0x12e/0x500 [iavf] [ 2773.643578] pci_device_remove+0x3b/0xc0 [ 2773.644266] device_release_driver_internal+0x103/0x1f0 [ 2773.644948] pci_stop_bus_device+0x69/0x90 [ 2773.645576] pci_stop_and_remove_bus_device+0xe/0x20 [ 2773.646215] pci_iov_remove_virtfn+0xba/0x120 [ 2773.646862] sriov_disable+0x2f/0xe0 [ 2773.647531] ice_free_vfs+0x2f8/0x350 [ice] [ 2773.648207] ice_sriov_configure+0x94/0x960 [ice] [ 2773.648883] ? _kstrtoull+0x3b/0x90 [ 2773.649560] sriov_numvfs_store+0x10a/0x190 [ 2773.650249] kernfs_fop_write+0x116/0x190 [ 2773.650948] vfs_write+0xa5/0x1a0 [ 2773.651651] ksys_write+0x4f/0xb0 [ 2773.652358] do_syscall_64+0x5b/0x1a0 [ 2773.653075] entry_SYSCALL_64_after_hwframe+0x65/0xcaFixes 22ead37f8af8 ("i40evf: Add longer wait after remove module")Signed-off-by Przemyslaw PatynowskiSigned-off-by Mateusz Palczewski <[email protected]>---
This is a fix but it needs to be targeted to net-next because this feature is
not present on net yet.
---
v2: Targeted to correct tree
Quoted 5 lines
--- drivers/net/ethernet/intel/iavf/iavf.h | 36 +++++++++++++++++++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 20 ++++++++++++ 2 files changed, 56 insertions(+)