From: Krystian Kaniewski <krystianmkaniewski@gmail.com>
To: Yousef Alhouseen <alhouseenyousef@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
syzbot+40339ea82afa8184ad5d@syzkaller.appspotmail.com
Subject: Re: [PATCH] media: dvb-core: avoid dropping device ref on frontend open failure
Date: Wed, 2 Dec 2026 12:09:58 +0100 [thread overview]
Message-ID: <58f4675d-7cb0-4517-8837-427c8ac78880@gmail.com> (raw)
In-Reply-To: <20260628091844.37577-1-alhouseenyousef@gmail.com>
On 6/28/26 11:18, Yousef Alhouseen wrote:
Hi Yousef,
On Sun, Jun 28, 2026 at 11:18:44AM +0200, Yousef Alhouseen wrote:
> dvb_device_open() takes a device reference before calling the frontend
> open callback and drops that reference itself if the callback fails.
> However, the frontend error path calls dvb_generic_release(), which drops
> the same reference while merely trying to undo the user counters changed
> by dvb_generic_open().
The same double put is behind the older syzbot report "KASAN:
slab-use-after-free Read in dvb_device_open", open since December
2024. With vidtv it can be hit on demand: open the frontend read-write
while another thread keeps sending the opener a caught signal, so that
dvb_frontend_start() returns -EINTR after dvb_generic_open() has
succeeded. On v7.4-rc4 with the syzbot config, the second such failure
frees the frontend's dvb_device while dvb_minors[] still points to it,
and the next open gives exactly the syzbot report. Failing the
kthread_create_info allocation with fail-nth does the same through
-ENOMEM, and a single failure followed by an unbind of vidtv ends in a
use-after-free in dvb_media_device_free(). The syzbot program itself
gets -EINTR on every frontend open, which is why it hits the bug within
seconds. I can post the small test program if that helps.
With this patch on v7.4-rc4 (it still applies, with an offset after
the dvb_frontend_open() split), 200 interrupted opens and repeated
-ENOMEM failures leave the device usable, a second writer still gets
-EBUSY, unbinding vidtv after a failed open is clean, and the syzbot C
and syz reproducers of the older report run cleanly.
Two remarks on the tags. The double put on this path exists only since
a2dd235df435 ("media: dvbdev: drop refcount on error path in
dvb_device_open()"). With 0fc044b2b5e2 alone the dvb_generic_release()
call balanced the reference taken in dvb_device_open(), so I think the
Fixes tag should name a2dd235df435 instead. And the same patch can
close the older report:
Reported-by: syzbot+1eb177ecc3943b883f0a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1eb177ecc3943b883f0a
Tested-by: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Thanks,
--
Krystian Kaniewski
prev parent reply other threads:[~2026-12-02 11:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 9:18 Yousef Alhouseen
2026-12-02 11:09 ` Krystian Kaniewski [this message]
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=58f4675d-7cb0-4517-8837-427c8ac78880@gmail.com \
--to=krystianmkaniewski@gmail.com \
--cc=alhouseenyousef@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+40339ea82afa8184ad5d@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
all inboxes | Powered by JetHome®