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

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



commit bf9a03b037bc3dd6c970fe0ca2293d3c7cfe36dd
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 5a1fe49030b1..25f579a924d6 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -2916,6 +2916,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