Re: [PATCH v2 1/2] driver core: faux: fix root device registration

From: Danilo Krummrich

Date: Wed Apr 29 2026 - 06:53:05 EST


On Wed Apr 29, 2026 at 12:17 PM CEST, Johan Hovold wrote:
> On Wed, Apr 29, 2026 at 12:19:06AM +0200, Danilo Krummrich wrote:
>> On Fri Apr 24, 2026 at 5:31 PM CEST, Johan Hovold wrote:
>> > A recent change made the faux bus root device be allocated dynamically
>> > but failed to provide a release function to free the memory when the
>> > last reference is dropped (on theoretical failure to register the device
>> > or bus).
>> >
>> > Fix this by using root_device_register() instead of open coding.
>> >
>> > Also add the missing sanity check when registering faux devices to avoid
>> > use-after-free if the bus failed to register (which would previously
>> > have triggered a bunch of use-after-free warnings).
>> >
>> > Fixes: 61b76d07d2b4 ("driver core: faux: stop using static struct device")
>> > Cc: stable@xxxxxxxxxxxxxxx # 7.0
>>
>> I think this is more of a theoretical issue, do we need this in stable trees?
>
> Sure, this is borderline, but given that autosel would probably pick it
> up anyway we might as well mark it directly.

In such a case developers should probably give the stable team a hint that the
patch in question does not need backporting.

But using the expectation that autosel may pick it up as a justification to mark
it for stable in the first place seems wrong.

The stable documentation [1] is very clear that theoretical issues must not be
backported into stable trees unless an explanation of how the bug can be
exploited can be provided.

If that was relaxed in some way, it probably needs updating.

[1] https://docs.kernel.org/process/stable-kernel-rules.html#everything-you-ever-wanted-to-know-about-linux-stable-releases