From: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
tiwai@suse.de, linux-sound@vger.kernel.org,
Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Subject: Re: [PATCH v7 2/2] ALSA: usb-audio: bind the Topping M62's vendor controls
Date: Thu, 1 Oct 2026 03:49:54 +0500 [thread overview]
Message-ID: <20260930224954.121402-1-mikhail.v.gavrilov@gmail.com> (raw)
In-Reply-To: <20260930215023.39C5A1F00898@smtp.kernel.org>
On Wed, 30 Sep 2026 21:50:22 +0000, sashiko-bot@kernel.org wrote:
> Does this lockless teardown open a time-of-check to time-of-use race
> window before the tm context is freed by devres?
No. The two paths are serialized by the usb_device lock, and on the
M62 the path does not exist.
The failed probe runs with the device locked. usb_bus_type sets
need_parent_lock, so the driver core takes the parent's lock around an
interface probe (__driver_attach(), device_driver_attach()), and at
enumeration the interfaces are added by usb_set_configuration(), whose
caller must own the device lock. really_probe() unwinds a failed probe
with device_unbind_cleanup() inside that region, so
topping_master_teardown() runs with the usb_device locked.
The disconnect does too. usb_audio_disconnect() runs from
usb_disconnect(), which holds usb_lock_device() across
usb_disable_device(), or from an unbind through device_driver_detach(),
which takes the same lock. A later snd_usb_mixer_free() finds
mixer->disconnected set and returns before private_free.
So cpu1 and cpu2 in the sequence above cannot overlap.
As for the premise: on the M62 only the AudioControl interface goes
through usb_audio_probe(); the streaming interfaces are claimed from
its probe. If that probe fails, chip->num_interfaces is still 0 and
usb_audio_probe() frees the card itself, which runs
topping_private_free() before the driver core unwinds devres.
--
Thanks,
Mikhail.
next prev parent reply other threads:[~2026-09-30 22:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 21:33 [PATCH v7 0/2] the Topping M62's vendor controls, on the component framework Mikhail Gavrilov
2026-09-30 21:33 ` [PATCH v7 1/2] HID: topping-m62: driver for the M62's vendor controls Mikhail Gavrilov
2026-09-30 21:33 ` [PATCH v7 2/2] ALSA: usb-audio: bind the Topping " Mikhail Gavrilov
2026-09-30 21:50 ` sashiko-bot
2026-09-30 22:49 ` Mikhail Gavrilov [this message]
2026-10-03 18:44 ` [PATCH v7 0/2] the Topping M62's vendor controls, on the component framework Mikhail Gavrilov
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=20260930224954.121402-1-mikhail.v.gavrilov@gmail.com \
--to=mikhail.v.gavrilov@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tiwai@suse.de \
/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