net: stmmac: fix possible memory leak in stmmac_dvr_probe()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Wed, 7 Dec 2022 08:34:13 +0000 (16:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:19 +0000 (13:14 +0100)
commit96e50897029f65222ef76cfe9bc802321fcea33b
tree4091d1c33f93935f7a629dca10b8af2915c2011b
parentecaf934e441284d1c9ea4654f8e49a7529b9d8ed
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@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c