8a2432412236a8f77bae16daff7ff2bb2659ff5c
[openwrt/staging/ynezz.git] /
1 From 4dc7f09b8becfa35a55430a49d95acf19f996e6b Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Wed, 24 Feb 2021 16:18:41 +0100
4 Subject: [PATCH] net: broadcom: bcm4908_enet: fix RX path possible mem leak
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 After filling RX ring slot with new skb it's required to free old skb.
10 Immediately on error or later in the net subsystem.
11
12 Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Acked-by: Florian Fainelli <f.fainelli@gmail.com>
15 Link: https://lore.kernel.org/r/20210224151842.2419-1-zajec5@gmail.com
16 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
17 ---
18 drivers/net/ethernet/broadcom/bcm4908_enet.c | 1 +
19 1 file changed, 1 insertion(+)
20
21 --- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
22 +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
23 @@ -570,6 +570,7 @@ static int bcm4908_enet_poll(struct napi
24
25 if (len < ETH_ZLEN ||
26 (ctl & (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) != (DMA_CTL_STATUS_SOP | DMA_CTL_STATUS_EOP)) {
27 + kfree_skb(slot.skb);
28 enet->netdev->stats.rx_dropped++;
29 break;
30 }