net: broadcom: bcm4908_enet: fix RX path possible mem leak
After filling RX ring slot with new skb it's required to free old skb. Immediately on error or later in the net subsystem. Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20210224151842.2419-1-zajec5@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f176411401
commit
4dc7f09b8b
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user