From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 040F926ED3B; Wed, 3 Dec 2025 16:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764779922; cv=none; b=SD8xiRgxy53crZMAWtLpzHgFZxm4f9lB7G1OCDiXQFLo+6lI1pYCLx0zcvg/wiE60sYFKsWxv5aKy4FLJlqiV8+77PpERUO9RLQGHmjDFR48wQvUafH84XNSrmFD4K0XZCTCiDN5ex5UEfUT7UATkRjcRKdjmYPwqNhw4zS4Ltk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764779922; c=relaxed/simple; bh=KIu0pIja8dfV34IlIEikEroEwO3E5+wPU1FfXi1QPi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FHtRoUsPI3rAZw5HA5GNLIz7dXsHEsHRIjtpioARA2orkmXd+dI2Axed9riIn7keuVNKzZyPhSx1sIwFrTGXaKZu3+IO8N94+oHuRk7BJ2WkOboGm0apZYFWhZADgP47WnhIL4/ITkBY1BbtwBel32MPGr6INSFD4UCpGy63fM4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ltt7kGJr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ltt7kGJr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18306C4CEF5; Wed, 3 Dec 2025 16:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764779921; bh=KIu0pIja8dfV34IlIEikEroEwO3E5+wPU1FfXi1QPi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ltt7kGJrUOsstlqQQ/pg6ObAD7U/r9YqpW+2PHpaveisZ39c5v+LeJ4nm0R5V2E2o 1TDRsiZI8WGSDtw4TQ52LT+x1Gl6X97awpnTEVmvt0NmuSYu3KMLXmkfuSH5re1zs4 VHMEg8RpKFtceXp2JWnhy5K7AarOFvlX/FR/fNYs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johannes Berg Subject: [PATCH 6.1 403/568] wifi: mac80211: reject address change while connecting Date: Wed, 3 Dec 2025 16:26:45 +0100 Message-ID: <20251203152455.449614832@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152440.645416925@linuxfoundation.org> References: <20251203152440.645416925@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Berg commit a9da90e618cd0669a22bcc06a96209db5dd96e9b upstream. While connecting, the MAC address can already no longer be changed. The change is already rejected if netif_carrier_ok(), but of course that's not true yet while connecting. Check for auth_data or assoc_data, so the MAC address cannot be changed. Also more comprehensively check that there are no stations on the interface being changed - if any peer station is added it will know about our address already, so we cannot change it. Cc: stable@vger.kernel.org Fixes: 3c06e91b40db ("wifi: mac80211: Support POWERED_ADDR_CHANGE feature") Link: https://patch.msgid.link/20251105154119.f9f6c1df81bb.I9bb3760ede650fb96588be0d09a5a7bdec21b217@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/iface.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -216,6 +216,10 @@ static int ieee80211_can_powered_addr_ch mutex_lock(&local->mtx); + /* if any stations are set known (so they know this vif too), reject */ + if (sta_info_get_by_idx(sdata, 0)) + return -EBUSY; + /* First check no ROC work is happening on this iface */ list_for_each_entry(roc, &local->roc_list, list) { if (roc->sdata != sdata) @@ -235,12 +239,16 @@ static int ieee80211_can_powered_addr_ch ret = -EBUSY; } + /* + * More interface types could be added here but changing the + * address while powered makes the most sense in client modes. + */ switch (sdata->vif.type) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: - /* More interface types could be added here but changing the - * address while powered makes the most sense in client modes. - */ + /* refuse while connecting */ + if (sdata->u.mgd.auth_data || sdata->u.mgd.assoc_data) + return -EBUSY; break; default: ret = -EOPNOTSUPP;