Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Lu <chris.lu@mediatek.com>
To: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Von Dentz <luiz.dentz@gmail.com>
Cc: Sean Wang <sean.wang@mediatek.com>,
	Will Lee <will-cy.Lee@mediatek.com>, SS Wu <ss.wu@mediatek.com>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mediatek <linux-mediatek@lists.infradead.org>,
	Chris Lu <chris.lu@mediatek.com>
Subject: [PATCH 0/2] Bluetooth: btmtksdio: Fix SKB handling in the TX path
Date: Mon, 17 Aug 2026 17:53:30 +0800	[thread overview]
Message-ID: <20260817095332.182994-1-chris.lu@mediatek.com> (raw)

btmtksdio_tx_packet() rounds the SDIO transfer size up to the 256 byte
block size, but never grows the SKB accordingly, so the host controller
reads up to 255 bytes of uninitialised memory and sends it to the device,
and can read past the end of the buffer as well.

Patch 2 fixes that by padding the SKB with zeros. The padding is written
behind skb->tail, which is only safe once the driver owns the data
buffer, so patch 1 replaces the open-coded headroom check with
skb_cow_head() first. Patch 1 on its own changes no observable
behaviour, but it is a hard prerequisite, so both patches carry the same
Fixes: tag.

Both patches were previously part of a larger MT7928 series [1]. They
are unrelated to MT7928 and to the USB driver, so they are sent
separately here. The remaining parts of that series will follow as
separate topic branches.

Tested on a Chromebook with MT7921S: Bluetooth power on, then A2DP
connect and stream continuously for one hour without failure. The padding
added by patch 2 covers every packet whose length is not a multiple of
the block size, and the reallocation added by patch 1 covers every HCI
command, which hci_send_cmd_sync() always clones into hdev->sent_cmd.

[1] https://lore.kernel.org/linux-bluetooth/20260717072133.2858136-1-chris.lu@mediatek.com/

Chris Lu (2):
  Bluetooth: btmtksdio: Take exclusive ownership of the SKB before TX
  Bluetooth: btmtksdio: Fix out-of-bounds DMA read in the TX path

 drivers/bluetooth/btmtksdio.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

-- 
2.45.2



             reply	other threads:[~2026-08-17  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  9:53 Chris Lu [this message]
2026-08-17  9:53 ` [PATCH 1/2] Bluetooth: btmtksdio: Take exclusive ownership of the SKB before TX Chris Lu
2026-08-17  9:53 ` [PATCH 2/2] Bluetooth: btmtksdio: Fix out-of-bounds DMA read in the TX path Chris Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260817095332.182994-1-chris.lu@mediatek.com \
    --to=chris.lu@mediatek.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=sean.wang@mediatek.com \
    --cc=ss.wu@mediatek.com \
    --cc=will-cy.Lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox