Skip to content

[Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] Sync bluetooth fixes from mainline - #2033

Merged
opsiff merged 12 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-07-31-bluetooth
Jul 31, 2026
Merged

[Deepin-Kernel-SIG] [linux 6.6.y] [Upstream] Sync bluetooth fixes from mainline#2033
opsiff merged 12 commits into
deepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-07-31-bluetooth

Conversation

@opsiff

@opsiff opsiff commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary by Sourcery

Sync various upstream Bluetooth driver fixes improving Intel PCIe, USB Mediatek, and EFI handling for stability and correctness.

Bug Fixes:

  • Adjust Intel PCIe RX/TX descriptor sizing and RX buffer posting to address firmware race conditions and queue handling issues.
  • Fix Intel PCIe interrupt handling, RX/TX queue empty checks, and alive interrupt waiting logic to avoid timeouts and missed interrupts.
  • Correct Intel EFI DSBR variable retrieval by using a fixed buffer size and validating returned data length.
  • Harden USB Mediatek isochronous interface claim/release paths against NULL hdev, private data, and interface pointers, and ensure URBs/SKBs are safely freed.
  • Ensure Mediatek interrupt URB allocation frees URBs when isochronous packet padding fails instead of leaking resources.
  • Route specific Intel PCIe debug events through diagnostic handling instead of silently discarding them.
  • Simplify Intel PCIe RX frame processing to reuse incoming SKBs and avoid unnecessary allocations and leaks.
  • Remove unused HCI connection remote_id field from core Bluetooth structures.

Enhancements:

  • Update Intel PCIe IRQ registration to use threaded-only (oneshot) handling for better interrupt management.
  • Clarify comments and minor wording in Intel bootloader code for intermediate loader image support.

paulmenzel and others added 8 commits July 31, 2026 15:07
mainline inclusion
from mainline-v6.11-rc1
category: bugfix

Fixes: f3b845e ("Bluetooth: btintel: Add support to download intermediate loader")
Cc: Kiran K <kiran.k@intel.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit 519d849)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion
from mainline-v6.14-rc3
category: bugfix

On HCI_OP_RESET command, firmware raises alive interrupt. Driver needs
to wait for this before sending other command. This patch fixes the potential
miss of alive interrupt due to which HCI_OP_RESET can timeout.

Expected flow:
If tx command is HCI_OP_RESET,
  1. set data->gp0_received = false
  2. send HCI_OP_RESET
  3. wait for alive interrupt

Actual flow having potential race:
If tx command is HCI_OP_RESET,
 1. send HCI_OP_RESET
   1a. Firmware raises alive interrupt here and in ISR
       data->gp0_received  is set to true
 2. set data->gp0_received = false
 3. wait for alive interrupt

Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: 05c200c ("Bluetooth: btintel_pcie: Add handshake between driver and firmware")
Reported-by: Bjorn Helgaas <helgaas@kernel.org>
Closes: https://patchwork.kernel.org/project/bluetooth/patch/20241001104451.626964-1-kiran.k@intel.com/
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit 872274b)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion
from mainline-v6.15-rc5
category: bugfix

Reuse the skb buffer provided by the PCIe driver to pass it onto the
stack, instead of copying it to a new skb.

Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Kiran K <kiran.k@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit d1af1f0)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion
from mainline-v6.15-rc5
category: bugfix

Due to a hardware issue, there is a possibility that the driver may miss
an MSIx interrupt on the RX/TX data path. Since the TX and RX paths are
independent, when a TX MSIx interrupt occurs, the driver can check the
RX queue for any pending data and process it if present. The same
approach applies to the RX path.

Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit 1c76649)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion
from mainline-v6.16-rc1
category: bugfix

Since the size of struct btintel_dsbr is already known, we can just
start there instead of querying the EFI variable size. If the final
result doesn't match what we expect also fail. This fixes a stack buffer
overflow when the EFI variable is larger than struct btintel_dsbr.

