Skip to content

Commit a137f3f

Browse files
gscuidavem330
authored andcommitted
net: stmmac: fix possible memory leak in stmmac_dvr_probe()
The bitmap_free() should be called to free priv->af_xdp_zc_qps when create_singlethread_workqueue() fails, otherwise there will be a memory leak, so we add the err path error_wq_init to fix it. Fixes: bba2556 ("net: stmmac: Enable RX via AF_XDP zero-copy") Signed-off-by: Gaosheng Cui <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f150b63 commit a137f3f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7097,7 +7097,7 @@ int stmmac_dvr_probe(struct device *device,
70977097
priv->wq = create_singlethread_workqueue("stmmac_wq");
70987098
if (!priv->wq) {
70997099
dev_err(priv->device, "failed to create workqueue\n");
7100-
return -ENOMEM;
7100+
goto error_wq_init;
71017101
}
71027102

71037103
INIT_WORK(&priv->service_task, stmmac_service_task);
@@ -7325,6 +7325,7 @@ int stmmac_dvr_probe(struct device *device,
73257325
stmmac_napi_del(ndev);
73267326
error_hw_init:
73277327
destroy_workqueue(priv->wq);
7328+
error_wq_init:
73287329
bitmap_free(priv->af_xdp_zc_qps);
73297330

73307331
return ret;

0 commit comments

Comments
 (0)