Patch "net: stmmac: fix possible memory leak in stmmac_dvr_probe()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: stmmac: fix possible memory leak in stmmac_dvr_probe()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-stmmac-fix-possible-memory-leak-in-stmmac_dvr_pr.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 815bed9bb57564ac2f30b48ec6ac3e93a7546d20
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Wed Dec 7 16:34:13 2022 +0800

    net: stmmac: fix possible memory leak in stmmac_dvr_probe()
    
    [ Upstream commit a137f3f27f9290933fe7e40e6dc8a445781c31a2 ]
    
    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: bba2556efad6 ("net: stmmac: Enable RX via AF_XDP zero-copy")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index eba97adaf1fb..d987ca727a21 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7046,7 +7046,7 @@ int stmmac_dvr_probe(struct device *device,
 	priv->wq = create_singlethread_workqueue("stmmac_wq");
 	if (!priv->wq) {
 		dev_err(priv->device, "failed to create workqueue\n");
-		return -ENOMEM;
+		goto error_wq_init;
 	}
 
 	INIT_WORK(&priv->service_task, stmmac_service_task);
@@ -7273,6 +7273,7 @@ int stmmac_dvr_probe(struct device *device,
 	stmmac_napi_del(ndev);
 error_hw_init:
 	destroy_workqueue(priv->wq);
+error_wq_init:
 	bitmap_free(priv->af_xdp_zc_qps);
 
 	return ret;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux