From: Jeffin Philip <jeffinphilip14@gmail.com>
To: mchehab@kernel.org
Cc: kees@kernel.org, hverkuil+cisco@kernel.org, ribalda@chromium.org,
sakari.ailus@linux.intel.com, linma@zju.edu.cn,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+37578f730d38898f4b74@syzkaller.appspotmail.com,
Jeffin Philip <jeffinphilip14@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] media: dvbdev: fix uaf in dvb_remove_device()
Date: Sat, 22 Aug 2026 16:52:56 +0530 [thread overview]
Message-ID: <20260822112256.12346-1-jeffinphilip14@gmail.com> (raw)
In dvb_remove_device(), dvb_media_device_free(), device_destroy()
and list_del() all dereference dvbdev regardless of its refcount.
Thus, if refcount for dvbdev is 1, it can be freed and we
operate on freed memory causing a UAF. Fix this by moving
dvb_device_put() at the end of dvb_remove_device() so dvbdev
members can be safely freed and assigned NULL when dvbdev is alive.
Reported-by: syzbot+37578f730d38898f4b74@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=37578f730d38898f4b74
Fixes: 0fc044b2b5e2 ("media: dvbdev: adopts refcnt to avoid UAF")
Cc: stable@vger.kernel.org
Signed-off-by: Jeffin Philip <jeffinphilip14@gmail.com>
---
drivers/media/dvb-core/dvbdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index d753d329502a..9aa4b8fd7379 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -598,7 +598,6 @@ void dvb_remove_device(struct dvb_device *dvbdev)
down_write(&minor_rwsem);
dvb_minors[dvbdev->minor] = NULL;
- dvb_device_put(dvbdev);
up_write(&minor_rwsem);
dvb_media_device_free(dvbdev);
@@ -606,6 +605,8 @@ void dvb_remove_device(struct dvb_device *dvbdev)
device_destroy(dvb_class, MKDEV(DVB_MAJOR, dvbdev->minor));
list_del(&dvbdev->list_head);
+
+ dvb_device_put(dvbdev);
}
EXPORT_SYMBOL(dvb_remove_device);
--
2.55.0
reply other threads:[~2026-08-22 11:23 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=20260822112256.12346-1-jeffinphilip14@gmail.com \
--to=jeffinphilip14@gmail.com \
--cc=hverkuil+cisco@kernel.org \
--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 \
--cc=ribalda@chromium.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+37578f730d38898f4b74@syzkaller.appspotmail.com \
/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