Commit 4dc7f09b authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Jakub Kicinski

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: 4feffead ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210224151842.2419-1-zajec5@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f1764114
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment