Skip to content

Commit 9b58031

Browse files
plinga1anguy11
authored andcommitted
idpf: fix idpf_vc_core_init error path
In an event where the platform running the device control plane is rebooted, reset is detected on the driver. It releases all the resources and waits for the reset to complete. Once the reset is done, it tries to build the resources back. At this time if the device control plane is not yet started, then the driver timeouts on the virtchnl message and retries to establish the mailbox again. In the retry flow, mailbox is deinitialized but the mailbox workqueue is still alive and polling for the mailbox message. This results in accessing the released control queue leading to null-ptr-deref. Fix it by unrolling the work queue cancellation and mailbox deinitialization in the reverse order which they got initialized. Fixes: 4930fbf ("idpf: add core init and interrupt request") Fixes: 34c21fa ("idpf: implement virtchnl transaction manager") Cc: [email protected] # 6.9+ Reviewed-by: Tarun K Singh <[email protected]> Signed-off-by: Pavan Kumar Linga <[email protected]> Tested-by: Krishneil Singh <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 81d2fb4 commit 9b58031

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,7 @@ static int idpf_init_hard_reset(struct idpf_adapter *adapter)
17861786
*/
17871787
err = idpf_vc_core_init(adapter);
17881788
if (err) {
1789+
cancel_delayed_work_sync(&adapter->mbx_task);
17891790
idpf_deinit_dflt_mbx(adapter);
17901791
goto unlock_mutex;
17911792
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3063,7 +3063,6 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
30633063
adapter->state = __IDPF_VER_CHECK;
30643064
if (adapter->vcxn_mngr)
30653065
idpf_vc_xn_shutdown(adapter->vcxn_mngr);
3066-
idpf_deinit_dflt_mbx(adapter);
30673066
set_bit(IDPF_HR_DRV_LOAD, adapter->flags);
30683067
queue_delayed_work(adapter->vc_event_wq, &adapter->vc_event_task,
30693068
msecs_to_jiffies(task_delay));

0 commit comments

Comments
 (0)