From: Yun Zhou <yun.zhou@windriver.com>
To: <mchehab@kernel.org>, <kees@kernel.org>, <linma@zju.edu.cn>
Cc: <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<yun.zhou@windriver.com>
Subject: [PATCH v3] media: dvb-core: fix use-after-free in dvb_frontend_open()
Date: Wed, 10 Jun 2026 16:30:55 +0800 [thread overview]
Message-ID: <20260610083055.3976083-1-yun.zhou@windriver.com> (raw)
dvb_frontend_open() calls dvb_generic_release() in its error path after
dvb_generic_open() succeeds. dvb_generic_release() drops the device
reference via dvb_device_put(), and then dvb_device_open() drops it again
in its error handling, causing a use-after-free and refcount underflow.
Fix this by incrementing the refcount before dvb_generic_release() in the
error path, so that the put inside dvb_generic_release() is balanced and
dvb_device_open() remains the sole effective put on open failure.
Reported-by: syzbot+40339ea82afa8184ad5d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=40339ea82afa8184ad5d
Cc: stable@vger.kernel.org
Fixes: 0fc044b2b5e2 ("media: dvbdev: adopts refcnt to avoid UAF")
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
---
v3:
- Simplify fix: increment refcount before dvb_generic_release() instead
of introducing __dvb_generic_release()
v2:
- Fix Fixes tag commit title
- Add Closes: link after Reported-by
- Cc stable@vger.kernel.org
drivers/media/dvb-core/dvb_frontend.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index d082b6c57c76..608525d08277 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2887,6 +2887,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
mutex_unlock(&fe->dvb->mdev_lock);
err2:
#endif
+ dvb_device_get(dvbdev);
dvb_generic_release(inode, file);
err1:
if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl)
--
2.43.0
next reply other threads:[~2026-06-10 8:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 8:30 Yun Zhou [this message]
2026-06-17 0:29 ` Zhou, Yun
2026-06-25 11:24 ` Zhou, Yun
2026-07-02 10:01 ` Zhou, Yun
2026-07-07 6:55 ` Zhou, Yun
2026-07-14 5:39 ` Zhou, Yun
-- strict thread matches above, loose matches on Subject: below --
2026-05-22 3:02 Yun Zhou
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=20260610083055.3976083-1-yun.zhou@windriver.com \
--to=yun.zhou@windriver.com \
--cc=kees@kernel.org \
--cc=linma@zju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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®