diff mbox series

[net] net: broadcom: bcm4908_enet: fix RX path possible mem leak

Message ID 20210224151842.2419-1-zajec5@gmail.com
State New
Headers show
Series [net] net: broadcom: bcm4908_enet: fix RX path possible mem leak | expand

Commit Message

Rafał Miłecki Feb. 24, 2021, 3:18 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

After filling RX ring slot with new skb it's required to free old skb.
Immediately on error or later in the net subsystem.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/ethernet/broadcom/bcm4908_enet.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
index 9be33dc98072..7983c7a9fca9 100644
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
@@ -570,6 +570,7 @@  static int bcm4908_enet_poll(struct napi_struct *napi, int weight)
 
 		if (len < ETH_ZLEN ||
 		    (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
+			kfree_skb(slot.skb);
 			enet->netdev->stats.rx_dropped++;
 			break;
 		}