Re: [PATCH] driver core: faux: fix root device registration

From: Greg Kroah-Hartman

Date: Fri Apr 24 2026 - 07:27:19 EST


On Fri, Apr 24, 2026 at 12:22:31PM +0200, 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.

Ah, good catch, I missed that, thanks!

> Also add the missing sanity check when registering faux devices to avoid
> a NULL-pointer dereference if the bus failed to register (which would
> previously have triggered a bunch of use-after-free warnings).

If the bus fails to register at boot time, we have bigger problems than
those types of warnings :)

I'll queue this up after -rc1 is out, thanks.

greg k-h