* Re: [PATCH v2] Bluetooth: btintel_pcie: guard debug dump before hdev setup
2026-10-13 12:52 [PATCH v2] Bluetooth: btintel_pcie: guard debug dump before hdev setup ChunAn Wu
@ 2026-10-28 18:43 ` ChunAn Wu
2026-11-30 3:07 ` Daniel Baker
1 sibling, 0 replies; 3+ messages in thread
From: ChunAn Wu @ 2026-10-28 18:43 UTC (permalink / raw)
To: linux-bluetooth, marcel, luiz.dentz, kiran.k,
chandrashekar.devegowda, linux-kernel, stable
On Tue, Oct 13, 2026 at 08:52:41PM +0800, ChunAn Wu wrote:
> An MSI-X interrupt can reach the debug-dump helper before
> btintel_pcie_setup_hdev() initializes data->hdev. The helper then
> passes NULL to hci_get_drvdata() and crashes the interrupt thread.
>
> Return early when hdev is not available. This covers the GP1 and GP0
> error paths while leaving interrupt handling unchanged.
>
> Fixes: 190377500fde ("Bluetooth: btintel_pcie: Dump debug registers on error")
> Cc: stable@vger.kernel.org
> Signed-off-by: ChunAn Wu <an.wu@canonical.com>
> ---
> Changes in v2:
> - Add the missing Fixes: tag required for the stable CC.
>
> ---
> drivers/bluetooth/btintel_pcie.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
> index ac7193400769..8d7927bd75b6 100644
> --- a/drivers/bluetooth/btintel_pcie.c
> +++ b/drivers/bluetooth/btintel_pcie.c
> @@ -297,12 +297,17 @@ static void btintel_pcie_prepare_tx(struct txq *txq, u16 tfd_index,
>
> static inline void btintel_pcie_dump_debug_registers(struct hci_dev *hdev)
> {
> - struct btintel_pcie_data *data = hci_get_drvdata(hdev);
> + struct btintel_pcie_data *data;
> u16 cr_hia, cr_tia;
> u32 reg, mbox_reg;
> struct sk_buff *skb;
> u8 buf[80];
>
> + if (!hdev)
> + return;
> +
> + data = hci_get_drvdata(hdev);
> +
> skb = alloc_skb(1024, GFP_ATOMIC);
> if (!skb)
> return;
>
> base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
> --
> 2.34.1
Hi Maintainers,
Could you kindly help me to review the patch
Many thanks
BR
An
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] Bluetooth: btintel_pcie: guard debug dump before hdev setup
2026-10-13 12:52 [PATCH v2] Bluetooth: btintel_pcie: guard debug dump before hdev setup ChunAn Wu
2026-10-28 18:43 ` ChunAn Wu
@ 2026-11-30 3:07 ` Daniel Baker
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Baker @ 2026-11-30 3:07 UTC (permalink / raw)
To: an.wu
Cc: chandrashekar.devegowda, kiran.k, linux-bluetooth, linux-kernel,
luiz.dentz, marcel, stable, Daniel Baker
On Tue, Oct 13, 2026 at 08:52:41PM +0800, ChunAn Wu wrote:
> An MSI-X interrupt can reach the debug-dump helper before
> btintel_pcie_setup_hdev() initializes data->hdev. The helper then
> passes NULL to hci_get_drvdata() and crashes the interrupt thread.
I hit this on 6.18.y and tested the patch there. The report and the
test follow.
Setup
Framework Laptop 13 Pro (Intel Core Ultra Series 3), board FRANMJCP07
Bluetooth controller 8086:e476 at 0000:00:14.7
NixOS, kernels 6.18.49 and 6.18.64, tainted P and O by the
out-of-tree ZFS module
The machine unloads btintel_pcie before every suspend and loads it again
after resume, to work around a suspend failure in the driver's sleep
callbacks. That is why the module is loaded so often.
Failure (2026-11-16, 6.18.49, BIOS 03.02, Bluetooth firmware 42-26.26)
Between 2026-10-04 and 2026-11-28 the module was loaded this way 175
times, 94 times on 6.18.49 and 81 times on 6.18.64. One load failed. It
came right after a resume from s2idle. About 0.5 s after modprobe
started, the kernel logged:
Bluetooth: null: Received gp1 mailbox interrupt
BUG: kernel NULL pointer dereference, address: 0000000000000cb8
RIP: 0010:btintel_pcie_dump_debug_registers+0x1d/0x800 [btintel_pcie]
Call Trace:
btintel_pcie_irq_msix_handler+0x17d/0x4d0 [btintel_pcie]
irq_thread_fn+0x25/0x70
irq_thread+0x181/0x2a0
note: irq/206-btintel[534802] exited with irqs disabled
About 3 s after modprobe started, which matches the wait for the alive
interrupt in btintel_pcie_enable_bt():
btintel_pcie 0000:00:14.7: probe with driver btintel_pcie failed with error -62
The module load then never returned. modprobe stayed in D state and
SIGKILL did not end it:
task:modprobe state:D
__synchronize_irq+0x96/0xd0
free_irq+0x13c/0x310
release_nodes+0x38/0xb0
devres_release_all+0x94/0xd0
device_unbind_cleanup+0xe/0x80
really_probe+0x221/0x340
The next suspend attempt, 13 minutes later, and another one the next
morning both failed with "Freezing user space processes failed after
20.001 seconds (1 tasks refusing to freeze, wq_busy=0)" (20.004 seconds
the second time). The task listed was that modprobe. The machine needed
a reboot.
Test of v2 (2026-11-29, 6.18.64, BIOS 03.04, Bluetooth firmware 19-36.26)
1. I applied v2 to drivers/bluetooth/btintel_pcie.c from v6.18.64. It
applies with an offset of -40 lines.
2. I cannot trigger the early interrupt, so I added a test-only call
that runs the GP1 handler in btintel_pcie_probe() while data->hdev is
still NULL:
err = btintel_pcie_start_rx(data);
if (err)
goto exit_error;
+ btintel_pcie_msix_gp1_handler(data);
+
err = btintel_pcie_setup_hdev(data);
In 6.18.y that handler logs the message above and then calls
btintel_pcie_dump_debug_registers(data->hdev).
3. I built btintel_pcie.ko with both changes against the running 6.18.64
kernel, ran "rmmod btintel_pcie" and loaded the new module with
insmod. I did this once.
Result: the kernel logged
Bluetooth: null: Received gp1 mailbox interrupt
Bluetooth: hci0: Device revision is 0
followed by the usual firmware download messages. There was no oops,
probe completed, and "bluetoothctl show" lists the controller as
powered.
Not tested: the patch on mainline; the test call without the patch,
which I expect to oops and hang the module load as above; and a real
early GP1 interrupt.
Tested-by: Daniel Baker <dan@djacu.dev> # 6.18.64
ChunAn, patchwork lists this patch as archived in state New, so it may
need a resend:
https://patchwork.kernel.org/project/bluetooth/patch/20261013125241.1230408-1-an.wu@canonical.com/
I used Claude Code (claude-fable-5-2) for the log analysis, the test
change and the draft of this mail.
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread