public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Aviel Zohar <avielzohar123@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org, nbd@nbd.name,
	lorenzo@kernel.org, sean.wang@mediatek.com,
	ryder.lee@mediatek.com, Aviel Zohar <avielzohar123@gmail.com>
Subject: [PATCH 0/2] wifi: mt76: add missing skb length validation
Date: Mon, 13 Apr 2026 06:31:33 +0300	[thread overview]
Message-ID: <20260413033136.5417-1-avielzohar123@gmail.com> (raw)

This series addresses missing skb length validation in two mt76
drivers before memcpy operations on firmware MCU responses.

In both cases, the driver copies a fixed number of bytes from
skb->data without first checking that skb->len is large enough.
If the firmware returns a shorter-than-expected response (due to a
bug, partial DMA transfer, or in the case of mt7925, a malicious
USB device), the memcpy reads beyond the skb data buffer, causing
a heap buffer over-read. The over-read data is subsequently
returned to userspace.

Patch 1: mt7925 testmode - mt7925_tm_query() copies 512 bytes
(MT7925_EVT_RSP_LEN) from skb->data + 8 without verifying
skb->len >= 520. The leaked data is returned via nla_put()
through nl80211 testmode dump. Fix adds a length check before
the memcpy.

Patch 2: mt7915 txpower - mt7915_mcu_get_txpower_sku() copies
up to 322 bytes (MT7915_SKU_RATE_NUM * 2) from skb->data + 4
without verifying skb->len. The data surfaces through debugfs
(txpower_sku, txpower_path). Fix adds length checks for both
the TX_POWER_INFO_RATE and TX_POWER_INFO_PATH code paths.

Both fixes follow the same pattern: validate skb->len before
performing the memcpy, returning -EINVAL on insufficient data.

Tested by code inspection; I do not have the hardware to
run-test these changes.

Aviel Zohar (2):
  wifi: mt76: mt7925: validate skb length in testmode query
  wifi: mt76: mt7915: validate skb length in txpower SKU query

 drivers/net/wireless/mediatek/mt76/mt7925/testmode.c | 5 +++++
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c      | 8 ++++++++
 2 files changed, 13 insertions(+)

-- 
2.34.1


             reply	other threads:[~2026-04-13  3:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13  3:31 Aviel Zohar [this message]
2026-04-13  3:31 ` [PATCH 1/2] wifi: mt76: mt7925: validate skb length in testmode query Aviel Zohar
2026-04-13  3:31 ` [PATCH 2/2] wifi: mt76: mt7915: validate skb length in txpower SKU query Aviel Zohar

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=20260413033136.5417-1-avielzohar123@gmail.com \
    --to=avielzohar123@gmail.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@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