coda_fw_callback() owns the firmware passed to it by request_firmware_nowait(). It normally releases the firmware after copying it into the BIT processor's code buffer. If allocating that buffer fails, the callback jumps to put_pm and skips release_firmware(), leaking the firmware and its associated resources. Release the firmware before jumping to put_pm, which drops the runtime PM reference taken in coda_probe(). An AI coding assistant helped identify the leak during review of static analysis results and helped draft the fix and commit message. Fixes: 186b250a0725 ("[media] media: coda: Add driver for Coda video codec") Cc: stable@vger.kernel.org Signed-off-by: Yige Jiang --- Based on linux-next next-20261109 (630059a5a632). Compile-tested: arm64 coda-common.o with GCC 14.2 and W=1, CONFIG_COMPILE_TEST=y, CONFIG_ARCH_MXC=y and CONFIG_VIDEO_CODA=m. The baseline and patched object builds both produced 0 warnings. No hardware or runtime test was performed. The path needs the coherent DMA allocation of the code buffer to fail in the async firmware callback (OOM or fault injection). drivers/media/platform/chips-media/coda/coda-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/drivers/media/platform/chips-media/coda/coda-common.c index 3fe33c4..ca8f953 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -3004,8 +3004,10 @@ static void coda_fw_callback(const struct firmware *fw, void *context) /* allocate auxiliary per-device code buffer for the BIT processor */ ret = coda_alloc_aux_buf(dev, &dev->codebuf, fw->size, "codebuf", dev->debugfs_root); - if (ret < 0) + if (ret < 0) { + release_firmware(fw); goto put_pm; + } coda_copy_firmware(dev, fw->data, fw->size); release_firmware(fw); base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47