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

From: Johan Hovold

Date: Wed Apr 29 2026 - 07:20:04 EST


On Wed, Apr 29, 2026 at 12:47:53PM +0200, Danilo Krummrich wrote:
> 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.

It fixes a memory leak (and some warnings). We backport such fixes all
the time, including in other error paths which are unlikely to ever be
hit.

> 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.

The stable rules have been relaxed in practice since Autosel. Anything
that looks like a fix (e.g. has a Fixes tag) gets backported.

And people get tired of asking the stable team to drop patches that were
not marked for backporting.

But feel free to drop the CC-stable tag here if you want to.

Johan