The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Runyu Xiao" <runyu.xiao@seu.edu.cn>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<cornelia.huck@de.ibm.com>, <tom.leiming@gmail.com>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	<jianhao.xu@seu.edu.cn>
Subject: Re: [PATCH] driver core: enforce device_lock for driver_match_device()
Date: Tue, 02 Jun 2026 18:44:45 +0200	[thread overview]
Message-ID: <DIYPR0K2CZW7.254R8K7ONBX5D@kernel.org> (raw)
In-Reply-To: <20260602160829.560904-1-runyu.xiao@seu.edu.cn>

On Tue Jun 2, 2026 at 6:08 PM CEST, Runyu Xiao wrote:
> This issue was first flagged by our static analysis tool while auditing
> driver_override match paths, then manually confirmed on Linux v6.18.21.
> We reproduced the race with no-device KCSAN/MSV harnesses across AMBA,
> WMI, RPMSG, VMBUS, VDPA, CDX, CSS, FSL-MC, and PCI. Those reports all
> reduce to the same core-side gap in driver_match_device().

This is all fixed in driver-core-next already, please also see [1] and [2].

> Fix this by introducing driver_match_device_locked(), which guarantees
> holding device_lock(dev) with a scoped guard before entering the bus
> match callback. Convert the two unlocked call sites to this helper, and
> add a device_lock_assert() to driver_match_device() so the contract is
> explicit.

This approach was reverted [3] for the reasons documented in the linked patch.

Thanks,
Danilo

[1] https://lore.kernel.org/driver-core/20260303115720.48783-1-dakr@kernel.org/
[2] https://lore.kernel.org/driver-core/20260324005919.2408620-1-dakr@kernel.org/
[3] https://lore.kernel.org/driver-core/20260302002545.19389-1-dakr@kernel.org/

  parent reply	other threads:[~2026-06-02 16:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 16:08 [PATCH] driver core: enforce device_lock for driver_match_device() Runyu Xiao
2026-06-02 16:39 ` Greg KH
2026-06-02 16:44 ` Danilo Krummrich [this message]
2026-06-03  3:36   ` Runyu Xiao
2026-06-04  3:52 ` [PATCH v2 0/4] Convert remaining buses to generic driver_override handling Runyu Xiao
2026-06-04  3:52   ` [PATCH v2 1/4] amba: use generic driver_override infrastructure Runyu Xiao
2026-06-04  3:52   ` [PATCH v2 2/4] rpmsg: core: " Runyu Xiao
2026-06-08 17:47     ` Mathieu Poirier
2026-06-04  3:52   ` [PATCH v2 3/4] vmbus: " Runyu Xiao
2026-06-04  3:52   ` [PATCH v2 4/4] cdx: " Runyu Xiao
2026-06-08 18:09   ` [PATCH v2 0/4] Convert remaining buses to generic driver_override handling Danilo Krummrich

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=DIYPR0K2CZW7.254R8K7ONBX5D@kernel.org \
    --to=dakr@kernel.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=stable@vger.kernel.org \
    --cc=tom.leiming@gmail.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