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

Johan Hovold
2026-04-29T10:17:11Z

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@vger.kernel.org # 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.

Johan