From: Sean Young <sean@mess.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Johan Hovold <johan@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, lvc-project@linuxtesting.org,
syzbot+237c754233330b2bf565@syzkaller.appspotmail.com
Subject: Re: [PATCH] media: redrat3: fix use-after-free in rc_dev_uevent()
Date: Thu, 6 Aug 2026 13:55:13 +0100 [thread overview]
Message-ID: <anSEMRFIW1LGz5mC@extorris.mess.org> (raw)
In-Reply-To: <20260806121021.25156-1-dmantipov@yandex.ru>
On Thu, Aug 06, 2026 at 03:10:21PM +0300, Dmitry Antipov wrote:
> In 'redrat3_dev_probe()', it makes no sense to register the device
> in rc subsystem until it is completely initialized (i.e. passes
> 'redrat3_enable_detector()' successfully). Otherwise the device
> may be announced as ready to receive events even if was freed
> by 'redrat3_delete()' during error recovery after probing.
I don't think this fixes the problem properly. First of all, you enabled
the IR detector before rr3->rc is allocated, you will get null deferences
in ir_raw_event_store() in the usb callbacks. So you need to call
rc_allocate_device() before you call redrat3_enable_detector().
Secondly you need to explain better how this patch solves the problem,
because I don't understand why it would fix anything at all.
Sena
>
> Reported-by: syzbot+237c754233330b2bf565@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=237c754233330b2bf565
> Fixes: 8a21ec9bb3ec ("[media] redrat3: fix error paths in probe")
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> drivers/media/rc/redrat3.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
> index 3f828a564e19..34ea8fe9aa18 100644
> --- a/drivers/media/rc/redrat3.c
> +++ b/drivers/media/rc/redrat3.c
> @@ -1102,18 +1102,17 @@ static int redrat3_dev_probe(struct usb_interface *intf,
> if (retval)
> goto redrat_free;
>
> - rr3->rc = redrat3_init_rc_dev(rr3);
> - if (!rr3->rc) {
> - retval = -ENOMEM;
> - goto led_free;
> - }
> -
> /* might be all we need to do? */
> retval = redrat3_enable_detector(rr3);
> if (retval < 0)
> goto led_free;
>
> /* we can register the device now, as it is ready */
> + rr3->rc = redrat3_init_rc_dev(rr3);
> + if (!rr3->rc) {
> + retval = -ENOMEM;
> + goto led_free;
> + }
> usb_set_intfdata(intf, rr3);
>
> return 0;
> --
> 2.55.0
next prev parent reply other threads:[~2026-08-06 13:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 12:10 [PATCH] media: redrat3: fix use-after-free in rc_dev_uevent() Dmitry Antipov
2026-08-06 12:55 ` Sean Young [this message]
2026-08-06 13:05 ` Dmitry Antipov
2026-08-06 13:13 ` Sean Young
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=anSEMRFIW1LGz5mC@extorris.mess.org \
--to=sean@mess.org \
--cc=dmantipov@yandex.ru \
--cc=johan@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mchehab@kernel.org \
--cc=syzbot+237c754233330b2bf565@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