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 4F94C346E55; Fri, 21 Nov 2025 13:33:08 +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=1763731988; cv=none; b=CwYDwJi5HPOARu2Y49fl+jgf5OMzWh1edXteEX3zE/N7RielafX24K5UwqpD22jwKe7ceRmAJR2TDNkfMC0fgTBx7ui9azNG89qWfPM5UJiJf8tGEfa3za/+1IMxhZRO+EpMsdnk6dgQJDt3Jdkoqb8B+ixHsT3Y2ppj1qaXFLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763731988; c=relaxed/simple; bh=2nv1ddhawb3mAU+JgEjOh2yLSf/nhwVlCGB0eqfYV1U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OQAOAUr2uasoKPMH4slIakOzqSrRWNrYjuVfqUVaGd5qNM/lpty42pm5168NyQLh3lVtwhzlS1wZ0PQiZ9pzbnz8pzURGr6mTYcIpKfn+QRa31QrGPz/jnS3nPYtuy1ZdLVwBAbT6QgV5lUs5Q76jmjyk3Dut87a++fcq1No25U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LwZlCLfY; 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="LwZlCLfY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75ECEC4CEF1; Fri, 21 Nov 2025 13:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763731987; bh=2nv1ddhawb3mAU+JgEjOh2yLSf/nhwVlCGB0eqfYV1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LwZlCLfYrlu7msbevIxypDc0H+aZMcbh5vfW3tr4nRfKKKIwnRH9HPKFMWZDkEpZe E7EuNuggiBqIm7YT6zBY0LuaO9lGjIauYnZygXXlbQpMWAxV7dPFIGTkNrdhvqEUvX f/4gk53n/2by4qW8RVSvzuWYybL1aYl4j8Kxhv2E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johannes Berg Subject: [PATCH 6.12 123/185] wifi: mac80211: reject address change while connecting Date: Fri, 21 Nov 2025 14:12:30 +0100 Message-ID: <20251121130148.314348500@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130143.857798067@linuxfoundation.org> References: <20251121130143.857798067@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: 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 @@ -224,6 +224,10 @@ static int ieee80211_can_powered_addr_ch if (netif_carrier_ok(sdata->dev)) return -EBUSY; + /* 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) @@ -243,12 +247,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;