[PATCH v2 0/2] Bluetooth: fix race during h4 bluetooth initialization

Jonathan Rissanen posted 2 patches 1 week ago
There is a newer version of this series
drivers/bluetooth/hci_h4.c    | 3 ---
drivers/bluetooth/hci_ldisc.c | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)
[PATCH v2 0/2] Bluetooth: fix race during h4 bluetooth initialization
Posted by Jonathan Rissanen 1 week ago
Hi,

This series fixes a race condition that causes hci events to sometimes
be ignored during h4 initialization.

The first patch clears the HCI_UART_PROTO_INIT bit if device
registration fails. This is needed to prevent the second patch from
introducing a possible null pointer dereference.

The second patch contains the fix for the race condition.

Signed-off-by: Jonathan Rissanen <jonathan.rissanen@axis.com>
---
Changes in v2:
- Added a patch before the fix that prevents possible null pointer dereference
  from being introduced.
- Link to v1: https://lore.kernel.org/r/20260320-hci-init-fix-v1-1-e1960a41baf2@axis.com

---
Jonathan Rissanen (2):
      Bluetooth: hci_ldisc: Clear HCI_UART_PROTO_INIT on error
      Bluetooth: hci_h4: Fix race during initialization

 drivers/bluetooth/hci_h4.c    | 3 ---
 drivers/bluetooth/hci_ldisc.c | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
change-id: 20260303-hci-init-fix-9657128a0104

Best regards,
-- 
Jonathan Rissanen <jonathan.rissanen@axis.com>
Re: [PATCH v2 0/2] Bluetooth: fix race during h4 bluetooth initialization
Posted by Luiz Augusto von Dentz 1 week ago
Hi Jonathan,

On Thu, Mar 26, 2026 at 5:59 AM Jonathan Rissanen
<jonathan.rissanen@axis.com> wrote:
>
> Hi,
>
> This series fixes a race condition that causes hci events to sometimes
> be ignored during h4 initialization.
>
> The first patch clears the HCI_UART_PROTO_INIT bit if device
> registration fails. This is needed to prevent the second patch from
> introducing a possible null pointer dereference.
>
> The second patch contains the fix for the race condition.
>
> Signed-off-by: Jonathan Rissanen <jonathan.rissanen@axis.com>
> ---
> Changes in v2:
> - Added a patch before the fix that prevents possible null pointer dereference
>   from being introduced.
> - Link to v1: https://lore.kernel.org/r/20260320-hci-init-fix-v1-1-e1960a41baf2@axis.com
>
> ---
> Jonathan Rissanen (2):
>       Bluetooth: hci_ldisc: Clear HCI_UART_PROTO_INIT on error
>       Bluetooth: hci_h4: Fix race during initialization

These should have Fixes: tag included as well before we merge;
otherwise, they look good to me.

>  drivers/bluetooth/hci_h4.c    | 3 ---
>  drivers/bluetooth/hci_ldisc.c | 3 +++
>  2 files changed, 3 insertions(+), 3 deletions(-)
> ---
> base-commit: 05f7e89ab9731565d8a62e3b5d1ec206485eeb0b
> change-id: 20260303-hci-init-fix-9657128a0104
>
> Best regards,
> --
> Jonathan Rissanen <jonathan.rissanen@axis.com>
>


-- 
Luiz Augusto von Dentz