Skip to content

Commit c4d8573

Browse files
Zhang Changzhongsmb49
authored andcommitted
net: stmmac: selftests: fix potential memleak in stmmac_test_arpoffload()
BugLink: https://bugs.launchpad.net/bugs/2003914 [ Upstream commit f150b63 ] 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: 5e3fb0a ("net: stmmac: selftests: Implement the ARP Offload test") Signed-off-by: Zhang Changzhong <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 7639cc0 commit c4d8573

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,12 +1614,16 @@ static int stmmac_test_arpoffload(struct stmmac_priv *priv)
16141614
}
16151615

16161616
ret = stmmac_set_arp_offload(priv, priv->hw, true, ip_addr);
1617-
if (ret)
1617+
if (ret) {
1618+
kfree_skb(skb);
16181619
goto cleanup;
1620+
}
16191621

16201622
ret = dev_set_promiscuity(priv->dev, 1);
1621-
if (ret)
1623+
if (ret) {
1624+
kfree_skb(skb);
16221625
goto cleanup;
1626+
}
16231627

16241628
skb_set_queue_mapping(skb, 0);
16251629
ret = dev_queue_xmit(skb);

0 commit comments

Comments
 (0)