All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: mvneta: fix possible memory leak in mvneta_swbm_add_rx_fragment
@ 2020-11-13 18:16 Lorenzo Bianconi
  2020-11-17  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2020-11-13 18:16 UTC (permalink / raw)
  To: netdev; +Cc: lorenzo.bianconi, davem, kuba, brouer, ilias.apalodimas, echaudro

Recycle the page running page_pool_put_full_page() in
mvneta_swbm_add_rx_fragment routine when the last descriptor
contains just the FCS or if the received packet contains more than
MAX_SKB_FRAGS fragments

Fixes: ca0e014609f0 ("net: mvneta: move skb build after descriptors processing")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/marvell/mvneta.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 54b0bf574c05..4a9041ee1b39 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2287,6 +2287,7 @@ mvneta_swbm_add_rx_fragment(struct mvneta_port *pp,
 	dma_sync_single_for_cpu(dev->dev.parent,
 				rx_desc->buf_phys_addr,
 				len, dma_dir);
+	rx_desc->buf_phys_addr = 0;
 
 	if (data_len > 0 && sinfo->nr_frags < MAX_SKB_FRAGS) {
 		skb_frag_t *frag = &sinfo->frags[sinfo->nr_frags];
@@ -2295,8 +2296,8 @@ mvneta_swbm_add_rx_fragment(struct mvneta_port *pp,
 		skb_frag_size_set(frag, data_len);
 		__skb_frag_set_page(frag, page);
 		sinfo->nr_frags++;
-
-		rx_desc->buf_phys_addr = 0;
+	} else {
+		page_pool_put_full_page(rxq->page_pool, page, true);
 	}
 	*size -= len;
 }
-- 
2.26.2


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

* Re: [PATCH net] net: mvneta: fix possible memory leak in mvneta_swbm_add_rx_fragment
  2020-11-13 18:16 [PATCH net] net: mvneta: fix possible memory leak in mvneta_swbm_add_rx_fragment Lorenzo Bianconi
@ 2020-11-17  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-11-17  0:40 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, lorenzo.bianconi, davem, kuba, brouer, ilias.apalodimas,
	echaudro

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 13 Nov 2020 19:16:57 +0100 you wrote:
> Recycle the page running page_pool_put_full_page() in
> mvneta_swbm_add_rx_fragment routine when the last descriptor
> contains just the FCS or if the received packet contains more than
> MAX_SKB_FRAGS fragments
> 
> Fixes: ca0e014609f0 ("net: mvneta: move skb build after descriptors processing")
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net] net: mvneta: fix possible memory leak in mvneta_swbm_add_rx_fragment
    https://git.kernel.org/netdev/net/c/9c79a8ab5f12

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] 2+ messages in thread

end of thread, other threads:[~2020-11-17  0:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 18:16 [PATCH net] net: mvneta: fix possible memory leak in mvneta_swbm_add_rx_fragment Lorenzo Bianconi
2020-11-17  0:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.