Reported-by: zepta <z3ptaa@gmail.com>
Closes: https://lore.kernel.org/all/CAPBS6KoaWV9=dtjTESZiU6KK__OZX0KpDk-=JEH8jCHFLUYv3Q@mail.gmail.com
Fixes: eb9e749 ("Bluetooth: btintel: Allow configuring drive strength of BRI")
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit 3aa1dc3)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion
from mainline-v6.16-rc2
category: bugfix

The driver was posting only 6 rx buffers, despite the maximum rx buffers
being defined as 16. Having fewer RX buffers caused firmware exceptions
in HID use cases when events arrived in bursts.

Exception seen on android 6.12 kernel.

E Bluetooth: hci0: Received hw exception interrupt
E Bluetooth: hci0: Received gp1 mailbox interrupt
D Bluetooth: hci0: 00000000: ff 3e 87 80 03 01 01 01 03 01 0c 0d 02 1c 10 0e
D Bluetooth: hci0: 00000010: 01 00 05 14 66 b0 28 b0 c0 b0 28 b0 ac af 28 b0
D Bluetooth: hci0: 00000020: 14 f1 28 b0 00 00 00 00 fa 04 00 00 00 00 40 10
D Bluetooth: hci0: 00000030: 08 00 00 00 7a 7a 7a 7a 47 00 fb a0 10 00 00 00
D Bluetooth: hci0: 00000000: 10 01 0a
E Bluetooth: hci0: ---- Dump of debug registers —
E Bluetooth: hci0: boot stage: 0xe0fb0047
E Bluetooth: hci0: ipc status: 0x00000004
E Bluetooth: hci0: ipc control: 0x00000000
E Bluetooth: hci0: ipc sleep control: 0x00000000
E Bluetooth: hci0: mbox_1: 0x00badbad
E Bluetooth: hci0: mbox_2: 0x0000101c
E Bluetooth: hci0: mbox_3: 0x00000008
E Bluetooth: hci0: mbox_4: 0x7a7a7a7a

Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit daabd27)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
mainline inclusion
from mainline-v6.16-rc2
category: bugfix

This change addresses latency issues observed in HID use cases where
events arrive in bursts. By increasing the Rx descriptor count to 64,
the firmware can handle bursty data more effectively, reducing latency
and preventing buffer overflows.

Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit 2dd7111)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
… condition

mainline inclusion
from mainline-v6.16-rc2
category: bugfix

Modify the driver to post 3 fewer buffers than the maximum rx buffers
(64) allowed for the firmware. This change mitigates a hardware issue
causing a race condition in the firmware, improving stability and data
handling.

Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit bf2ffc4)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@sourcery-ai

sourcery-ai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Reviewer's Guide

Synchronizes multiple Bluetooth driver fixes from mainline, focusing on Intel PCIe, USB Mediatek, Intel EFI handling, and HCI core cleanups, with queue sizing, interrupt handling, memory management, and robustness improvements.

Sequence diagram for updated Intel PCIe interrupt and alive handling

