Linux Media Controller development
 help / color / mirror / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Sean Young <sean@mess.org>
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 16:05:25 +0300	[thread overview]
Message-ID: <a78eff76-dccd-4f3a-9487-abb511bd44f3@yandex.ru> (raw)
In-Reply-To: <anSEMRFIW1LGz5mC@extorris.mess.org>

On 8/6/26 3:55 PM, Sean Young wrote:

> you need to call rc_allocate_device() before you call redrat3_enable_detector()

If so, 'rc_unregister_device()' should be called immediately after
'redrat3_enable_detector()' has detected an error. That is,

diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 3f828a564e19..d2a805dbd3f3 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -1111,13 +1111,16 @@ static int redrat3_dev_probe(struct usb_interface *intf,
         /* might be all we need to do? */
         retval = redrat3_enable_detector(rr3);
         if (retval < 0)
-               goto led_free;
+               goto rc_free;

         /* we can register the device now, as it is ready */
         usb_set_intfdata(intf, rr3);

         return 0;

+rc_free:
+       rc_unregister_device(rr3->rc);
+       rc_free_device(rr3->rc);
  led_free:
         led_classdev_unregister(&rr3->led);
  redrat_free:

Dmitry


  reply	other threads:[~2026-08-06 13:11 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
2026-08-06 13:05   ` Dmitry Antipov [this message]
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=a78eff76-dccd-4f3a-9487-abb511bd44f3@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=johan@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mchehab@kernel.org \
    --cc=sean@mess.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