summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorZhang Changzhong <zhangchangzhong@huawei.com>2022-12-07 16:31:59 +0800
committerDavid S. Miller <davem@davemloft.net>2022-12-09 10:49:39 +0000
commitf150b63f3fa5fdd81e0dd6151e8850268e29438c (patch)
tree1cc3ee40fdcbc1338dcb8798b4f9802e5e61cb44 /drivers/net
parentae18dcdff0f8d7e84cd3fd9f496518b5e72d185d (diff)
downloadlinux-stable-f150b63f3fa5fdd81e0dd6151e8850268e29438c.tar.gz
linux-stable-f150b63f3fa5fdd81e0dd6151e8850268e29438c.tar.bz2
linux-stable-f150b63f3fa5fdd81e0dd6151e8850268e29438c.zip
net: stmmac: selftests: fix potential memleak in stmmac_test_arpoffload()
The skb allocated by stmmac_test_get_arp_skb() hasn't been released in some error handling case, which will lead to a memory leak. Fix this up by adding kfree_skb() to release skb. Compile tested only. Fixes: 5e3fb0a6e2b3 ("net: stmmac: selftests: Implement the ARP Offload test") Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index 49af7e78b7f5..687f43cd466c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -1654,12 +1654,16 @@ static int stmmac_test_arpoffload(struct stmmac_priv *priv)
}
ret = stmmac_set_arp_offload(priv, priv->hw, true, ip_addr);
- if (ret)
+ if (ret) {
+ kfree_skb(skb);
goto cleanup;
+ }
ret = dev_set_promiscuity(priv->dev, 1);
- if (ret)
+ if (ret) {
+ kfree_skb(skb);
goto cleanup;
+ }
ret = dev_direct_xmit(skb, 0);
if (ret)