]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: wwan: mhi: fix memory leak in mhi_mbim_dellink
authorHW He <hw.he@mediatek.com>
Thu, 3 Nov 2022 10:54:19 +0000 (18:54 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Nov 2022 09:38:04 +0000 (09:38 +0000)
MHI driver registers network device without setting the
needs_free_netdev flag, and does NOT call free_netdev() when
unregisters network device, which causes a memory leak.

This patch sets needs_free_netdev to true when registers
network device, which makes netdev subsystem call free_netdev()
automatically after unregister_netdevice().

Fixes: 1565afe1f014 ("net: wwan: Add MHI MBIM network driver")
Signed-off-by: HW He <hw.he@mediatek.com>
Signed-off-by: Zhaoping Shu <zhaoping.shu@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wwan/mhi_wwan_mbim.c

index 6872782e8dd89a362b5ebf24b644bc0f935ce03b..ef70bb7c88ad61397d4cee697a0e9891a4cb3a2d 100644 (file)
@@ -582,6 +582,7 @@ static void mhi_mbim_setup(struct net_device *ndev)
        ndev->min_mtu = ETH_MIN_MTU;
        ndev->max_mtu = MHI_MAX_BUF_SZ - ndev->needed_headroom;
        ndev->tx_queue_len = 1000;
+       ndev->needs_free_netdev = true;
 }
 
 static const struct wwan_ops mhi_mbim_wwan_ops = {