All of lore.kernel.org
 help / color / mirror / Atom feed
From: CJ <firefly0158@163.com>
To: gregkh@linuxfoundation.org, oneukum@suse.com,
	n7l8m4@u.northwestern.edu, kees@kernel.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] usb: mdc800: possible circular locking dependency between io_lock and minor_rwsem
Date: Mon, 14 Sep 2026 15:36:36 +0800 (CST)	[thread overview]
Message-ID: <5c30f641.6b79.1a09ed8b2bf.Coremail.firefly0158@163.com> (raw)


Hi,


I am reporting a lockdep-detected circular locking dependency in the mdc800 USB
driver, triggered by a syzkaller USB reproducer.  The issue is reproducible with
HEAD commit cee9395acd8043be0644b25c34bfa86623f2b935 (v7.3-rc1, Linux
7.3.0-rc1).


The reproducer connects a synthetic USB device through dummy_hcd that enumerates
as the mdc800 camera, then opens the character device node.  No filesystem or
image input is involved; the trigger is the connect-then-open sequence on a
device that binds to this driver.


Opening the device reaches mdc800_device_open through the USB character-device
file operations, and lockdep reports that the task is acquiring
&mdc800->io_lock while already holding minor_rwsem#2 taken by usb_open.  The
existing dependency chain in the report shows the opposite order, so the two
lock classes are recorded in both orders and lockdep declares a possible
circular dependency.


One possible cause is that the driver's private io_lock is acquired inside the
USB core's file-open path, which already holds the minor rwsem that guards the
driver binding, while another path takes the same two locks the other way
around.  This looks like a lock-ordering problem between a driver-private mutex
and the USB core file-layer lock rather than a use of a single lock.  I am
reporting the ordering as observed; the driver is legacy and possibly unused, so
if the intended fix is to keep the lock order, please treat this as a report of
the deadlock potential only.


This appears to be a recurrence of the syzbot issue whose external id is
1050c0099ec5bfe7ee4e, title "possible deadlock in mdc800_device_open".  It
remains reproducible on v7.3-rc1.


Reproducer:


syz reproducer:
syz_usb_connect(0x2, 0x40, &(0x7f0000000000)=ANY=[@ANYBLOB="12010001000000085f0500a800010000000109022e0001010080320904000004ff00000007050102080000070582030800010705030240000007058402400000"], 0x0)
syz_open_dev$char_usb(0xc, 0xb4, 0x0)


console output: https://pastebin.com/raw/2jB0d1Lm
kernel config: https://pastebin.com/raw/YZiwabxk


Kernel:


HEAD commit: cee9395acd8043be0644b25c34bfa86623f2b935
git tree: upstream (linux.git), tested through the v7.3-rc1 annotated tag object
           e5e04726cdd043e309677071ab1b65a4b18f422b
kernel version: 7.3.0-rc1 #1 PREEMPT(full)
tested tag: v7.3-rc1 (Linux 7.3-rc1, 2026-08-30)


Let me know if you need more details or testing.


Best regards,
Changjian

             reply	other threads:[~2026-09-14  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  7:36 CJ [this message]
2026-09-14  8:34 ` [BUG] usb: mdc800: possible circular locking dependency between io_lock and minor_rwsem Greg KH
2026-09-16 18:15 ` Oliver Neukum

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=5c30f641.6b79.1a09ed8b2bf.Coremail.firefly0158@163.com \
    --to=firefly0158@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=n7l8m4@u.northwestern.edu \
    --cc=oneukum@suse.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.