diff options
author | HW He <hw.he@mediatek.com> | 2022-11-03 18:54:19 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-11-07 09:38:04 +0000 |
commit | 668205b9c9f94d5ed6ab00cce9a46a654c2b5d16 (patch) | |
tree | 671ac5823eb4c3b3cd3fd2bc150a91c143c0b344 /drivers/net/wwan | |
parent | f25caaca424703d5a0607310f0452f978f1f78d9 (diff) |
net: wwan: mhi: fix memory leak in mhi_mbim_dellink
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: aa730a9905b7 ("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>
Diffstat (limited to 'drivers/net/wwan')
-rw-r--r-- | drivers/net/wwan/mhi_wwan_mbim.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c index 6872782e8dd8..ef70bb7c88ad 100644 --- a/drivers/net/wwan/mhi_wwan_mbim.c +++ b/drivers/net/wwan/mhi_wwan_mbim.c @@ -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 = { |