]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
idpf: fix idpf_vc_core_init error path
authorPavan Kumar Linga <pavan.kumar.linga@intel.com>
Fri, 25 Oct 2024 18:38:43 +0000 (11:38 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 4 Nov 2024 21:09:34 +0000 (13:09 -0800)
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: 4930fbf419a7 ("idpf: add core init and interrupt request")
Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager")
Cc: stable@vger.kernel.org # 6.9+
Reviewed-by: Tarun K Singh <tarun.k.singh@intel.com>
Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf_lib.c
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c

index c3848e10e7dbef76a33b24429ced32d3488d8059..b4fbb99bfad208f5b5f42fd1f697fa21c22e1840 100644 (file)
@@ -1786,6 +1786,7 @@ static int idpf_init_hard_reset(struct idpf_adapter *adapter)
         */
        err = idpf_vc_core_init(adapter);
        if (err) {
+               cancel_delayed_work_sync(&adapter->mbx_task);
                idpf_deinit_dflt_mbx(adapter);
                goto unlock_mutex;
        }
index ce217e274506db57710609f57b2735be95cb1823..d46c95f91b0d81305956373632360cb61e81fe1a 100644 (file)
@@ -3063,7 +3063,6 @@ init_failed:
        adapter->state = __IDPF_VER_CHECK;
        if (adapter->vcxn_mngr)
                idpf_vc_xn_shutdown(adapter->vcxn_mngr);
-       idpf_deinit_dflt_mbx(adapter);
        set_bit(IDPF_HR_DRV_LOAD, adapter->flags);
        queue_delayed_work(adapter->vc_event_wq, &adapter->vc_event_task,
                           msecs_to_jiffies(task_delay));