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

From: Danilo Krummrich

Date: Tue Apr 28 2026 - 18:19:18 EST


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?