Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: redrat3: fix use-after-free in rc_dev_uevent()
@ 2026-08-06 12:10 Dmitry Antipov
  2026-08-06 12:55 ` Sean Young
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Antipov @ 2026-08-06 12:10 UTC (permalink / raw)
  To: Sean Young
  Cc: Johan Hovold, Mauro Carvalho Chehab, linux-media, lvc-project,
	Dmitry Antipov, syzbot+237c754233330b2bf565

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.

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-06 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox