]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pds_core: check for workqueue allocation failure
authorNikhil P. Rao <nikhil.rao@amd.com>
Tue, 14 Jul 2026 21:27:13 +0000 (21:27 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Jul 2026 19:47:59 +0000 (12:47 -0700)
pdsc_init_pf() does not check whether create_singlethread_workqueue()
succeeded.

Fail probe on failure. The workqueue is set up before the timer and
mutexes, so its failure path must unwind only the earlier setup.

Fixes: c2dbb0904310 ("pds_core: health timer and workqueue")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260629200358.2626129-1-nikhil.rao%40amd.com?part=2
Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://patch.msgid.link/20260714212713.1788438-1-nikhil.rao@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/amd/pds_core/main.c

index 638b9c7a509d9d6c5fc431dff1af4887d5c9a1b6..8d94a4d70395ed053903150858eb6d9cc1f92565 100644 (file)
@@ -238,6 +238,10 @@ static int pdsc_init_pf(struct pdsc *pdsc)
        /* General workqueue and timer, but don't start timer yet */
        snprintf(wq_name, sizeof(wq_name), "%s.%d", PDS_CORE_DRV_NAME, pdsc->uid);
        pdsc->wq = create_singlethread_workqueue(wq_name);
+       if (!pdsc->wq) {
+               err = -ENOMEM;
+               goto err_out_unmap_bars;
+       }
        INIT_WORK(&pdsc->health_work, pdsc_health_thread);
        INIT_WORK(&pdsc->pci_reset_work, pdsc_pci_reset_thread);
        timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);
@@ -253,7 +257,7 @@ static int pdsc_init_pf(struct pdsc *pdsc)
        err = pdsc_setup(pdsc, PDSC_SETUP_INIT);
        if (err) {
                mutex_unlock(&pdsc->config_lock);
-               goto err_out_unmap_bars;
+               goto err_out_shutdown_timer;
        }
 
        err = pdsc_start(pdsc);
@@ -305,13 +309,14 @@ err_out_stop:
        pdsc_stop(pdsc);
 err_out_teardown:
        pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
-err_out_unmap_bars:
+err_out_shutdown_timer:
        timer_shutdown_sync(&pdsc->wdtimer);
        if (pdsc->wq)
                destroy_workqueue(pdsc->wq);
        mutex_destroy(&pdsc->config_lock);
        mutex_destroy(&pdsc->devcmd_lock);
        pci_free_irq_vectors(pdsc->pdev);
+err_out_unmap_bars:
        pdsc_unmap_bars(pdsc);
 err_out_release_regions:
        pci_release_regions(pdsc->pdev);