From patchwork Mon Jan 29 19:00:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 768019 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 D5A632E84D for ; Mon, 29 Jan 2024 19:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706554862; cv=none; b=iF/JRS75uD3g1oTBAYCqyn03xblZ8RolJW88Qvhq8/cN7LFJamHz9KpUyPW5EOHP7pV60c9OnKdrFxjeKdOsaGFQA8MX/1ihUKm1eQLkW+GUNrUC12Ey9fiV5oZrkWi77TziUVKipvpSsJIA3ApPSkWInRpAW+jJz0tb72ZvnyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706554862; c=relaxed/simple; bh=mPa10nyf13l86zZZOqYww/Dw0Gtbihdyr/EQYTCqpV8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Qq9eW/VhfCxVE63yQcm1+eiGOFSWgvTzIoTpE5S8GWMseH9+Gt9/xOs+s+pNbxRwsQStx68tSmHSYPECAiL2x7ibMMhUO/W1xviZMQxNCQKN9/EvXMlRxLjJH8wWLPjiO1sVcDCFqHAmUhCeOOjqZ2XIfJmgD6L//lFT9VNJ054= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=htFUGfmj; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="htFUGfmj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=rRcn+qgYpoXfyfNOBOtN2tvNKZ4+uKF2SFfvhVq6eWk=; t=1706554860; x=1707764460; b=htFUGfmj3JcZS0KxITjNuU00ktf3hHKb2DzQP4TxcxsscTql38g7U3Kk3SUhE0UDSfvuQ0TNmFu 3mirppL3ivsGCLPPswIRgmAujjRwUiJOEA15KnkXVzrEzxQfxcCe7gB8IContG/iHIhqrTcp6QOAg T5HHM5SIKdndUPTLj31Fn76n+E0s7c7OOSPhM9VtXiYRUrZRTp7qcFvE1jYwI9KqbA886RCNNkUxS FawBXeGoDbawd7JbYKTZf4zv7ST/c6TsiAH4sOGmNezF1Bw8H897Y+nFey1xNnWQdg3ssNIVdKl4j PZvPSH5HDfgiKK8fUYnKMza+HNo4935MIXyw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rUWsM-00000004zxs-0wBJ; Mon, 29 Jan 2024 20:00:58 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Miri Korenblit Subject: [PATCH 1/2] wifi: mac80211_hwsim: enable all links only in MLO Date: Mon, 29 Jan 2024 20:00:52 +0100 Message-ID: <20240129200054.f5459f6c29c8.I397814449e17950fcf882ef44a1e790a71aa1dce@changeid> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Miri Korenblit The existing code is enabling all usable links when moving to authorized state, but this should happen only for MLO connections. Fix this. Signed-off-by: Miri Korenblit --- drivers/net/wireless/virtual/mac80211_hwsim.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index 59ec6aa5ac26..907c0842fee7 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -4,7 +4,7 @@ * Copyright (c) 2008, Jouni Malinen * Copyright (c) 2011, Javier Lopez * Copyright (c) 2016 - 2017 Intel Deutschland GmbH - * Copyright (C) 2018 - 2023 Intel Corporation + * Copyright (C) 2018 - 2024 Intel Corporation */ /* @@ -2671,10 +2671,11 @@ static int mac80211_hwsim_sta_state(struct ieee80211_hw *hw, return mac80211_hwsim_sta_add(hw, vif, sta); /* - * when client is authorized (AP station marked as such), - * enable all links + * in an MLO connection, when client is authorized + * (AP station marked as such), enable all links */ - if (vif->type == NL80211_IFTYPE_STATION && + if (ieee80211_vif_is_mld(vif) && + vif->type == NL80211_IFTYPE_STATION && new_state == IEEE80211_STA_AUTHORIZED && !sta->tdls) ieee80211_set_active_links_async(vif, ieee80211_vif_usable_links(vif)); From patchwork Mon Jan 29 19:00:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 768446 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 93B6F2E85E for ; Mon, 29 Jan 2024 19:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706554866; cv=none; b=SU9zF1InKb+qruZzGAQOeX3rcwEKTLQ4FxoFdoqGIGCNA0F1kHT+Jh9w8z4ZCYcghAKXEbCiLZpy3F1ACusk/nq0K318bNTYB5PgGO9apoivGwnlMBa63nwnFdKn2zT5JXFmSrTS4D6y05VMTekcy5mFoc3dWiJu4cHF/22PiAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706554866; c=relaxed/simple; bh=CvN1ySvJLuu4RN0j4uTOxpixHqUEdlGl1jjaOMa3GPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UQwi05JmyKu6oBZGrYlW4ZeVaHVNbY28QgTXrNVJCinvTj+Y8q+dFwsNjrEnVQGkBJldPtUTKEh0k7japbSyAjpBjcGio/BqKCU6RzRe6t/+eLjjVffeMK723lYMDJ/vj2Sy+L0it8gokMwlm1n0TBWMRPZ/O2HLFUb6VwOZT1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=DURfftgS; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="DURfftgS" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=TRS0TwZfnpIzABYziayrMWmZOvf0lrRT2IIV8nc+K+U=; t=1706554861; x=1707764461; b=DURfftgSEqWGk1lB9BA88RSRRPrypnwjpUfawbGfClYdAqK Nee9XzpjilW0w9vw7VErhOQwZu8VdryH2OPAZoHiljriklwwok1oMYDkp7Q6L0sHvJvyhWvZ2mwXr /Uv9DgVeiVLk1/j7NyhP5NwpTx0+GOL+XgEZ9j4HGCtk4pLW5S3lK54OtWkA0oFA9yINpRR86sRsA pgjXD41cRyEWDjKAiCckm7l5KfJjKaQ52MKppMV482fOI58yCPKocEdrLu/3UNjAS8bmvCIROvEW8 iKbnwiCrh7UV1U8QJyzy+51u8wO36IQeIYiHTfLXKrwzV6CQ5izEpP5gzwzlsszw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rUWsM-00000004zxs-3wLJ; Mon, 29 Jan 2024 20:00:59 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Miri Korenblit Subject: [PATCH 2/2] wifi: mac80211: don't allow deactivation of all links Date: Mon, 29 Jan 2024 20:00:53 +0100 Message-ID: <20240129200054.e3c113f94508.Ia35f927f914bf98dd8f9350dd4f78b1d901b1c1d@changeid> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129200054.f5459f6c29c8.I397814449e17950fcf882ef44a1e790a71aa1dce@changeid> References: <20240129200054.f5459f6c29c8.I397814449e17950fcf882ef44a1e790a71aa1dce@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Miri Korenblit The set_active_links API is intended for link switching, so switching to no links at all is not supported. Add a warning to check that. Signed-off-by: Miri Korenblit --- net/mac80211/link.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/mac80211/link.c b/net/mac80211/link.c index 79bda7184fe8..4f19d6479bef 100644 --- a/net/mac80211/link.c +++ b/net/mac80211/link.c @@ -445,6 +445,9 @@ int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links) lockdep_assert_wiphy(local->hw.wiphy); + if (WARN_ON(!active_links)) + return -EINVAL; + if (!drv_can_activate_links(local, sdata, active_links)) return -EINVAL; @@ -473,6 +476,9 @@ void ieee80211_set_active_links_async(struct ieee80211_vif *vif, { struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); + if (WARN_ON(!active_links)) + return; + if (!ieee80211_sdata_running(sdata)) return;