net: dm9051: Fix missing dev_kfree_skb() in dm9051_loop_rx()
authorYuan Can <yuancan@huawei.com>
Mon, 21 Nov 2022 03:32:26 +0000 (03:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Nov 2022 12:43:14 +0000 (12:43 +0000)
The dm9051_loop_rx() returns without release skb when dm9051_stop_mrcmd()
returns error, free the skb to avoid this leak.

Fixes: 2dc95a4d30ed ("net: Add dm9051 driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/davicom/dm9051.c

index a523ddd..de7105a 100644 (file)
@@ -798,8 +798,10 @@ static int dm9051_loop_rx(struct board_info *db)
                }
 
                ret = dm9051_stop_mrcmd(db);
-               if (ret)
+               if (ret) {
+                       dev_kfree_skb(skb);
                        return ret;
+               }
 
                skb->protocol = eth_type_trans(skb, db->ndev);
                if (db->ndev->features & NETIF_F_RXCSUM)