Commit f150b63f authored by Zhang Changzhong's avatar Zhang Changzhong Committed by David S. Miller

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: 5e3fb0a6 ("net: stmmac: selftests: Implement the ARP Offload test")
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae18dcdf
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment