Re: [GIT PULL] Driver core fixes for 7.1-rc1

From: Linus Torvalds

Date: Sun Apr 19 2026 - 16:29:36 EST


On Sun, 19 Apr 2026 at 08:43, Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> - Prevent a device from being probed before device_add() has finished
> initializing it; gate probe with a "ready_to_probe" device flag to
> avoid races with concurrent driver_register() calls

Ugh. This just looks disgusting:

device_lock(dev);
dev_set_ready_to_probe(dev);
device_unlock(dev);

when all it does is to just set a single bit.

Sadly, I think despite being disgusting, our bitop memory ordering
models are incomplete.

But I think dev_set_ready_to_probe() could/should use
'test_and_set_bit()', which turns the bit setting into strongly
ordered (it only needs "release" consistency, but we don't have that).

And the dev_ready_to_probe() should use "test_bit_acquire()".

Then it wouldn't rely on the lock just to give memory ordering guarantees.

And yes, we should have better memory ordering for bit setting and
clearing, but sadly we don't. This has come up before, but it is what
it is.

Linus