Patch "net: mhi: Fix memory leak in mhi_net_dellink()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: mhi: Fix memory leak in mhi_net_dellink()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-mhi-fix-memory-leak-in-mhi_net_dellink.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 77f2760d108f7e715336ce9bb8f413c255eb93ab
Author: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
Date:   Fri Nov 11 09:20:44 2022 +0000

    net: mhi: Fix memory leak in mhi_net_dellink()
    
    [ Upstream commit f7c125bd79f50ec6094761090be81d02726ec6f4 ]
    
    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 calls free_netdev() to fix it since netdev_priv
    is used after unregister.
    
    Fixes: 13adac032982 ("net: mhi_net: Register wwan_ops for link creation")
    Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index aaa628f859fd..f84554aa02af 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -343,6 +343,8 @@ static void mhi_net_dellink(struct mhi_device *mhi_dev, struct net_device *ndev)
 
 	kfree_skb(mhi_netdev->skbagg_head);
 
+	free_netdev(ndev);
+
 	dev_set_drvdata(&mhi_dev->dev, NULL);
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux