Patch "net: usb: lan78xx: Fix memory leak on device unplug by freeing PHY device" has been added to the 6.1-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: usb: lan78xx: Fix memory leak on device unplug by freeing PHY device

to the 6.1-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-usb-lan78xx-fix-memory-leak-on-device-unplug-by-.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 50c6c621073e44d4a0ec259457801800e1c96c9a
Author: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
Date:   Sat Nov 16 14:05:58 2024 +0100

    net: usb: lan78xx: Fix memory leak on device unplug by freeing PHY device
    
    [ Upstream commit ae7370e61c5d8f5bcefc2d4fca724bd4e9bbf789 ]
    
    Add calls to `phy_device_free` after `fixed_phy_unregister` to fix a
    memory leak that occurs when the device is unplugged. This ensures
    proper cleanup of pseudo fixed-link PHYs.
    
    Fixes: 89b36fb5e532 ("lan78xx: Lan7801 Support for Fixed PHY")
    Cc: Raghuram Chary J <raghuramchary.jallipalli@xxxxxxxxxxxxx>
    Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20241116130558.1352230-2-o.rempel@xxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index b18afd2c7aeed..ee3c13bbf6c02 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2387,6 +2387,7 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
 		if (dev->chipid == ID_REV_CHIP_ID_7801_) {
 			if (phy_is_pseudo_fixed_link(phydev)) {
 				fixed_phy_unregister(phydev);
+				phy_device_free(phydev);
 			} else {
 				phy_unregister_fixup_for_uid(PHY_KSZ9031RNX,
 							     0xfffffff0);
@@ -4246,8 +4247,10 @@ static void lan78xx_disconnect(struct usb_interface *intf)
 
 	phy_disconnect(net->phydev);
 
-	if (phy_is_pseudo_fixed_link(phydev))
+	if (phy_is_pseudo_fixed_link(phydev)) {
 		fixed_phy_unregister(phydev);
+		phy_device_free(phydev);
+	}
 
 	usb_scuttle_anchored_urbs(&dev->deferred);
 




[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