From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A897038F658; Sat, 17 Oct 2026 16:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792254181; cv=none; b=eQ5mHE+iUQ8F/xjHNPyTC++en/gSxXfqJPYNe3SSUSwgHQ2KZ8DU/uIvGW8Qe/E//2sSPUP99qIQycOBSK86YXrtsXJZ2LhEYzEgvWHKreme7xSmSwa9nkYCIawhwxKBosGrZNPU36CccwMOC9cLA6SKvcv8rMLtOZbJSZZ3Iz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792254181; c=relaxed/simple; bh=kqlJdcMD9+B4NQz5teMtVWWIfI/zhVWE5WUyzsiC9os=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rvqZuG0kFUYAF521kLvOw1t8NR7NE+iIfk6FXLWM/BJtPMX8zweciV0l+kSjylz7DKBVVlsdVuhCfJCydYTSrF3/QFv6UI2wEhi7CoAnP89tndQTT2qb8b7P+O5hjufuwqyAfV9/0RnZzd4FW51rKkdhvAQA8r2nz+FMh6PxivY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PB29k/cU; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PB29k/cU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ABCF1F000C4; Sat, 17 Oct 2026 16:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792254180; bh=TF6s5bl0ZE1Q/INIHTCIdOEngftv2CBJQNJFBF+MG4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PB29k/cUHUFmTy/Uk97B2yBZLpE0jIV9dWzOIsFGDS4uLnLdkHlnd7GnC6LjebhLq QTn1oZmfWMH4Dx8938nVrCkBul/ZtibZnup/HrtFbmy6L99CWBoXoP5/XL0DqNCPVd h5o8KXLgCLm6QYCKCXVg/EptWRc7bToWRk4SCWZc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhao Li , Johannes Berg , Sasha Levin Subject: [PATCH 6.12 362/869] wifi: mac80211: capture fast-RX rate before mesh reuses skb->cb Date: Sat, 17 Oct 2026 17:53:23 +0200 Message-ID: <20261017160046.390789238@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160036.979869304@linuxfoundation.org> References: <20261017160036.979869304@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhao Li [ Upstream commit d71c841be5d9e586ee7f36c0dc8ed4db0d9a1349 ] ieee80211_invoke_fast_rx() reads RX status through IEEE80211_SKB_RXCB(skb), which aliases the same skb->cb storage that ieee80211_rx_mesh_data() reuses as IEEE80211_TX_INFO. In the unicast forward path, mesh_data does: info = IEEE80211_SKB_CB(fwd_skb); memset(info, 0, sizeof(*info)); on the same skb the caller still names via rx->skb, then either queues the skb for TX (success) or kfree_skb()'s it (no-route) before returning RX_QUEUED. The caller's RX_QUEUED arm then calls sta_stats_encode_rate(status) on memory that is either zeroed (success path) or freed (no-route path). The latter is KASAN slab-use-after-free in ieee80211_prepare_and_rx_handle. Fix by encoding the rate from status before invoking ieee80211_rx_mesh_data(), so the RX_QUEUED arm consumes a value captured while status was still backed by valid memory. Fixes: 3468e1e0c639 ("wifi: mac80211: add mesh fast-rx support") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li Link: https://patch.msgid.link/20260509043427.60322-2-enderaoelyther@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/rx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 7b4528e858bb8..e7f940a890dd4 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4897,6 +4897,7 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, u8 sa[ETH_ALEN]; } addrs __aligned(2); struct ieee80211_sta_rx_stats *stats; + u32 encoded_rate; /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write * to a common data structure; drivers can implement that per queue @@ -5004,11 +5005,14 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, /* push the addresses in front */ memcpy(skb_push(skb, sizeof(addrs)), &addrs, sizeof(addrs)); + /* capture before mesh forward may memset or free skb->cb */ + encoded_rate = sta_stats_encode_rate(status); + res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb); switch (res) { case RX_QUEUED: stats->last_rx = jiffies; - stats->last_rate = sta_stats_encode_rate(status); + stats->last_rate = encoded_rate; return true; case RX_CONTINUE: break; -- 2.53.0