All of lore.kernel.org
 help / color / mirror / Atom feed
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 14:13:12 +0100	[thread overview]
Message-ID: <anSIaB1bLk_2jFOJ@extorris.mess.org> (raw)
In-Reply-To: <a78eff76-dccd-4f3a-9487-abb511bd44f3@yandex.ru>

On Thu, Aug 06, 2026 at 04:05:25PM +0300, Dmitry Antipov wrote:
> 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,

So this problem is already solved in a better way by a patch I wrote which
is already out for review:

https://lkml.org/lkml/2026/7/29/1730

Sean

> 
> 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:13 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
2026-08-06 13:13     ` Sean Young [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=anSIaB1bLk_2jFOJ@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 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.