mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Peech <linux@jrpmail.ca>
To: mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	eadavis@qq.com, Joel Peech <linux@jrpmail.ca>,
	syzbot+3825a6102073c418fe41@syzkaller.appspotmail.com
Subject: [PATCH] media: usb: as102: initialize mutexes before registration
Date: Tue,  2 Jun 2026 10:55:29 -0500	[thread overview]
Message-ID: <20260602155529.4097328-1-linux@jrpmail.ca> (raw)
In-Reply-To: <tencent_F063E97E23B8C4431762377E26CC336AE305@qq.com>

as102_dvb_register() initializes as102_dev->sem and bus_adap.lock
after registering DVB demux and frontend objects. Those registration
paths can expose callbacks before the mutexes are initialized.

syzbot can then reach as102_dvb_dmx_start_feed(), which locks
as102_dev->sem and triggers lockdep's uninitialized-lock warning.
Frontend callbacks can also use bus_adap.lock after
dvb_register_frontend().

Initialize both mutexes before the demux and frontend callbacks are
registered.

Reported-by: syzbot+3825a6102073c418fe41@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3825a6102073c418fe41
Link: https://lore.kernel.org/r/tencent_F063E97E23B8C4431762377E26CC336AE305@qq.com
Assisted-by: Codex:GPT-5
Signed-off-by: Joel Peech <linux@jrpmail.ca>
---
 drivers/media/usb/as102/as102_drv.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/as102/as102_drv.c b/drivers/media/usb/as102/as102_drv.c
index 6b1d3528a..60827acd7 100644
--- a/drivers/media/usb/as102/as102_drv.c
+++ b/drivers/media/usb/as102/as102_drv.c
@@ -296,6 +296,12 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)
 		return ret;
 	}
 
+	/* init bus mutex for token locking */
+	mutex_init(&as102_dev->bus_adap.lock);
+
+	/* init start / stop stream mutex */
+	mutex_init(&as102_dev->sem);
+
 	as102_dev->dvb_dmx.priv = as102_dev;
 	as102_dev->dvb_dmx.filternum = pid_filtering ? 16 : 256;
 	as102_dev->dvb_dmx.feednum = 256;
@@ -341,12 +347,6 @@ int as102_dvb_register(struct as102_dev_t *as102_dev)
 		goto efereg;
 	}
 
-	/* init bus mutex for token locking */
-	mutex_init(&as102_dev->bus_adap.lock);
-
-	/* init start / stop stream mutex */
-	mutex_init(&as102_dev->sem);
-
 	/*
 	 * try to load as102 firmware. If firmware upload failed, we'll be
 	 * able to upload it later.

base-commit: 6f3ed7fec72fc8979b2a8c7219c0a9fcfc8d07b5
-- 
2.54.0


      reply	other threads:[~2026-06-02 15:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26  5:13 [syzbot] [media?] INFO: trying to register non-static key in as102_dvb_dmx_start_feed syzbot
2026-03-26  9:29 ` Edward Adam Davis
2026-03-26 10:12   ` syzbot
2026-03-26 11:13 ` Edward Adam Davis
2026-03-26 11:44   ` syzbot
2026-03-26 12:15 ` Edward Adam Davis
2026-03-26 12:40   ` syzbot
2026-03-26 12:45 ` Edward Adam Davis
2026-03-26 13:12   ` syzbot
2026-03-26 13:17 ` [PATCH] media: usb: as102: fix race condition between ioctl and register Edward Adam Davis
2026-06-02 15:55   ` Joel Peech [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=20260602155529.4097328-1-linux@jrpmail.ca \
    --to=linux@jrpmail.ca \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=syzbot+3825a6102073c418fe41@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®