Re: [PATCH] Bluetooth: btusb: fix wakeup irq devres lifetime

From: Johan Hovold

Date: Thu Apr 02 2026 - 05:45:54 EST


Hi Luiz,

On Mon, Mar 30, 2026 at 03:17:33PM -0400, Luiz Augusto von Dentz wrote:

> On Mon, Mar 30, 2026 at 5:33 AM Johan Hovold <johan@xxxxxxxxxx> wrote:
> > The OOB wakeup irq is device managed but its lifetime is incorrectly
> > tied to the child HCI device rather than the USB interface to which the
> > driver is bound.
> >
> > This should not cause any trouble currently as the interrupt is only
> > enabled during suspend, but it is technically wrong as the reference
> > counted HCI device could remain after the driver has been unbound.
> >
> > Note that the data passed to the interrupt handler is not device managed
> > and is typically freed before the interrupt during disconnect, but this
> > is also safe as long as the interrupt is disabled.

> https://sashiko.dev/#/patchset/20260330093311.1621965-1-johan%40kernel.org
>
> Not sure if it is valid though.

I'm afraid it is.

I had missed that the devres behaviour changed in 2023 so that managed
resources are now also released when deregistering a device which has no
driver.

The point about a possible race if disconnecting while suspended is also
valid.

I've just sent a v2 here:

https://lore.kernel.org/lkml/20260402092704.2346710-1-johan@xxxxxxxxxx/

Johan