From: Mariano Baragiola <mbaragiola@linux.com>
To: Ajay Singh <ajay.kathat@microchip.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Mariano Baragiola <mbaragiola@linux.com>
Subject: [PATCH] wifi: wilc1000: validate monitor transmit frame headers
Date: Tue, 28 Jul 2026 16:26:10 -0300 [thread overview]
Message-ID: <20260728192610.2236361-1-mbaragiola@linux.com> (raw)
wilc_wfi_mon_xmit() reads the radiotap length before ensuring that the
fixed header is present. After stripping that header, it reads the frame
type and all three 802.11 addresses without checking how much frame data
remains.
A truncated monitor injection can therefore cause out-of-bounds reads.
Validate the radiotap header first, use the common 802.11 helper to check
the variable header length, and require a complete three-address header
before using the addresses. This covers QoS and four-address data headers
while rejecting short control headers that this path cannot classify.
Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Mariano Baragiola <mbaragiola@linux.com>
---
drivers/net/wireless/microchip/wilc1000/mon.c | 30 +++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/microchip/wilc1000/mon.c b/drivers/net/wireless/microchip/wilc1000/mon.c
index b5cf6fa7a851..9b8c083b403d 100644
--- a/drivers/net/wireless/microchip/wilc1000/mon.c
+++ b/drivers/net/wireless/microchip/wilc1000/mon.c
@@ -142,6 +142,9 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
struct net_device *dev)
{
+ struct ieee80211_radiotap_header_fixed *rtap_hdr;
+ struct ieee80211_hdr_3addr *hdr;
+ unsigned int hdr_len;
u32 rtap_len, ret = 0;
struct wilc_wfi_mon_priv *mon_priv;
struct sk_buff *skb2;
@@ -153,13 +156,26 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
if (!mon_priv)
return -EFAULT;
+ if (skb->len < sizeof(*rtap_hdr))
+ goto drop;
+
+ rtap_hdr = (void *)skb->data;
+ if (rtap_hdr->it_version)
+ goto drop;
+
rtap_len = ieee80211_get_radiotap_len(skb->data);
- if (skb->len < rtap_len)
- return -1;
+ if (rtap_len < sizeof(*rtap_hdr) || skb->len < rtap_len)
+ goto drop;
skb_pull(skb, rtap_len);
+ hdr_len = ieee80211_get_hdrlen_from_skb(skb);
+ if (hdr_len < sizeof(*hdr))
+ goto drop;
- if (skb->data[0] == 0xc0 && is_broadcast_ether_addr(&skb->data[4])) {
+ hdr = (void *)skb->data;
+
+ if (ieee80211_is_deauth(hdr->frame_control) &&
+ is_broadcast_ether_addr(hdr->addr1)) {
skb2 = dev_alloc_skb(skb->len + sizeof(*cb_hdr));
if (!skb2)
return -ENOMEM;
@@ -191,8 +207,8 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
}
skb->dev = mon_priv->real_ndev;
- ether_addr_copy(srcadd, &skb->data[10]);
- ether_addr_copy(bssid, &skb->data[16]);
+ ether_addr_copy(srcadd, hdr->addr2);
+ ether_addr_copy(bssid, hdr->addr3);
/*
* Identify if data or mgmt packet, if source address and bssid
* fields are equal send it to mgmt frames handler
@@ -207,6 +223,10 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
}
return ret;
+
+drop:
+ dev_kfree_skb(skb);
+ return NETDEV_TX_OK;
}
static const struct net_device_ops wilc_wfi_netdev_ops = {
--
2.55.0
reply other threads:[~2026-07-28 19:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260728192610.2236361-1-mbaragiola@linux.com \
--to=mbaragiola@linux.com \
--cc=ajay.kathat@microchip.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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