This is a note to let you know that I've just added the patch titled driver core: location: Free struct acpi_pld_info *pld before return false to the 6.2-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-core-location-free-struct-acpi_pld_info-pld-b.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 026230c5cff165a21d7b2430018ed70c4784af20 Author: Hanjun Guo <guohanjun@xxxxxxxxxx> Date: Tue Nov 22 15:37:28 2022 +0800 driver core: location: Free struct acpi_pld_info *pld before return false [ Upstream commit 0d150f967e8410e1e6712484543eec709356a65d ] struct acpi_pld_info *pld should be freed before the return of allocation failure, to prevent memory leak, add the ACPI_FREE() to fix it. Fixes: bc443c31def5 ("driver core: location: Check for allocations failure") Signed-off-by: Hanjun Guo <guohanjun@xxxxxxxxxx> Link: https://lore.kernel.org/r/1669102648-11517-1-git-send-email-guohanjun@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c index 87af641cfe1a3..951819e71b4ad 100644 --- a/drivers/base/physical_location.c +++ b/drivers/base/physical_location.c @@ -24,8 +24,11 @@ bool dev_add_physical_location(struct device *dev) dev->physical_location = kzalloc(sizeof(*dev->physical_location), GFP_KERNEL); - if (!dev->physical_location) + if (!dev->physical_location) { + ACPI_FREE(pld); return false; + } + dev->physical_location->panel = pld->panel; dev->physical_location->vertical_position = pld->vertical_position; dev->physical_location->horizontal_position = pld->horizontal_position;