Skip to content

Commit ada74c5

Browse files
ihuguetPaolo Abeni
authored andcommitted
sfc: fix kernel panic when creating VF
When creating VFs a kernel panic can happen when calling to efx_ef10_try_update_nic_stats_vf. When releasing a DMA coherent buffer, sometimes, I don't know in what specific circumstances, it has to unmap memory with vunmap. It is disallowed to do that in IRQ context or with BH disabled. Otherwise, we hit this line in vunmap, causing the crash: BUG_ON(in_interrupt()); This patch reenables BH to release the buffer. Log messages when the bug is hit: kernel BUG at mm/vmalloc.c:2727! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 6 PID: 1462 Comm: NetworkManager Kdump: loaded Tainted: G I --------- --- 5.14.0-119.el9.x86_64 #1 Hardware name: Dell Inc. PowerEdge R740/06WXJT, BIOS 2.8.2 08/27/2020 RIP: 0010:vunmap+0x2e/0x30 ...skip... Call Trace: __iommu_dma_free+0x96/0x100 efx_nic_free_buffer+0x2b/0x40 [sfc] efx_ef10_try_update_nic_stats_vf+0x14a/0x1c0 [sfc] efx_ef10_update_stats_vf+0x18/0x40 [sfc] efx_start_all+0x15e/0x1d0 [sfc] efx_net_open+0x5a/0xe0 [sfc] __dev_open+0xe7/0x1a0 __dev_change_flags+0x1d7/0x240 dev_change_flags+0x21/0x60 ...skip... Fixes: d778819 ("sfc: DMA the VF stats only when requested") Reported-by: Ma Yuying <[email protected]> Signed-off-by: Íñigo Huguet <[email protected]> Acked-by: Edward Cree <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent cc91b09 commit ada74c5

File tree

1 file changed

+3
-0
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+3
-0
lines changed

drivers/net/ethernet/sfc/ef10.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,10 @@ static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx)
19321932

19331933
efx_update_sw_stats(efx, stats);
19341934
out:
1935+
/* releasing a DMA coherent buffer with BH disabled can panic */
1936+
spin_unlock_bh(&efx->stats_lock);
19351937
efx_nic_free_buffer(efx, &stats_buf);
1938+
spin_lock_bh(&efx->stats_lock);
19361939
return rc;
19371940
}
19381941

0 commit comments

Comments
 (0)