net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()
authorWang Hai <wanghai38@huawei.com>
Thu, 17 Nov 2022 06:55:27 +0000 (14:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Nov 2022 13:00:36 +0000 (13:00 +0000)
commit2360f9b8c4e81d242d4cbf99d630a2fffa681fab
treeb2c3df950499bee21e22015dac617051ccbc5e03
parent0ad6bded175e829c2ca261529c9dce39a32a042d
net: pch_gbe: fix potential memleak in pch_gbe_tx_queue()

In pch_gbe_xmit_frame(), NETDEV_TX_OK will be returned whether
pch_gbe_tx_queue() sends data successfully or not, so pch_gbe_tx_queue()
needs to free skb before returning. But pch_gbe_tx_queue() returns without
freeing skb in case of dma_map_single() fails. Add dev_kfree_skb_any()
to fix it.

Fixes: 77555ee72282 ("net: Add Gigabit Ethernet driver of Topcliff PCH")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c