Skip to content

Commit b266bac

Browse files
Eitschmankuba-moo
authored andcommitted
net: ethernet: cortina: Drop half-assembled SKB
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: 4d5ae32 ("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> Link: https://patch.msgid.link/20260505-gemini-ethernet-fix-v2-1-997c31d06079@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2b1f48c commit b266bac

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/net/ethernet/cortina/gemini.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,11 @@ static unsigned int gmac_rx(struct net_device *netdev, unsigned int budget)
14911491
gpage = gmac_get_queue_page(geth, port, mapping + PAGE_SIZE);
14921492
if (!gpage) {
14931493
dev_err(geth->dev, "could not find mapping\n");
1494+
if (skb) {
1495+
napi_free_frags(&port->napi);
1496+
port->stats.rx_dropped++;
1497+
skb = NULL;
1498+
}
14941499
continue;
14951500
}
14961501
page = gpage->page;

0 commit comments

Comments
 (0)