From: Greg KH <gregkh@linuxfoundation.org>
To: Jeffin Philip <jeffinphilip14@gmail.com>
Cc: dwlsalmeida@gmail.com, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, mchehab@kernel.org,
stable@vger.kernel.org,
syzbot+c7fc4794e59786f5b4dc@syzkaller.appspotmail.com
Subject: Re: [RFC PATCH] media: vidtv: fix uaf in vidtv_bridge_on_new_pkts_avail
Date: Thu, 27 Aug 2026 06:51:21 +0200 [thread overview]
Message-ID: <2026082737-traitor-shorter-a4cc@gregkh> (raw)
In-Reply-To: <20260827042615.12777-1-jeffinphilip14@gmail.com>
On Thu, Aug 27, 2026 at 09:56:15AM +0530, Jeffin Philip wrote:
> >Attempting to unbind a dvbdevice that is in the process of feeding
> >data causes a UAF as we free the underlying device without
> >stopping the feed first. Fix this by stopping the stream first using
> >vidtv_stop_streaming(). However, our codepath in the reproducer
> >(mentioned in the below reply) does not decrement our users
> >(dmxdev->dvr_dvbdev->users) to 1 after it has been incremented to 2
> >by our read() in the reproducer, that is only possible on .release.
> >This can cause a task hang as dvb_dmxdev_release() uses wait_event()
> >in the wait_queue unless we use a close(fd)(in the reproducer).
> >Is this a problem? Please advise.
>
> Reproducer:
>
> #include <fcntl.h>
> #include <unistd.h>
> #include <pthread.h>
> #include <linux/dvb/dmx.h>
> #include <sys/ioctl.h>
>
> static void *feed_thread(void *arg)
> {
> int i = 100;
> int fd = open("/dev/dvb/adapter0/demux0", O_RDWR | O_NONBLOCK);
> struct dmx_sct_filter_params params = {
> .pid = 0,
> .filter = { .filter = {0}, .mask = {0} },
> .flags = DMX_IMMEDIATE_START,
> };
> ioctl(fd, DMX_SET_FILTER, ¶ms);
> char buf[188];
> read(fd, buf, sizeof(buf));
> //no close(fd) here
> return NULL;
> }
>
> int main(void)
> {
> pthread_t t;
> pthread_create(&t, NULL, feed_thread, NULL);
> sleep(1);
> int fd = open("/sys/bus/platform/drivers/vidtv/unbind", O_WRONLY);
While "fun", this is not a normal path that users ever will hit. See
this thread where I propose tainting the kernel if you attempt to do
this:
https://lore.kernel.org/r/20260826-bind_taint-v1-0-52b05f4a965c@linuxfoundation.org
thanks,
greg k-h
next prev parent reply other threads:[~2026-08-27 4:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 4:22 [RFC PATCH] media: vidtv: fix uaf in vidtv_bridge_on_new_pkts_avail Jeffin Philip
2026-08-27 4:26 ` Jeffin Philip
2026-08-27 4:51 ` Greg KH [this message]
2026-08-27 5:15 ` Jeffin Philip
2026-08-27 5:20 ` Greg KH
2026-08-27 5:30 ` Jeffin Philip
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=2026082737-traitor-shorter-a4cc@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dwlsalmeida@gmail.com \
--cc=jeffinphilip14@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+c7fc4794e59786f5b4dc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.