* [PATCH] media: dvb-usb: fix refcount leak in dvb_usb_adapter_frontend_init()
@ 2026-06-09 4:03 Wentao Liang
0 siblings, 0 replies; only message in thread
From: Wentao Liang @ 2026-06-09 4:03 UTC (permalink / raw)
To: mchehab; +Cc: kees, linux-media, linux-kernel, Wentao Liang, stable
After all frontends are registered via dvb_register_frontend(),
if dvb_create_media_graph() or dvb_usb_media_device_register()
fails, the function returns directly without calling
dvb_unregister_frontend() and dvb_frontend_detach() for each
frontend. This leaves them with a leaked reference count.
The caller's error path calls dvb_usb_adapter_dvb_exit() which
does not handle frontend cleanup. Add the missing cleanup by
calling dvb_usb_adapter_frontend_exit() on the error path.
Fixes: 9f80679511b0 ("[media] usb: check media device errors")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/media/usb/dvb-usb/dvb-usb-dvb.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
index 029dad86a059..923f25ccb1e8 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
@@ -326,10 +326,16 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
ret = dvb_create_media_graph(&adap->dvb_adap, true);
if (ret)
- return ret;
+ goto err_fe_cleanup;
ret = dvb_usb_media_device_register(adap);
+ if (ret)
+ goto err_fe_cleanup;
+
+ return ret;
+err_fe_cleanup:
+ dvb_usb_adapter_frontend_exit(adap);
return ret;
}
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-09 4:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-09 4:03 [PATCH] media: dvb-usb: fix refcount leak in dvb_usb_adapter_frontend_init() Wentao Liang
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®