summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/aeroflex/greth.c
diff options
context:
space:
mode:
authorZhang Changzhong <zhangchangzhong@huawei.com>2022-12-04 09:09:08 +0300
committerPaolo Abeni <pabeni@redhat.com>2022-12-07 13:45:52 +0300
commit063a932b64db3317ec020c94466fe52923a15f60 (patch)
tree55d2bac8fa5c43b8251a9f9e6e52fb6cb3746ad7 /drivers/net/ethernet/aeroflex/greth.c
parent88956177db179e4eba7cd590971961857d1565b8 (diff)
downloadlinux-063a932b64db3317ec020c94466fe52923a15f60.tar.xz
ethernet: aeroflex: fix potential skb leak in greth_init_rings()
The greth_init_rings() function won't free the newly allocated skb when dma_mapping_error() returns error, so add dev_kfree_skb() to fix it. Compile tested only. Fixes: d4c41139df6e ("net: Add Aeroflex Gaisler 10/100/1G Ethernet MAC driver") Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Link: https://lore.kernel.org/r/1670134149-29516-1-git-send-email-zhangchangzhong@huawei.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/aeroflex/greth.c')
-rw-r--r--drivers/net/ethernet/aeroflex/greth.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index e104fb02817d..aa0d2f3aaeaa 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -258,6 +258,7 @@ static int greth_init_rings(struct greth_private *greth)
if (dma_mapping_error(greth->dev, dma_addr)) {
if (netif_msg_ifup(greth))
dev_err(greth->dev, "Could not create initial DMA mapping\n");
+ dev_kfree_skb(skb);
goto cleanup;
}
greth->rx_skbuff[i] = skb;