sequenceDiagram
    actor HostCPU
    participant btintel_pcie_send_frame
    participant gp0_wait_q
    participant btintel_pcie_irq_msix_handler
    participant btintel_pcie_msix_gp0_handler
    participant btintel_pcie_msix_tx_handle
    participant btintel_pcie_msix_rx_handle
    participant btintel_pcie_is_rxq_empty
    participant btintel_pcie_is_txackq_empty

    HostCPU->>btintel_pcie_send_frame: hci_dev_queue_skb
    btintel_pcie_send_frame->>btintel_pcie_send_frame: set data.gp0_received = false on HCI_OP_RESET or BTINTEL_HCI_OP_RESET
    btintel_pcie_send_frame->>gp0_wait_q: wait_event_timeout(gp0_wait_q, gp0_received)

    Note over btintel_pcie_irq_msix_handler,btintel_pcie_msix_gp0_handler: Alive interrupt path
    HostCPU-->>btintel_pcie_irq_msix_handler: MSIX interrupt
    btintel_pcie_irq_msix_handler->>btintel_pcie_msix_gp0_handler: btintel_pcie_msix_gp0_handler
    btintel_pcie_msix_gp0_handler->>gp0_wait_q: wake_up on alive interrupt (gp0_received = true)

    alt intr_fh has BTINTEL_PCIE_MSIX_FH_INT_CAUSES_0
        btintel_pcie_irq_msix_handler->>btintel_pcie_msix_tx_handle: btintel_pcie_msix_tx_handle
        btintel_pcie_irq_msix_handler->>btintel_pcie_is_rxq_empty: btintel_pcie_is_rxq_empty
        btintel_pcie_is_rxq_empty-->>btintel_pcie_irq_msix_handler: false when RXQ has entries
        btintel_pcie_irq_msix_handler->>btintel_pcie_msix_rx_handle: btintel_pcie_msix_rx_handle when RXQ not empty
    end

    alt intr_fh has BTINTEL_PCIE_MSIX_FH_INT_CAUSES_1
        btintel_pcie_irq_msix_handler->>btintel_pcie_msix_rx_handle: btintel_pcie_msix_rx_handle
        btintel_pcie_irq_msix_handler->>btintel_pcie_is_txackq_empty: btintel_pcie_is_txackq_empty
        btintel_pcie_is_txackq_empty-->>btintel_pcie_irq_msix_handler: false when TXACKQ has entries
        btintel_pcie_irq_msix_handler->>btintel_pcie_msix_tx_handle: btintel_pcie_msix_tx_handle when TXACKQ not empty
    end

    gp0_wait_q-->>btintel_pcie_send_frame: wakeup when gp0_received
    btintel_pcie_send_frame-->>HostCPU: return or timeout with err_tx increment
Loading

Flow diagram for Mediatek ISO interface claim and release

