]> git.baikalelectronics.ru Git - kernel.git/commit
driver: soc: xilinx: fix memory leak in xlnx_add_cb_for_notify_event()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Tue, 29 Nov 2022 01:01:46 +0000 (09:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:16 +0000 (13:55 +0100)
commitb967e44fe0cec1a03e5fa1411fc0363af1123d96
treeaf3bb207f3cd70d8dd25223f747e94843dfbf851
parente33fb10eb34409858e5843110255ffd35131c938
driver: soc: xilinx: fix memory leak in xlnx_add_cb_for_notify_event()

[ Upstream commit d7f9a187510311de3d94a152f1bdd060d7463bba ]

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: f6d7f9dd133e ("driver: soc: xilinx: Add support of multiple callbacks for same event in event management driver")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20221129010146.1026685-1-cuigaosheng1@huawei.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/xilinx/xlnx_event_manager.c