Patch "driver: soc: xilinx: fix memory leak in xlnx_add_cb_for_notify_event()" 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

    driver: soc: xilinx: fix memory leak in xlnx_add_cb_for_notify_event()

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:
     driver-soc-xilinx-fix-memory-leak-in-xlnx_add_cb_for.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 d6401cb8f6e03920b3da4b5e46e59b49d042c523
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Tue Nov 29 09:01:46 2022 +0800

    driver: soc: xilinx: fix memory leak in xlnx_add_cb_for_notify_event()
    
    [ Upstream commit 1bea534991b9b35c41848a397666ada436456beb ]
    
    The kfree() should be called when memory fails to be allocated for
    cb_data in xlnx_add_cb_for_notify_event(), otherwise there will be
    a memory leak, so add kfree() to fix it.
    
    Fixes: 05e5ba40ea7a ("driver: soc: xilinx: Add support of multiple callbacks for same event in event management driver")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Acked-by: Michal Simek <michal.simek@xxxxxxx>
    Link: https://lore.kernel.org/r/20221129010146.1026685-1-cuigaosheng1@xxxxxxxxxx
    Signed-off-by: Michal Simek <michal.simek@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c
index 2de082765befa..c76381899ef49 100644
--- a/drivers/soc/xilinx/xlnx_event_manager.c
+++ b/drivers/soc/xilinx/xlnx_event_manager.c
@@ -116,8 +116,10 @@ static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, cons
 		INIT_LIST_HEAD(&eve_data->cb_list_head);
 
 		cb_data = kmalloc(sizeof(*cb_data), GFP_KERNEL);
-		if (!cb_data)
+		if (!cb_data) {
+			kfree(eve_data);
 			return -ENOMEM;
+		}
 		cb_data->eve_cb = cb_fun;
 		cb_data->agent_data = data;
 



[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