bnxt_en: fix module unload sequence
PATCH 1/1 bnxt_en: fix module unload sequence
Recent updates to the PTP part of bnxt changed the way PTP FIFO is cleared, skbs waiting for TX timestamps are now cleared during ndo_close() call. To do clearing procedure, the ptp structure must exist and point to a valid address. Module destroy sequence had ptp clear code running before netdev close causing invalid memory access and kernel crash. Change the sequence to destroy ptp structure after device close.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -16006,8 +16006,8 @@ static void bnxt_remove_one(struct pci_dev *pdev)bnxt_rdma_aux_device_del (bp); -bnxt_ptp_clear (bp);unregister_netdev (dev); +bnxt_ptp_clear (bp);bnxt_rdma_aux_device_uninit (bp);
Signature · 1 line
2.47.1
Quoted 20 lines
-----Original Message-----
From: Vadim Fedorenko <[email protected]>
Sent: Wednesday, April 30, 2025 10:04 AM
To: Vadim Fedorenko <[email protected]>; Michael Chan <[email protected]>; Pavan Chebbi <[email protected]>; Jakub Kicinski <[email protected]>
Cc: Richard Cochran <[email protected]>; Taehee Yoo <[email protected]>; [email protected]
Subject: [PATCH net]bnxt_en: fix module unload sequenceRecent updates to the PTP part of bnxt changed the way PTP FIFO is cleared, skbs waiting for TX timestamps are now cleared during
ndo_close()call. To do clearing procedure, the ptp structure must exist and point to a valid address. Module destroy sequence had ptp clear code running before netdev close causing invalid memory access and kernel crash. Change the sequence to destroy ptp structure after device close.
Quoted 6 lines
Fixes 8f7ae5a85137 ("bnxt_en: improve TX timestamping FIFO configuration")Reported-by Taehee Yoo <[email protected]>Signed-off-by Vadim Fedorenko <[email protected]>---
Quoted 21 lines
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/broadcom/bnxt/bnxt.c +1
-2@@ -16006,8 +16006,8 @@ static void bnxt_remove_one(struct pci_dev *pdev)bnxt_rdma_aux_device_del (bp); -bnxt_ptp_clear (bp);unregister_netdev (dev); +bnxt_ptp_clear (bp);bnxt_rdma_aux_device_uninit (bp); --2.47.1
Quoted 9 lines · Vadim Fedorenko
Recent updates to the PTP part of bnxt changed the way PTP FIFO is cleared, skbs waiting for TX timestamps are now cleared during
ndo_close()call. To do clearing procedure, the ptp structure must exist and point to a valid address. Module destroy sequence had ptp clear code running before netdev close causing invalid memory access and kernel crash. Change the sequence to destroy ptp structure after device close.
Quoted 4 lines
Fixes 8f7ae5a85137 ("bnxt_en: improve TX timestamping FIFO configuration")Reported-by Taehee Yoo <[email protected]>Closes https://lore.kernel.org/netdev/CAMArcTWDe2cd41=ub=zzvYifaYcYv-N-csxfqxUvejy_L0D6UQ@mail.gmail.com/ open hereSigned-off-by Vadim Fedorenko <[email protected]>
The PTP destroy sequence is now consistent with bnxt_shutdown() and bnxt_suspend(). Thanks.
Quoted 9 lines · Vadim Fedorenko
Recent updates to the PTP part of bnxt changed the way PTP FIFO is cleared, skbs waiting for TX timestamps are now cleared during
ndo_close()call. To do clearing procedure, the ptp structure must exist and point to a valid address. Module destroy sequence had ptp clear code running before netdev close causing invalid memory access and kernel crash. Change the sequence to destroy ptp structure after device close.
Quoted 4 lines
Fixes 8f7ae5a85137 ("bnxt_en: improve TX timestamping FIFO configuration")Reported-by Taehee Yoo <[email protected]>Closes https://lore.kernel.org/netdev/CAMArcTWDe2cd41=ub=zzvYifaYcYv-N-csxfqxUvejy_L0D6UQ@mail.gmail.com/ open hereSigned-off-by Vadim Fedorenko <[email protected]>
Quoted 21 lines
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/broadcom/bnxt/bnxt.c +1
-2@@ -16006,8 +16006,8 @@ static void bnxt_remove_one(struct pci_dev *pdev)bnxt_rdma_aux_device_del (bp); -bnxt_ptp_clear (bp);unregister_netdev (dev); +bnxt_ptp_clear (bp);bnxt_rdma_aux_device_uninit (bp); --2.47.1
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 30 Apr 2025 10:03:43 -0700 you wrote:
Recent updates to the PTP part of bnxt changed the way PTP FIFO is cleared, skbs waiting for TX timestamps are now cleared during
ndo_close()call. To do clearing procedure, the ptp structure must exist and point to a valid address. Module destroy sequence had ptp clear code running before netdev close causing invalid memory access and kernel crash. Change the sequence to destroy ptp structure after device close.[...]
Here is the summary with links:
- [net] bnxt_en: fix module unload sequence
https://git.kernel.org/netdev/net/c/927069d5c40c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html