linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ethernet: aeroflex: fix potential skb leak in greth_init_rings()
@ 2022-12-04  6:09 Zhang Changzhong
  2022-12-05  7:16 ` Leon Romanovsky
  2022-12-07 10:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Changzhong @ 2022-12-04  6:09 UTC (permalink / raw)
  To: Andreas Larsson, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Kristoffer Glembo
  Cc: Zhang Changzhong, netdev, linux-kernel

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>
---
 drivers/net/ethernet/aeroflex/greth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index e104fb0..aa0d2f3 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;
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ethernet: aeroflex: fix potential skb leak in greth_init_rings()
  2022-12-04  6:09 [PATCH net] ethernet: aeroflex: fix potential skb leak in greth_init_rings() Zhang Changzhong
@ 2022-12-05  7:16 ` Leon Romanovsky
  2022-12-07 10:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-12-05  7:16 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: Andreas Larsson, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Kristoffer Glembo, netdev, linux-kernel

On Sun, Dec 04, 2022 at 02:09:08PM +0800, Zhang Changzhong wrote:
> 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>
> ---
>  drivers/net/ethernet/aeroflex/greth.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ethernet: aeroflex: fix potential skb leak in greth_init_rings()
  2022-12-04  6:09 [PATCH net] ethernet: aeroflex: fix potential skb leak in greth_init_rings() Zhang Changzhong
  2022-12-05  7:16 ` Leon Romanovsky
@ 2022-12-07 10:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-07 10:50 UTC (permalink / raw)
  To: Zhang Changzhong
  Cc: andreas, davem, edumazet, kuba, pabeni, kristoffer, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 4 Dec 2022 14:09:08 +0800 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net] ethernet: aeroflex: fix potential skb leak in greth_init_rings()
    https://git.kernel.org/netdev/net/c/063a932b64db

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-07 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-04  6:09 [PATCH net] ethernet: aeroflex: fix potential skb leak in greth_init_rings() Zhang Changzhong
2022-12-05  7:16 ` Leon Romanovsky
2022-12-07 10:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).