Skip to contentSkip to conversation

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

PATCH In review Rafał Miłecki 3 participants 5 messages Feb 24, 2021 – Feb 25, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: broadcom: bcm4908_enet: fix RX path possible mem leak

From: Rafał Miłecki <[email protected]>

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

---
 drivers/net/ethernet/broadcom/bcm4908_enet.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bcm4908_enet.c +1 -0
index 9be33dc98072..7983c7a9fca9 100644
@@ -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;
 		}
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 net: broadcom: bcm4908_enet: fix NAPI poll returned value

From: Rafał Miłecki <[email protected]>

Missing increment was resulting in poll function always returning 0 instead of amount of processed packets.

---
 drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bcm4908_enet.c +2 -0
index 7983c7a9fca9..0b70e9e0ddad 100644
@@ -583,6 +583,8 @@ static int bcm4908_enet_poll(struct napi_struct *napi, int weight)
 
 		enet->netdev->stats.rx_packets++;
 		enet->netdev->stats.rx_bytes += len;
+
+		handled++;
 	}
 
 	if (handled < weight) {
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH net] net: broadcom: bcm4908_enet: fix NAPI poll returned value

Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Missing increment was resulting in poll function always returning 0 instead of amount of processed packets.

Fixes 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller

driver")

Signature · 1 line
Florian
maintainer Applied
#3 lore raw

Re: [PATCH net] net: broadcom: bcm4908_enet: fix NAPI poll returned value

Quoted 11 lines · On Wed, 24 Feb 2021 09:06:18 -0800 Florian Fainelli wrote:
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Missing increment was resulting in poll function always returning 0 instead of amount of processed packets.

Fixes 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller

driver")

Applied, thank you!