Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] net: ethernet: cortina: Drop half-assembled SKB
@ 2026-05-05 21:52 Linus Walleij
  2026-05-06 14:02 ` Alexander Lobakin
  2026-05-07  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2026-05-05 21:52 UTC (permalink / raw)
  To: Hans Ulli Kroll, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michał Mirosław,
	Li Xiasong
  Cc: netdev, Andreas Haarmann-Thiemann, Linus Walleij

From: Andreas Haarmann-Thiemann <eitschman@nebelreich.de>

In gmac_rx() (drivers/net/ethernet/cortina/gemini.c), when
gmac_get_queue_page() returns NULL for the second page of a multi-page
fragment, the driver logs an error and continues — but does not free the
partially assembled skb that was being assembled via napi_build_skb() /
napi_get_frags().

Free the in-progress partially assembled skb via napi_free_frags()
and increase the number of dropped frames appropriately
and assign the skb pointer NULL to make sure it is not lingering
around, matching the pattern already used elsewhere in the driver.

Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Signed-off-by: Andreas Haarmann-Thiemann <eitschman@nebelreich.de>
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Changes in v2:
- Fix up the commit message so it is clear what the patch is doing.
- Also increase the number of dropped frames as noted by Li Xiasong.
- Link to v1: https://lore.kernel.org/r/20260330-gemini-ethernet-fix-v1-1-18783a45d13a@kernel.org
---
 drivers/net/ethernet/cortina/gemini.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index 4824232f4890..065cbbf52686 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -1491,6 +1491,11 @@ static unsigned int gmac_rx(struct net_device *netdev, unsigned int budget)
 		gpage = gmac_get_queue_page(geth, port, mapping + PAGE_SIZE);
 		if (!gpage) {
 			dev_err(geth->dev, "could not find mapping\n");
+			if (skb) {
+				napi_free_frags(&port->napi);
+				port->stats.rx_dropped++;
+				skb = NULL;
+			}
 			continue;
 		}
 		page = gpage->page;

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260330-gemini-ethernet-fix-604c28c53da1

Best regards,
--  
Linus Walleij <linusw@kernel.org>


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

* Re: [PATCH net v2] net: ethernet: cortina: Drop half-assembled SKB
  2026-05-05 21:52 [PATCH net v2] net: ethernet: cortina: Drop half-assembled SKB Linus Walleij
@ 2026-05-06 14:02 ` Alexander Lobakin
  2026-05-07  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Lobakin @ 2026-05-06 14:02 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Hans Ulli Kroll, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michał Mirosław,
	Li Xiasong, netdev, Andreas Haarmann-Thiemann

From: Linus Walleij <linusw@kernel.org>
Date: Tue, 05 May 2026 23:52:17 +0200

> From: Andreas Haarmann-Thiemann <eitschman@nebelreich.de>
> 
> In gmac_rx() (drivers/net/ethernet/cortina/gemini.c), when
> gmac_get_queue_page() returns NULL for the second page of a multi-page
> fragment, the driver logs an error and continues — but does not free the
> partially assembled skb that was being assembled via napi_build_skb() /
> napi_get_frags().
> 
> Free the in-progress partially assembled skb via napi_free_frags()
> and increase the number of dropped frames appropriately
> and assign the skb pointer NULL to make sure it is not lingering
> around, matching the pattern already used elsewhere in the driver.
> 
> Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet")
> Signed-off-by: Andreas Haarmann-Thiemann <eitschman@nebelreich.de>
> Signed-off-by: Linus Walleij <linusw@kernel.org>

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

> ---
> Changes in v2:
> - Fix up the commit message so it is clear what the patch is doing.
> - Also increase the number of dropped frames as noted by Li Xiasong.
> - Link to v1: https://lore.kernel.org/r/20260330-gemini-ethernet-fix-v1-1-18783a45d13a@kernel.org
> ---
>  drivers/net/ethernet/cortina/gemini.c | 5 +++++
>  1 file changed, 5 insertions(+)

Thanks,
Olek

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

* Re: [PATCH net v2] net: ethernet: cortina: Drop half-assembled SKB
  2026-05-05 21:52 [PATCH net v2] net: ethernet: cortina: Drop half-assembled SKB Linus Walleij
  2026-05-06 14:02 ` Alexander Lobakin
@ 2026-05-07  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-07  2:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: ulli.kroll, andrew+netdev, davem, edumazet, kuba, pabeni,
	mirq-linux, lixiasong1, netdev, eitschman

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 05 May 2026 23:52:17 +0200 you wrote:
> From: Andreas Haarmann-Thiemann <eitschman@nebelreich.de>
> 
> In gmac_rx() (drivers/net/ethernet/cortina/gemini.c), when
> gmac_get_queue_page() returns NULL for the second page of a multi-page
> fragment, the driver logs an error and continues — but does not free the
> partially assembled skb that was being assembled via napi_build_skb() /
> napi_get_frags().
> 
> [...]

Here is the summary with links:
  - [net,v2] net: ethernet: cortina: Drop half-assembled SKB
    https://git.kernel.org/netdev/net/c/b266bacba796

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:[~2026-05-07  2:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 21:52 [PATCH net v2] net: ethernet: cortina: Drop half-assembled SKB Linus Walleij
2026-05-06 14:02 ` Alexander Lobakin
2026-05-07  2:00 ` 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