[PATCH] media: xc4000: Fix potential firmware cache leak
From: Guangshuo Li
Date: Fri Nov 13 2026 - 09:37:00 EST
The last frontend release frees the shared tuner state without freeing
its firmware array or the images referenced by it. This also affects
attach failures after firmware loading has allocated part of the cache.
Free the cache before dropping the last tuner reference.
This issue was found by our static analysis tool under development.
Fixes: 11091a31fbf7 ("[media] xc4000: pull in firmware management code from xc3028")
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
drivers/media/tuners/xc4000.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c
index 900c5f2438fc..de45a6b751cf 100644
--- a/drivers/media/tuners/xc4000.c
+++ b/drivers/media/tuners/xc4000.c
@@ -1613,6 +1613,14 @@ static void xc4000_release(struct dvb_frontend *fe)
mutex_lock(&xc4000_list_mutex);
+ if (hybrid_tuner_report_instance_count(priv) == 1) {
+ int i;
+
+ for (i = 0; i < priv->firm_size; i++)
+ kfree(priv->firm[i].ptr);
+ kfree(priv->firm);
+ }
+
if (priv)
hybrid_tuner_release_state(priv);
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4