From: Greg KH <gregkh@linuxfoundation.org>
To: Ginger <ginger.jzllee@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [bug report] Potential order bug in 'drivers/usb/misc/ldusb.c', mainly in 'ld_usb_disconnect()'
Date: Mon, 1 Jun 2026 07:43:16 +0200 [thread overview]
Message-ID: <2026060157-pettiness-corporal-05eb@gregkh> (raw)
In-Reply-To: <CAGp+u1a_9JNnadwUmCTPAWrs=nxL2KJbxr=tzo7BiJBYzFcpsQ@mail.gmail.com>
On Mon, Jun 01, 2026 at 12:10:37PM +0800, Ginger wrote:
> Dear Linux kernel maintainers,
>
> My research-based static analyzer found a potential order bug within
> the 'drivers/usb/misc' subsystem, more specifically, in
> 'drivers/usb/misc/ldusb.c'.
>
> This potential issue is similar to a previously reported one
> (https://lore.kernel.org/linux-usb/2026042444-freeing-consumer-468b@gregkh/).
> It is present as of git commit eb3f4b7426cfd2b79d65b7d37155480b32259a11.
>
> Potential concurrent triggering executions:
> T0:
> ld_usb_disconnect
> --> usb_set_intfdata(interface, NULL); [t0]
> --> usb_deregister_dev(interface, &ld_usb_class);
> --> usb_minors[intf->minor] = NULL; [t2]
> T1:
> usb_open
> --> new_fops = fops_get(usb_minors[iminor(inode)]); [t1]
> --> err = file->f_op->open(inode, file);
> --> ...
> --> ld_usb_open
> --> dev = usb_get_intfdata(interface); [t3]
>
> In T0, the interface is nullified before its get deregistered. Thus,
> it is possible for T1 to still get the usb dev and access it via the
> interface, which, however, has already been nullified.
> The concurrent buggy order is t0 -> t1 -> t2 -> t3.
>
> Thank you for your time and consideration.
If you think this needs to be fixed, please just send a patch for it and
we can evaluate it that way.
thanks,
greg k-h
prev parent reply other threads:[~2026-06-01 5:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 4:10 [bug report] Potential order bug in 'drivers/usb/misc/ldusb.c', mainly in 'ld_usb_disconnect()' Ginger
2026-06-01 5:43 ` Greg KH [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=2026060157-pettiness-corporal-05eb@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=ginger.jzllee@gmail.com \
--cc=linux-usb@vger.kernel.org \
/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