Patch "net: ehea: fix possible memory leak in ehea_register_port()" has been added to the 4.14-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: ehea: fix possible memory leak in ehea_register_port()

to the 4.14-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-ehea-fix-possible-memory-leak-in-ehea_register_p.patch
and it can be found in the queue-4.14 subdirectory.

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



commit 20dd278c0b2a188b02fd11ee1c8e6f3ab8d4a25a
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Tue Oct 25 21:00:11 2022 +0800

    net: ehea: fix possible memory leak in ehea_register_port()
    
    [ Upstream commit 0e7ce23a917a9cc83ca3c779fbba836bca3bcf1e ]
    
    If of_device_register() returns error, the of node and the
    name allocated in dev_set_name() is leaked, call put_device()
    to give up the reference that was set in device_initialize(),
    so that of node is put in logical_port_release() and the name
    is freed in kobject_cleanup().
    
    Fixes: 1acf2318dd13 ("ehea: dynamic add / remove port")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221025130011.1071357-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index a754e2ce7730..c3606e8b1192 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -2928,6 +2928,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
 	ret = of_device_register(&port->ofdev);
 	if (ret) {
 		pr_err("failed to register device. ret=%d\n", ret);
+		put_device(&port->ofdev.dev);
 		goto out;
 	}
 



[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