flowchart TD
    A[btusb_mtk_claim_iso_intf] --> B{data.hdev is NULL?}
    B -->|yes| Z[return]
    B -->|no| C[hci_get_priv]
    C --> D{btmtk_data is NULL?}
    D -->|yes| Z
    D -->|no| E{btmtk_data.isopkt_intf is NULL?}
    E -->|yes| F[bt_dev_err Can't claim NULL iso interface; return]
    E -->|no| G[usb_driver_claim_interface]

    subgraph ReleasePath
        R[btusb_mtk_release_iso_intf] --> S{hdev is NULL?}
        S -->|yes| Z2[return]
        S -->|no| T[hci_get_priv]
        T --> U{btmtk_data is NULL?}
        U -->|yes| Z2
        U -->|no| V{BTMTK_ISOPKT_OVER_INTR set?}
        V -->|no| W[clear BTMTK_ISOPKT_OVER_INTR]
        V -->|yes| X[usb_kill_anchored_urbs; clear BTMTK_ISOPKT_RUNNING]
        X --> Y{btmtk_data.isopkt_skb is non-NULL?}
        Y -->|yes| Y1[dev_kfree_skb_irq; set isopkt_skb NULL]
        Y -->|no| Y2[skip skb free]
        X --> AA{btmtk_data.isopkt_intf is non-NULL?}
        AA -->|yes| AB[usb_set_intfdata NULL; usb_driver_release_interface; set isopkt_intf NULL]
        AA -->|no| AC[skip interface release]
        AB --> W
        AC --> W
    end
Loading

File-Level Changes

Change Details Files
Adjust Intel PCIe Bluetooth queue sizing, RX buffer posting, and interrupt handling to fix race conditions and improve TX/RX coordination.
  • Change TX/RX descriptor counts to distinct, larger values and wire them through DMA layout and queue initialization
  • Modify RX start logic to post (rxq->count - 3) buffers instead of a fixed max queue size to work around firmware race conditions
  • Introduce helpers to check RX/TXACK queue emptiness and use them in the MSI-X handler to drive RX when TX interrupts fire and vice versa
  • Switch MSI-X IRQ registration to use a threaded-only handler (NULL top-half) with IRQF_ONESHOT
IRQF_SHARED
  • Drop noisy RXQ warning when no new completion descriptors are present
  • Rework Intel PCIe receive path to avoid unnecessary skb reallocations and fix ownership and lifetime of sk_buffs.
    • Remove allocation of a new skb in btintel_pcie_recv_frame and operate directly on the incoming skb
    • Set HCI packet type on the original skb, trim to payload length, and pass it down to btintel_pcie_recv_event/hci_recv_frame which now free it
    • Ensure on-error cleanup path frees skb if it wasn’t handed off
    • Simplify rx_work loop to just call btintel_pcie_recv_frame without manual error logging or skb freeing
    drivers/bluetooth/btintel_pcie.c
    Improve Intel PCIe firmware alive interrupt handling for reset commands.
    • Mark gp0_received as false whenever sending HCI_OP_RESET or BTINTEL_HCI_OP_RESET
    • Unconditionally wait for the alive interrupt after commands that change alive_intr_ctxt, rather than special-casing HCI_OP_RESET
    • On timeout, report a more descriptive error including the timeout value and current alive context, and account the error in err_tx
    drivers/bluetooth/btintel_pcie.c
    Ensure Intel PCIe debug events are treated as diagnostics while still being filtered from the normal HCI stack.
    • For specific debug event (skb->data[2] == 0x97), call hci_recv_diag and then swallow the event by returning 0 instead of passing to the stack
    drivers/bluetooth/btintel_pcie.c
    Increase robustness of Mediatek USB Bluetooth ISO interface claim/release handling and error paths.
    • Add NULL checks for hdev and private btmtk_data before accessing ISO interface state in claim/release helpers
    • Guard against NULL isopkt_intf when claiming; log an error if it’s NULL instead of calling into USB core
    • Protect release path with NULL checks on isopkt_skb and isopkt_intf before freeing and releasing, and clear isopkt_intf after release
    • Ensure alloc_mtk_intr_urb frees the allocated URB when btmtk_isopkt_pad detects an invalid packet before returning ERR_PTR(-EINVAL)
    drivers/bluetooth/btusb.c
    drivers/bluetooth/btmtk.c
    Harden Intel EFI DSBR variable reading logic and fix a minor typo in a comment.
    • Initialize EFI data_size to sizeof(data) and remove the preliminary buffer-size probe call
    • Reject EFI get_variable results if status is not EFI_SUCCESS or if data_size does not match the expected structure size
    • Fix spelling of "intermediate loader image" in a comment
    drivers/bluetooth/btintel.c
    Clean up HCI connection structure by removing an unused remote_id field.
    • Remove the remote_id member from struct hci_conn to match upstream and reduce unused state
    include/net/bluetooth/hci_core.h

    Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it. You can also reply to a
      review comment with @sourcery-ai issue to create an issue from it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time. You can also comment
      @sourcery-ai title on the pull request to (re-)generate the title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time exactly where you
      want it. You can also comment @sourcery-ai summary on the pull request to
      (re-)generate the summary at any time.
    • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
      request to (re-)generate the reviewer's guide at any time.
    • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
      pull request to resolve all Sourcery comments. Useful if you've already
      addressed all the comments and don't want to see them anymore.
    • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
      request to dismiss all existing Sourcery reviews. Especially useful if you
      want to start fresh with a new review - don't forget to comment
      @sourcery-ai review to trigger a new review!

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    @deepin-ci-robot

    Copy link
    Copy Markdown

    [APPROVALNOTIFIER] This PR is NOT APPROVED

    This pull-request has been approved by:
    Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

    The full list of commands accepted by this bot can be found here.

    Details Needs approval from an approver in each of these files:

    Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment

    @sourcery-ai sourcery-ai Bot left a comment

    Copy link
    Copy Markdown

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Hey - I've left some high level feedback:

    • In btintel_pcie_start_rx(), consider replacing the hard-coded rxq->count - 3 offset with a named constant or macro that documents the hardware quirk, so future descriptor count changes don’t silently alter this behavior.
    • Now that btintel_pcie_irq_msix_handler conditionally calls both RX and TX handlers based on queue emptiness, it may be worth adding a brief comment near the helper functions explaining the expected ordering and why cross-calling is needed, to aid future maintainers in understanding the interrupt flow.
    Prompt for AI Agents
    Please address the comments from this code review:
    
    ## Overall Comments
    - In btintel_pcie_start_rx(), consider replacing the hard-coded `rxq->count - 3` offset with a named constant or macro that documents the hardware quirk, so future descriptor count changes don’t silently alter this behavior.
    - Now that btintel_pcie_irq_msix_handler conditionally calls both RX and TX handlers based on queue emptiness, it may be worth adding a brief comment near the helper functions explaining the expected ordering and why cross-calling is needed, to aid future maintainers in understanding the interrupt flow.

    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    Copilot AI left a comment

    Copy link
    Copy Markdown

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Pull request overview

    This PR backports a set of upstream Bluetooth fixes to the 6.6.y kernel series, primarily targeting Intel PCIe controller stability/IRQ handling and MediaTek USB robustness, plus minor EFI handling and cleanup in core structures.

    Changes:

    • Intel PCIe: adjust RX/TX descriptor sizing, IRQ handling (threaded-only), RX processing, and alive-interrupt sequencing/diagnostics.
    • MediaTek USB: harden isochronous interface claim/release paths and fix an URB leak on error.
    • Core/EFI: remove unused hci_conn::remote_id, tighten Intel EFI DSBR variable retrieval, and fix a comment typo.

    Reviewed changes

    Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

    Show a summary per file
    File Description
    include/net/bluetooth/hci_core.h Removes unused remote_id from struct hci_conn.
    drivers/bluetooth/btusb.c Adds NULL-safety around MediaTek ISO interface claim/release and frees resources defensively.
    drivers/bluetooth/btmtk.c Fixes URB leak on isochronous padding failure.
    drivers/bluetooth/btintel.c Makes EFI DSBR retrieval use fixed-size buffer and validates returned length; fixes comment typo.
    drivers/bluetooth/btintel_pcie.h Splits RX/TX descriptor counts and removes obsolete RX queue constant.
    drivers/bluetooth/btintel_pcie.c Updates RX posting strategy, IRQ handler behavior, diag event routing, skb reuse on RX, and alive-interrupt waiting.
    Suppressed comments (1)

    drivers/bluetooth/btintel_pcie.c:820

    • This return statement exceeds typical kernel line-length limits and will likely trigger checkpatch warnings; split the comparison across lines for readability.
    static inline bool btintel_pcie_is_txackq_empty(struct btintel_pcie_data *data)
    {
    	return data->ia.cr_tia[BTINTEL_PCIE_TXQ_NUM] == data->ia.cr_hia[BTINTEL_PCIE_TXQ_NUM];
    }
    

    💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

    Comment thread drivers/bluetooth/btintel_pcie.c Outdated
    Comment on lines +1333 to +1337
    /* Firmware raises alive interrupt on HCI_OP_RESET or
    * BTINTEL_HCI_OP_RESET
    */
    if (opcode == HCI_OP_RESET || opcode == BTINTEL_HCI_OP_RESET)
    data->gp0_received = false;

    Copy link
    Copy Markdown
    Member Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    drop

    Comment on lines +812 to +815
    static inline bool btintel_pcie_is_rxq_empty(struct btintel_pcie_data *data)
    {
    return IRQ_WAKE_THREAD;
    return data->ia.cr_hia[BTINTEL_PCIE_RXQ_NUM] == data->ia.cr_tia[BTINTEL_PCIE_RXQ_NUM];
    }
    ChrisCH-Lu and others added 4 commits July 31, 2026 15:30
    …nterface
    
    mainline inclusion
    from mainline-v6.18
    category: bugfix
    
    When performing reset tests and encountering abnormal card drop issues
    that lead to a kernel crash, it is necessary to perform a null check
    before releasing resources to avoid attempting to release a null pointer.
    
    <4>[   29.158070] Hardware name: Google Quigon sku196612/196613 board (DT)
    <4>[   29.158076] Workqueue: hci0 hci_cmd_sync_work [bluetooth]
    <4>[   29.158154] pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    <4>[   29.158162] pc : klist_remove+0x90/0x158
    <4>[   29.158174] lr : klist_remove+0x88/0x158
    <4>[   29.158180] sp : ffffffc0846b3c00
    <4>[   29.158185] pmr_save: 000000e0
    <4>[   29.158188] x29: ffffffc0846b3c30 x28: ffffff80cd31f880 x27: ffffff80c1bdc058
    <4>[   29.158199] x26: dead000000000100 x25: ffffffdbdc624ea3 x24: ffffff80c1bdc4c0
    <4>[   29.158209] x23: ffffffdbdc62a3e6 x22: ffffff80c6c07000 x21: ffffffdbdc829290
    <4>[   29.158219] x20: 0000000000000000 x19: ffffff80cd3e0648 x18: 000000031ec97781
    <4>[   29.158229] x17: ffffff80c1bdc4a8 x16: ffffffdc10576548 x15: ffffff80c1180428
    <4>[   29.158238] x14: 0000000000000000 x13: 000000000000e380 x12: 0000000000000018
    <4>[   29.158248] x11: ffffff80c2a7fd10 x10: 0000000000000000 x9 : 0000000100000000
    <4>[   29.158257] x8 : 0000000000000000 x7 : 7f7f7f7f7f7f7f7f x6 : 2d7223ff6364626d
    <4>[   29.158266] x5 : 0000008000000000 x4 : 0000000000000020 x3 : 2e7325006465636e
    <4>[   29.158275] x2 : ffffffdc11afeff8 x1 : 0000000000000000 x0 : ffffffdc11be4d0c
    <4>[   29.158285] Call trace:
    <4>[   29.158290]  klist_remove+0x90/0x158
    <4>[   29.158298]  device_release_driver_internal+0x20c/0x268
    <4>[   29.158308]  device_release_driver+0x1c/0x30
    <4>[   29.158316]  usb_driver_release_interface+0x70/0x88
    <4>[   29.158325]  btusb_mtk_release_iso_intf+0x68/0xd8 [btusb (HASH:e8b6 5)]
    <4>[   29.158347]  btusb_mtk_reset+0x5c/0x480 [btusb (HASH:e8b6 5)]
    <4>[   29.158361]  hci_cmd_sync_work+0x10c/0x188 [bluetooth (HASH:a4fa 6)]
    <4>[   29.158430]  process_scheduled_works+0x258/0x4e8
    <4>[   29.158441]  worker_thread+0x300/0x428
    <4>[   29.158448]  kthread+0x108/0x1d0
    <4>[   29.158455]  ret_from_fork+0x10/0x20
    <0>[   29.158467] Code: 91343000 940139d1 f9400268 927ff914 (f9401297)
    <4>[   29.158474] ---[ end trace 0000000000000000 ]---
    <0>[   29.167129] Kernel panic - not syncing: Oops: Fatal exception
    <2>[   29.167144] SMP: stopping secondary CPUs
    <4>[   29.167158] ------------[ cut here ]------------
    
    Fixes: ceac1cb ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
    Signed-off-by: Chris Lu <chris.lu@mediatek.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    (cherry picked from commit 4015b97)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    mainline inclusion
    from mainline-v6.18
    category: bugfix
    
    In btusb_mtk_setup(), we set `btmtk_data->isopkt_intf` to:
      usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM)
    
    That function can return NULL in some cases. Even when it returns
    NULL, though, we still go on to call btusb_mtk_claim_iso_intf().
    
    As of commit e9087e8 ("Bluetooth: btusb: mediatek: Add locks for
    usb_driver_claim_interface()"), calling btusb_mtk_claim_iso_intf()
    when `btmtk_data->isopkt_intf` is NULL will cause a crash because
    we'll end up passing a bad pointer to device_lock(). Prior to that
    commit we'd pass the NULL pointer directly to
    usb_driver_claim_interface() which would detect it and return an
    error, which was handled.
    
    Resolve the crash in btusb_mtk_claim_iso_intf() by adding a NULL check
    at the start of the function. This makes the code handle a NULL
    `btmtk_data->isopkt_intf` the same way it did before the problematic
    commit (just with a slight change to the error message printed).
    
    Reported-by: IncogCyberpunk <incogcyberpunk@proton.me>
    Closes: http://lore.kernel.org/r/a380d061-479e-4713-bddd-1d6571ca7e86@leemhuis.info
    Fixes: e9087e8 ("Bluetooth: btusb: mediatek: Add locks for usb_driver_claim_interface()")
    Cc: stable@vger.kernel.org
    Tested-by: IncogCyberpunk <incogcyberpunk@proton.me>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    (cherry picked from commit c884a0b)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    mainline inclusion
    from mainline-v7.0-rc1
    category: bugfix
    
    There is no added value in btintel_pcie_msix_isr() compared to
    irq_default_primary_handler().
    
    Using a threaded interrupt without a dedicated primary handler mandates
    the IRQF_ONESHOT flag to mask the interrupt source while the threaded
    handler is active. Otherwise the interrupt can fire again before the
    threaded handler had a chance to run.
    
    Use the default primary interrupt handler by specifying NULL and set
    IRQF_ONESHOT so the interrupt source is masked until the secondary
    handler is done.
    
    Fixes: c2b636b ("Bluetooth: btintel_pcie: Add support for PCIe transport")
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Thomas Gleixner <tglx@kernel.org>
    Link: https://patch.msgid.link/20260128095540.863589-7-bigeasy@linutronix.de
    (cherry picked from commit 28abed6)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    mainline inclusion
    from mainline-v7.2-rc1
    category: bugfix
    
    When btmtk_isopkt_pad() fails, the previously allocated URB is not freed,
    leaking the urb structure. Add usb_free_urb() before returning the error.
    
    Fixes: ceac1cb ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
    Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    (cherry picked from commit f396f40)
    Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
    @opsiff
    opsiff force-pushed the linux-6.6.y-2026-07-31-bluetooth branch from 758eed5 to f71eca2 Compare July 31, 2026 07:30
    @dongert
    dongert requested a review from Copilot July 31, 2026 07:30

    Copilot AI left a comment

    Copy link
    Copy Markdown

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Pull request overview

    Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

    Suppressed comments (2)

    drivers/bluetooth/btintel_pcie.c:813

    • These inline helpers exceed typical kernel line-length limits; please wrap the long return expression for readability and to avoid checkpatch warnings.
    static inline bool btintel_pcie_is_rxq_empty(struct btintel_pcie_data *data)
    {
    	return data->ia.cr_hia[BTINTEL_PCIE_RXQ_NUM] == data->ia.cr_tia[BTINTEL_PCIE_RXQ_NUM];
    }
    

    drivers/bluetooth/btintel_pcie.c:818

    • This return statement is long enough to trip kernel style/line-length checks; please wrap it onto multiple lines for readability.
    static inline bool btintel_pcie_is_txackq_empty(struct btintel_pcie_data *data)
    {
    	return data->ia.cr_tia[BTINTEL_PCIE_TXQ_NUM] == data->ia.cr_hia[BTINTEL_PCIE_TXQ_NUM];
    }
    

    @opsiff
    opsiff merged commit dc61eca into deepin-community:linux-6.6.y Jul 31, 2026
    14 of 16 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    9 participants