From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795970920; b=BJvJPIMhujC0pfESzok8EU1l0+iXwSto2qiLD0hcwC7qaTGogfYtAMGmXk3X/os6HWCO Vi7LfdtvfCCVKN8pxAK6RtAF0Q1ROGg1bhTbtvKe3mXYN/EzkK7hoaWtQhaWNjJrBkCHg DEGz9lG7/rXlMqJJg23tqsITPiQzlp84a4r01nDFw9phDx/GrogTKa0Lf++ov15hEHRgr Vd+n2lyxeqAFlUOUe+mdlXx/MZB14GuwXX30hogGm5fBDJbQutVwKuYZNwCne7Dt7HMq9 TqrFyb2pGwjQdKw5yLRlUf3hFsCmueh8WOWy/eLEHDFOMmWrdCoLv7TrLwfKv1jnDOA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795970920; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=3IBrd4fveKrpFE8URJc0/B7OVVNEuCJNKmYo+DkpS28=; b=VzlKLDvUMR6caayyDgmYs8EH+DRzYp5aX+Yi47/rZlPA7KA1wyeYIO4Ivur2op+lllzu az0h0UQRGF3PKeZXKjDk2Fmv7uY7ug5q7SscIvYktVaHNlme2AnCsnPMhGMMITx+ZZhtO zZVPklPg/C7rzZcRlDhrowvFASm7cCB9YaJK+w03UWk/dTgZfzgu9nh0d8gf6bY5E3MNB dHWkqG2I4F3AIlWYIqG6TPnFuepRMzMiv+/ZLfrEPDf12vmAFHW9vUkWdWq19+zelC7z3 sP8Z9tbF1raTD1neBKDkxn6aBjP0Y8cmqKwcknS1z9CTDzZTQpEO+hrMNaGP2wTwImw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Io5gmaRh; arc=none smtp.remote-ip=74.125.82.44 Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 117CF606A323 for ; Sun, 29 Nov 2026 16:48:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 117CF606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Io5gmaRh Received: by mail-dl1-f44.google.com with SMTP id a92af1059eb24-1ae58d17cd9so11068964c88.1 for ; Sun, 29 Nov 2026 08:48:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795970919; x=1796575719; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=3IBrd4fveKrpFE8URJc0/B7OVVNEuCJNKmYo+DkpS28=; b=Io5gmaRhEP4eujFv1S1FCR6OMx2plNRDFZHxkfl4+RuxHP1L0UsKcYv/cYNkZRWSlE eAU8WrzMi2bvPUX2mdX1E11xRCQIheHds2x4gcgDaixcNzJOdLOFNNDLcXspdgI3mVfO yOHHAJ+EA77wWbhSQkCT5CH27hs6Ump7pJw4DqnFKZSI9r6SIX3o3lVZLE6uZs8mQpJh 0JzxDpuqkxVqzhUlSal/rvKfhN58dfIagzvriOHW+LuNhoUGHQobsYgTlAbh6sEnyG88 crK729f3JEZgbVNxdsB2/mZZhrxlIwHHEMKRTV0owrHGbBshVckgAKSUrhaicbZK3rCx mu7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795970919; x=1796575719; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3IBrd4fveKrpFE8URJc0/B7OVVNEuCJNKmYo+DkpS28=; b=nG0p28cqqxSNT7gtLGMK7LjbHmxW5L9dZP9eNIIBn/C2yV+GeDb9nxRvBikgUvovdF j+9pRDxcae9NmsbRIMVBsURhcyXSyzW26mWA30JLY9LWKojewx+RRWp8Q0DEtiHhi/Sz 3WOgbBxeg/SAP90eSFMOC7cxUsImEC+OoMpm6gDppZA1n7XHOf15/7Pw85cRgYDZurck NTCVOFi6UyQXQAhmZL33YHXRCVtpQpMos0VhL0nMU8eC2kjJYA+S+tQXAaKDgU0+Ypql YgZ7NdJo6+lqEcarQWej3qtN7KSb6XgpxX1dXphJCn8A0PCd6rJaQlS7IuYwcpZ2P/9Z tVMA== X-Gm-Message-State: APuU4Z955AubdRpzC8tM/b/QreXjHZiHF4oGLpu+Gb9mMVaQt/OejXzC azybJCm7FRZAVV9uJBXMZC0cPh4r0FUkmlj31UMrBFjtAXq/CDdgMjnt X-Gm-Gg: AZFdTZeyKjIQTJZ5zJ1s21eYHS/vFnrKmkv/xsJtwGdFoFrk6soFVuXSgxTviAZ0+BU nPB8wpAjR2PT2h1+gXur0WwLptWzkPGQvHsn7eCGxsZvKwvR0SJuPXHMpI6jwKn9Uwf2n2HEBoX VjgZPFeQUP6ANMlHyU4CyxKJyn4kH0Y2EguXMtS5KXuyWCIdCiQ0af1xzHq+6jLyEmgNlbq1KUu 6UATyyAH6Q/zcIlXgU0OVcnalyaO19o4c1p8TCVoxGugI+xPWKp0gIkoQCCAg/xmUi4GkKX19M+ DteI6v+XXX9ShlnDzrF+hVO5+XyNOT6szx7VKkmV4hdTpcVJZTpjKa/WVAalgzDWzpU088pm6G1 b4uGvtNFoYr8nfvpyU1LpSwk6AraxlrcrXkcXSAH0n6rafA7hFpNdbKt82DNHMqwvSItJDG4grX PYYyqHh7/aIefaaJPBiLo3iPkWmRAO1wr8Pj4BOG2+V+1lcrI+PaBZGuztewA/4kR2fIcotLYFv kFObIPSnlCyV0LVXIj76T/Fi9CA4YROcXzOc4p0tB2++FPGofWNQ2V+lx4rgsJLhJZITt8zRZsl vtNS67DvL9gQKlg19XYiXcNCNfCiUPT8EI9V5qWwxwE80FsfDjE8YAVwJyG0Fg3kqSxKYYhr9mS Dxs9cltPDqnTCb/i1DImRU1m9gc8= X-Received: by 2002:a05:7022:ea8c:b0:1b5:9d8b:fc85 with SMTP id a92af1059eb24-1b59d8bfcaamr6871717c88.30.1795970919035; Sun, 29 Nov 2026 08:48:39 -0800 (PST) Received: from acemagic-m1.lan ([2401:7400:c804:b668:201b:f838:b7fe:aaf7]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5567ff27bsm83246839c88.6.2026.11.29.08.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 08:48:38 -0800 (PST) From: Ho Jie Feng To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Ho Jie Feng Subject: [PATCH wireless] wifi: mac80211: copy the operation elements in cfg80211_beacon_dup() Date: Mon, 30 Nov 2026 00:48:32 +0800 Message-ID: <20261129164832.65959-1-hjf3108@gmail.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For a copy made by cfg80211_beacon_dup(), such as during a channel switch, the *_oper pointers are not copied over, even though the tail is. Therefore, ieee80211_calc_ap_he_and_lower() finds no operation element and returns 20 MHz, which is inaccurate. It stays there until the next beacon is received, then it is parsed again and corrected. Driver's own rate control or minstrel_ht can run between updates, so it started over at 20 MHz and again at 80 MHz. Point the four pointers of the copy at the same offsets in the copy's tail. Fixes: c9b62ab79133 ("wifi: mac80211: fix per-station PHY capability bandwidth") Fixes: 14b1a85518a1 ("wifi: mac80211: AP: handle DBE for clients") Signed-off-by: Ho Jie Feng --- net/mac80211/cfg.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 9d7c03b6a6..34e5f1764b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -4601,6 +4602,17 @@ static void ieee80211_end_cac(struct wiphy *wiphy, } } +static const void * +ieee80211_beacon_dup_tail_elem(const struct cfg80211_beacon_data *beacon, + const struct cfg80211_beacon_data *new_beacon, + const void *elem) +{ + const u8 *pos = elem; + + /* nl80211 guarantees it is a valid offset into the source tail */ + return PTR_IF(pos, new_beacon->tail + (pos - beacon->tail)); +} + static struct cfg80211_beacon_data * cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon) { @@ -4654,6 +4666,19 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon) new_beacon->tail = pos; memcpy(pos, beacon->tail, beacon->tail_len); pos += beacon->tail_len; + + new_beacon->ht_oper = + ieee80211_beacon_dup_tail_elem(beacon, new_beacon, + beacon->ht_oper); + new_beacon->vht_oper = + ieee80211_beacon_dup_tail_elem(beacon, new_beacon, + beacon->vht_oper); + new_beacon->he_oper = + ieee80211_beacon_dup_tail_elem(beacon, new_beacon, + beacon->he_oper); + new_beacon->eht_oper = + ieee80211_beacon_dup_tail_elem(beacon, new_beacon, + beacon->eht_oper); } if (beacon->beacon_ies_len) { new_beacon->beacon_ies_len = beacon->beacon_ies_len; -- 2.53.0