mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] remoteproc: qcom: pas: Release DTB firmware after load
@ 2026-10-22 14:54 Anup Vishwakarma
  2026-10-23  8:05 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Anup Vishwakarma @ 2026-10-22 14:54 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Neil Armstrong
  Cc: linux-arm-msm, linux-remoteproc, linux-kernel, stable, Anup Vishwakarma

qcom_pas_load() releases the DTB firmware only when
qcom_mdt_pas_load() fails. On success the firmware is never released,
so the DTB image stays allocated, and each later load leaks another
struct firmware and an extra reference to the shared firmware buffer.

The firmware is not needed once qcom_mdt_pas_load() returns, since the
metadata and segments have already been copied. Release it right after
the call, on both paths, and clear the pointer.

Fixes: 29814986b82e ("remoteproc: qcom_q6v5_pas: add support for dtb co-firmware loading")
Cc: stable@vger.kernel.org
Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
---
 drivers/remoteproc/qcom_q6v5_pas.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 2e1e39826ffa..2ac21c502d35 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -279,9 +279,10 @@ static int qcom_pas_load(struct rproc *rproc, const struct firmware *fw)
 
 		ret = qcom_mdt_pas_load(pas->dtb_pas_ctx, pas->dtb_firmware,
 					pas->dtb_firmware_name, &pas->dtb_mem_reloc);
+		release_firmware(pas->dtb_firmware);
+		pas->dtb_firmware = NULL;
 		if (ret) {
 			qcom_pas_metadata_release(pas->dtb_pas_ctx);
-			release_firmware(pas->dtb_firmware);
 			return ret;
 		}
 	}

---
base-commit: 9a482184d910775cf648863148944945b74e2815
change-id: 20261022-b4-qcom_pas_dtb_fw_release-95c140645cec

Best regards,
--  
Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] remoteproc: qcom: pas: Release DTB firmware after load
  2026-10-22 14:54 [PATCH] remoteproc: qcom: pas: Release DTB firmware after load Anup Vishwakarma
@ 2026-10-23  8:05 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-10-23  8:05 UTC (permalink / raw)
  To: Anup Vishwakarma, Bjorn Andersson, Mathieu Poirier, Neil Armstrong
  Cc: linux-arm-msm, linux-remoteproc, linux-kernel, stable

On 10/22/26 4:54 PM, Anup Vishwakarma wrote:
> qcom_pas_load() releases the DTB firmware only when
> qcom_mdt_pas_load() fails. On success the firmware is never released,
> so the DTB image stays allocated, and each later load leaks another
> struct firmware and an extra reference to the shared firmware buffer.
> 
> The firmware is not needed once qcom_mdt_pas_load() returns, since the
> metadata and segments have already been copied. Release it right after
> the call, on both paths, and clear the pointer.
> 
> Fixes: 29814986b82e ("remoteproc: qcom_q6v5_pas: add support for dtb co-firmware loading")
> Cc: stable@vger.kernel.org
> Signed-off-by: Anup Vishwakarma <anup.vishwakarma@oss.qualcomm.com>
> ---

nice!

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-23  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 14:54 [PATCH] remoteproc: qcom: pas: Release DTB firmware after load Anup Vishwakarma
2026-10-23  8:05 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®