Skip to content

Commit ed375b1

Browse files
walking-machineanguy11
authored andcommitted
idpf: protect shutdown from reset
Before the referenced commit, the shutdown just called idpf_remove(), this way IDPF_REMOVE_IN_PROG was protecting us from the serv_task rescheduling reset. Without this flag set the shutdown process is vulnerable to HW reset or any other triggering conditions (such as default mailbox being destroyed). When one of conditions checked in idpf_service_task becomes true, vc_event_task can be rescheduled during shutdown, this leads to accessing freed memory e.g. idpf_req_rel_vector_indexes() trying to read vport->q_vector_idxs. This in turn causes the system to become defunct during e.g. systemctl kexec. Considering using IDPF_REMOVE_IN_PROG would lead to more heavy shutdown process, instead just cancel the serv_task before cancelling adapter->serv_task before cancelling adapter->vc_event_task to ensure that reset will not be scheduled while we are doing a shutdown. Fixes: 4c9106f ("idpf: fix adapter NULL pointer dereference on reboot") Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: Larysa Zaremba <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Emil Tantilov <[email protected]> Tested-by: Samuel Salin <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 8a558cb commit ed375b1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/intel/idpf/idpf_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static void idpf_shutdown(struct pci_dev *pdev)
8989
{
9090
struct idpf_adapter *adapter = pci_get_drvdata(pdev);
9191

92+
cancel_delayed_work_sync(&adapter->serv_task);
9293
cancel_delayed_work_sync(&adapter->vc_event_task);
9394
idpf_vc_core_deinit(adapter);
9495
idpf_deinit_dflt_mbx(adapter);

0 commit comments

Comments
 (0)