net: stmmac: selftests: fix potential memleak in stmmac_test_arpoffload()
[ Upstream commit f150b63f3fa5fdd81e0dd6151e8850268e29438c ]
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: 5e3fb0a6e2
("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
bba527e4ec
commit
429370c40d
@ -1614,12 +1614,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;
|
||||
}
|
||||
|
||||
skb_set_queue_mapping(skb, 0);
|
||||
ret = dev_queue_xmit(skb);
|
||||
|
Loading…
Reference in New Issue
Block a user