FAILED: patch "[PATCH] Input: ims-pcu - fix firmware leak in async update" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x d48795b5cd6828d36b707e8d62fc9e5c90e004ab
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072051-gong-sweep-0821@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d48795b5cd6828d36b707e8d62fc9e5c90e004ab Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <[email protected]>
Date: Fri, 22 May 2026 10:25:31 -0700
Subject: [PATCH] Input: ims-pcu - fix firmware leak in async update
The firmware object was not being released if validation failed. Use __free(firmware) to ensure the firmware is always released.
drivers/input/misc/ims-pcu.c +2 -3
@@ -935,9 +935,10 @@ static int ims_pcu_handle_firmware_update(struct ims_pcu *pcu,return retval; } -static void ims_pcu_process_async_firmware (const struct firmware *fw, +static void ims_pcu_process_async_firmware (const struct firmware *_fw,void *context) { + const struct firmware *fw __free(firmware) = _fw;struct ims_pcu *pcu = context;int error;
@@ -957,8 +958,6 @@ static void ims_pcu_process_async_firmware(const struct firmware *fw, scoped_guard(mutex, &pcu->cmd_mutex)ims_pcu_handle_firmware_update (pcu, fw); -release_firmware (fw); - out:complete (&pcu->async_firmware_done); }
Sasha Levin
maintainerPATCH 1/2 firmware_loader: introduce __free() cleanup hanler
From: Dmitry Torokhov <[email protected]>
[ Upstream commit 8dde8fa0cc3edce73c050b9882d06c1a575f6402 ]
Define cleanup handler using facilities from linux/cleanup.h to simplify error handling in code using firmware loader. This will allow writing code like this:
int driver_update_firmware(...)
{
const struct firmware *fw_entry __free(firmware) = NULL;
int error;
...
error = request_firmware(&fw_entry, fw_name, dev);
if (error) {
dev_err(dev, "failed to request firmware %s: %d",
fw_name, error);
return error;
}
error = check_firmware_valid(fw_entry);
if (error)
return error;
guard(mutex)(&instance->lock);
error = use_firmware(instance, fw);
if (error)
return error;
return 0;
}Stable-dep-of: d48795b5cd68 ("Input: ims-pcu - fix firmware leak in async update")
--- include/linux/firmware.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/firmware.h +3 -0
@@ -4,6 +4,7 @@#include <linux/types.h> #include <linux/compiler.h> +#include <linux/cleanup.h> #include <linux/gfp.h> #define FW_ACTION_NOUEVENT 0
@@ -118,4 +119,6 @@ static inline int request_partial_firmware_into_bufint firmware_request_cache (struct device *device,const char *name); +DEFINE_FREE(firmware, struct firmware *, release_firmware(_T)) +#endif
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 Input: ims-pcu - fix firmware leak in async update
From: Dmitry Torokhov <[email protected]>
[ Upstream commit d48795b5cd6828d36b707e8d62fc9e5c90e004ab ]
The firmware object was not being released if validation failed. Use __free(firmware) to ensure the firmware is always released.
--- drivers/input/misc/ims-pcu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/input/misc/ims-pcu.c +2 -3
@@ -944,9 +944,10 @@ static int ims_pcu_handle_firmware_update(struct ims_pcu *pcu,return retval; } -static void ims_pcu_process_async_firmware (const struct firmware *fw, +static void ims_pcu_process_async_firmware (const struct firmware *_fw,void *context) { + const struct firmware *fw __free(firmware) = _fw;struct ims_pcu *pcu = context;int error;
@@ -967,8 +968,6 @@ static void ims_pcu_process_async_firmware(const struct firmware *fw,ims_pcu_handle_firmware_update (pcu, fw);mutex_unlock (&pcu->cmd_mutex); -release_firmware (fw); - out:complete (&pcu->async_firmware_done); }
Signature · 1 line
2.53.0