From: Wentao Liang <vulab@iscas.ac.cn>
To: mchehab@kernel.org
Cc: kees@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] media: dvb-usb: fix refcount leak in dvb_usb_adapter_frontend_init()
Date: Tue, 9 Jun 2026 04:03:37 +0000 [thread overview]
Message-ID: <20260609040337.192589-1-vulab@iscas.ac.cn> (raw)
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
reply other threads:[~2026-06-09 4:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260609040337.192589-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®