Skip to contentSkip to conversation

wifi: cw1200: fix link_id_db OOB access via device-controlled link ID

PATCH New Tianchu Chen 1 participant 1 message Sep 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: cw1200: fix link_id_db OOB access via device-controlled link ID

From: Tianchu Chen <[email protected]>

cw1200_rx_cb() stores the link ID from the device-supplied WSM header (a 4-bit field, range 0-15) into priv->action_linkid for P2P public action frames without an upper bound check. The work handler cw1200_link_id_reset() then uses it to index link_id_db[], which has only CW1200_MAX_STA_IN_AP_MODE (5) entries, so a device reporting a link ID of 6-15 makes the driver read and write cw1200_common fields past the array (a status copy and a constant store onto adjacent work/lock/timer fields), corrupting driver state.

The first link ID check in the same function (used for timestamp tracking) already validates against CW1200_MAX_STA_IN_AP_MODE and degrades out-of-range IDs to untracked handling, so out-of-range link IDs on the RX path are anticipated; the P2P remap branch was missed.

Add the same bound to the remap branch. This is expected to keep driver behavior unchanged in most cases: the driver itself only assigns link IDs 1..5, and a P2P public action frame carrying any other ID now degrades to the same untracked handling the first branch already applies, instead of corrupting memory.

Discovered by Atuin - Automated Vulnerability Discovery Engine.

Fixes a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
Assisted-by LLM
---
 drivers/net/wireless/st/cw1200/txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/st/cw1200/txrx.c +1 -1
index e13695667a00b..33b02e562b79e 100644
@@ -1050,7 +1050,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,
 		schedule_work(&priv->linkid_reset_work);
 	}
 
-	if (link_id && p2p &&
+	if (link_id && link_id <= CW1200_MAX_STA_IN_AP_MODE && p2p &&
 	    ieee80211_is_action(frame->frame_control) &&
 	    (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC)) {
 		/* Link ID already exists for the ACTION frame.
Signature · 1 line
2.51.0