From: Tian Xun Ng <[email protected]>

idpf_remove() ends with a function reset to leave the device clean for
whoever binds it next. Commit 4c9106f4906a ("idpf: fix adapter NULL
pointer dereference on reboot") replaced the idpf_remove() call in
idpf_shutdown() with idpf_vc_core_deinit() and idpf_deinit_dflt_mbx(),
and the reset was lost along the way.

Restore it, so that the kernel started by a warm reboot or kexec finds
the device in the same state as after a module unload.

The reset alone does not stop the stray completion writes fixed by the
previous patch: the next kernel's load-time reset already performs a
reset and stale queue state was observed to survive it. It complements
the previous patch, which makes the device tear its queues down first.

Fixes: 4c9106f4906a ("idpf: fix adapter NULL pointer dereference on reboot")
Cc: [email protected]
Assisted-by: LLM
Signed-off-by: Tian Xun Ng <[email protected]>
---
 drivers/net/ethernet/intel/idpf/idpf_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c 
b/drivers/net/ethernet/intel/idpf/idpf_main.c
index 129bccaa6..d7cd449fc 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_main.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
@@ -197,6 +197,9 @@ static void idpf_shutdown(struct pci_dev *pdev)
        cancel_delayed_work_sync(&adapter->serv_task);
        cancel_delayed_work_sync(&adapter->vc_event_task);
        idpf_vc_core_deinit(adapter);
+
+       /* Leave the device clean for the next kernel, as idpf_remove() does */
+       adapter->dev_ops.reg_ops.trigger_reset(adapter, IDPF_HR_FUNC_RESET);
        idpf_deinit_dflt_mbx(adapter);
 
        if (system_state == SYSTEM_POWER_OFF)
-- 
2.50.1 (Apple Git-155)

Reply via email to