From patchwork Mon May 13 10:27:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 797235 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 1DD40149E10 for ; Mon, 13 May 2024 10:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596045; cv=none; b=Gs4Fpne4v6jMQKj35qF8cnGv74T5o9o7d2c8hWqCg01sZn/hF2MqqEAgDzVCbPUo8Me9hq53Lt4V7KqUrtCTmhd6e35XLWmQFEzverwr4bh9hHBTGYB2CCxVSJCEmEPxdR2RB3kjzWzArOlqFXfifiCZkSOjtgq7GNe7pR/Wn5g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596045; c=relaxed/simple; bh=Xx5pLBsgUlxE8H2K/SB1YiMkYLTpqlJoU0G/d+327Vo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EysUskRqXqL+Q1x8SNQLzPzPGUzFkZmfIhN7mPgHH5SEMYcjMog4ZQ9LbVi0rfzq8qXN8k0fjPn8/HTKr/LfS6Dml7eFkMU7RjEOqokbenT9oCg9stKanM2qRL2xWqMb8ReP7qPnEImdq6e4kyp/r2uNUq7qni5QBkYKWjH/g9U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dHgx+m6+; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dHgx+m6+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596044; x=1747132044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xx5pLBsgUlxE8H2K/SB1YiMkYLTpqlJoU0G/d+327Vo=; b=dHgx+m6+V/1qgIHY/gIMx5GVkSb46lyWOwmuqMWR7aRQy1VGjdLv2IR5 F5AeBfCB6VvMh/xrQD9GhR9s4Wu97I+AIKpkfdvvq1qD/HlvOdK3qXAmA fwLM14gKuKh4RzIYMLmBmWWoJFkCp1T3wJ60HmM//QZEi9UC4hDbiQFeZ ttCwrLrXkUHFA/07jXPAQEr7Uud8UD73e+S/02PO9OeTu0BM1el/ZxQqq zw0d13x1903dQviwnVy7QiRzynSyPPyXiuw1qPqC3dhHJurYPWTzVpANB YzmsuFhleUvHUWEKaKvj9yUxa9NGcJGQmNDjapdFYaUdhKCd/Qnaj1fhG g==; X-CSE-ConnectionGUID: mz+l3enwS9qgIRJE8l78Gg== X-CSE-MsgGUID: osuUTNsUSOKS5nt4rH6kJw== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928648" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928648" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:23 -0700 X-CSE-ConnectionGUID: Hw4AXQ20TBic4ZorYXKXKA== X-CSE-MsgGUID: xTVzcti3RzK7gutVngjc3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516400" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:21 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg Subject: [PATCH 1/7] wifi: iwlwifi: mvm: remove stale STA link data during restart Date: Mon, 13 May 2024 13:27:08 +0300 Message-Id: <20240513132416.d2fd60338055.I840d4fdce5fd49fe69896d928b071067e3730259@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Benjamin Berg If pre-recovery mac80211 tried to disable a link but this disablement failed, then there might be a mismatch between mac80211 assuming the link has been disabled and the driver still having the data around. During recover itself, that is not a problem, but should the link be activated again at a later point, iwlwifi will refuse the activation as it detects the inconsistent state. Solve this corner-case by iterating the station in the restart cleanup handler. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 37 +++++++++++++++++++ .../net/wireless/intel/iwlwifi/mvm/mld-sta.c | 10 ++--- drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 5 +++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 8f4b063d6243..290670310ae8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -1115,6 +1115,39 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL); } +static void iwl_mvm_cleanup_sta_iterator(void *data, struct ieee80211_sta *sta) +{ + struct iwl_mvm *mvm = data; + struct iwl_mvm_sta *mvm_sta; + struct ieee80211_vif *vif; + int link_id; + + mvm_sta = iwl_mvm_sta_from_mac80211(sta); + vif = mvm_sta->vif; + + if (!sta->valid_links) + return; + + for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) { + struct iwl_mvm_link_sta *mvm_link_sta; + + mvm_link_sta = + rcu_dereference_check(mvm_sta->link[link_id], + lockdep_is_held(&mvm->mutex)); + if (mvm_link_sta && !(vif->active_links & BIT(link_id))) { + /* + * We have a link STA but the link is inactive in + * mac80211. This will happen if we failed to + * deactivate the link but mac80211 roll back the + * deactivation of the link. + * Delete the stale data to avoid issues later on. + */ + iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta, + link_id, false); + } + } +} + static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) { iwl_mvm_stop_device(mvm); @@ -1137,6 +1170,10 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) */ ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm); + /* cleanup stations as links may be gone after restart */ + ieee80211_iterate_stations_atomic(mvm->hw, + iwl_mvm_cleanup_sta_iterator, mvm); + mvm->p2p_device_vif = NULL; iwl_mvm_reset_phy_ctxts(mvm); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c index 23e64a757cfe..0fcbc400caef 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c @@ -512,11 +512,11 @@ static int iwl_mvm_mld_cfg_sta(struct iwl_mvm *mvm, struct ieee80211_sta *sta, return iwl_mvm_mld_send_sta_cmd(mvm, &cmd); } -static void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, - struct iwl_mvm_sta *mvm_sta, - struct iwl_mvm_link_sta *mvm_sta_link, - unsigned int link_id, - bool is_in_fw) +void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, + struct iwl_mvm_sta *mvm_sta, + struct iwl_mvm_link_sta *mvm_sta_link, + unsigned int link_id, + bool is_in_fw) { RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta_link->sta_id], is_in_fw ? ERR_PTR(-EINVAL) : NULL); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h index b3450569864e..7dd8f7f4b449 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h @@ -638,6 +638,11 @@ int iwl_mvm_mld_update_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_sta *sta); int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, struct ieee80211_sta *sta); +void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm, + struct iwl_mvm_sta *mvm_sta, + struct iwl_mvm_link_sta *mvm_sta_link, + unsigned int link_id, + bool is_in_fw); int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id); int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif, From patchwork Mon May 13 10:27:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 796741 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 0E82314A0AC for ; Mon, 13 May 2024 10:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596046; cv=none; b=q5nAPgPhUMq7BnA6hLfn7OJ8VUttGLGA74qjkg3hpgJTuuCPFEbuAqKAcvJxKF6SLiYnB505xMR4eHUigXaRQYJU1YUbFw304Qzam3vJi6JMtv3cB5+3C6+JbK670Fid4VROZUtvBqEOqwRNYvmycAt64lH+HV9xerg7elPCWEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596046; c=relaxed/simple; bh=lj1prPsxS5+5Xt0GC2Ocg0w7Ojiyx1sP5S8nBuEXtzc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qRtGcjIYPHM0sv+kO1YF/g6gkl4MNk59ZnEfL7/BWSnO0DDQsKm/bU6E7EQjUM8SKBozYjcNEEVGaKiwMjQtDEuRs8QqF7PsogtTwAkTQNUsZkNqskP+en4VCjnAftVS59RHHJhUM+3tUJVqzKSSnPllf2toRX2xJ7hkRFufTV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ilh7vR+T; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ilh7vR+T" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596044; x=1747132044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lj1prPsxS5+5Xt0GC2Ocg0w7Ojiyx1sP5S8nBuEXtzc=; b=ilh7vR+TYNrZJ8uvzYpotJPinR9X0Xz52PGKlKXuR2DeXOMgo+HbhY5d u7uzcvQcnVyPsS3CMFDcLxeyNR+GnIWnGK6oB18sAB1YGUa3V4bPF2646 8l8d1r5CKuoWq4U0AEyKG3xWiuWyFHvDdky9/9nSNlXekMjdBP4fIB3RH qiMz6LXwARzPJq3rxNsj5u0RXXaTvltVHJUSFnpY9PNC47ykQpKK9lHgW HMYrbL5WKilhVcpm7krccMlVSOgxYFQx7na/liZZS+gzfl0UxuQyqQ6zq 3X+uj8AwbbBWMRPvFXJ9QhCqiRYAlO3M7qeM79khN95zOxjiTYct2or7a g==; X-CSE-ConnectionGUID: 9RiTkLTeSCyUJwW6DglHDQ== X-CSE-MsgGUID: uA5laOuMTlWBwtqKIyoSUw== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928650" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928650" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:24 -0700 X-CSE-ConnectionGUID: ZTaTqHK8QjmUa12HJ/ARag== X-CSE-MsgGUID: KTAUhH7mTLCZqJl7zIb1GA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516403" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:22 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Yedidya Benshimol Subject: [PATCH 2/7] wifi: iwlwifi: mvm: Handle BIGTK cipher in kek_kck cmd Date: Mon, 13 May 2024 13:27:09 +0300 Message-Id: <20240513132416.7fd0b22b7267.Ie9b581652b74bd7806980364d59e1b2e78e682c0@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Yedidya Benshimol The BIGTK cipher field was added to the kek_kck_material_cmd but wasn't assigned. Fix that by differentiating between the IGTK/BIGTK keys and assign the ciphers fields accordingly. Signed-off-by: Yedidya Benshimol Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c index 52518a47554e..30e0afe8914e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c @@ -595,6 +595,12 @@ static void iwl_mvm_wowlan_gtk_type_iter(struct ieee80211_hw *hw, void *_data) { struct wowlan_key_gtk_type_iter *data = _data; + __le32 *cipher = NULL; + + if (key->keyidx == 4 || key->keyidx == 5) + cipher = &data->kek_kck_cmd->igtk_cipher; + if (key->keyidx == 6 || key->keyidx == 7) + cipher = &data->kek_kck_cmd->bigtk_cipher; switch (key->cipher) { default: @@ -606,10 +612,13 @@ static void iwl_mvm_wowlan_gtk_type_iter(struct ieee80211_hw *hw, return; case WLAN_CIPHER_SUITE_BIP_GMAC_256: case WLAN_CIPHER_SUITE_BIP_GMAC_128: - data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_GCMP); + if (cipher) + *cipher = cpu_to_le32(STA_KEY_FLG_GCMP); return; case WLAN_CIPHER_SUITE_AES_CMAC: - data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_CCM); + case WLAN_CIPHER_SUITE_BIP_CMAC_256: + if (cipher) + *cipher = cpu_to_le32(STA_KEY_FLG_CCM); return; case WLAN_CIPHER_SUITE_CCMP: if (!sta) From patchwork Mon May 13 10:27:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 797234 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 55CA714A4E2 for ; Mon, 13 May 2024 10:27:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596046; cv=none; b=SFGJB/0tZeCxcO1lq5Z4w0Js1MVVu+4d6JuD1TVDUMI/JXp2TDFEh15QUYyLCRQHXdCFhf8ZxlfmRmyv8oNCWsVA99Uo1jeuJbYPF3eJhojM05rCxtJRpDbgX9qf1q+N4xhny6yxSXuw1iXeD9JKzJyEJqvnmeezyVMh6az0CkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596046; c=relaxed/simple; bh=vON7C3yzzNYKstMeK9jY6q/ClYPhuR0C9p5D2HAr03I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Sd6DOU03LkcHrsm8HF0vLyz+xmkt6lb43c8zOiAbq2NBjBYW8bHr5YnxnCkA1Da9VMr1odm61nkCU/6xswcPZ+SDxaWOHfR16xZkIxk9GN1pj4HIPd35T+HuNSL+dSNDZYNc5chJaFxyQo5nz4C1RN/MxD3dt6zFO+B6Jq77VXE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hZdnAe89; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hZdnAe89" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596046; x=1747132046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vON7C3yzzNYKstMeK9jY6q/ClYPhuR0C9p5D2HAr03I=; b=hZdnAe892out3sYjWGT+mzwwrLEAQlgnP0vKmEsv0KM+BNXzjq5ZWs2b Vm16MNN9Y3hfUUu7WRc35xXEhdxpXxAetsAMzoIabX5LaHHIgliPeLG6/ COxGt1XwwcIaN5WkbAr8j/gpP1QR0jnv7X1HCDVUWNN/G1nBrj5XigOPa LWCR4nAfgdm2NqonVnNKGm5gN9THaVgjTN6SdoAdx4ruW+2TSh1acbE3D 0ErxHoutUsgLu6QXwdCudGlVO6/1FIqcaD7LEPVSvMzUWH3iCdsKm5+P9 uiA0QCozOP/CfqYqA/oJJ4ckS9qnXYZ2t9xJCXdG+Pud0B8gAVzpi9MwU Q==; X-CSE-ConnectionGUID: /IUuYwinTyS/jqyjp1NGSA== X-CSE-MsgGUID: 7ny05GgnRIOwcgm8wkzsZw== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928653" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928653" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:26 -0700 X-CSE-ConnectionGUID: Vv8AGKtjT8qzzMYZMLeipQ== X-CSE-MsgGUID: 8whYSqsURgacSJKhpyr0MQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516406" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:23 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 3/7] wifi: iwlwifi: mvm: handle BA session teardown in RF-kill Date: Mon, 13 May 2024 13:27:10 +0300 Message-Id: <20240513132416.0762cd80fb3d.I43c5877f3b546159b2db4f36d6d956b333c41cf0@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Johannes Berg When entering RF-kill, mac80211 tears down BA sessions, but due to RF-kill the commands aren't sent to the device. As a result, there can be frames pending on the reorder buffer or perhaps even received while doing so, leading to warnings. Avoid the warnings by doing the BA session teardown normally even in RF-kill, which also requires queue sync. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 12 ++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 290670310ae8..70b769eb5861 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -6129,7 +6129,7 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, .len[0] = sizeof(cmd), .data[1] = data, .len[1] = size, - .flags = sync ? 0 : CMD_ASYNC, + .flags = CMD_SEND_IN_RFKILL | (sync ? 0 : CMD_ASYNC), }; int ret; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c index 0fcbc400caef..b98256edb52e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c @@ -1009,7 +1009,8 @@ static int iwl_mvm_mld_update_sta_baids(struct iwl_mvm *mvm, cmd.modify.tid = cpu_to_le32(data->tid); - ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(cmd), &cmd); + ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_SEND_IN_RFKILL, + sizeof(cmd), &cmd); data->sta_mask = new_sta_mask; if (ret) return ret; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c index 491c449fd431..908d0bc474da 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -2836,7 +2836,12 @@ static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm, .action = start ? cpu_to_le32(IWL_RX_BAID_ACTION_ADD) : cpu_to_le32(IWL_RX_BAID_ACTION_REMOVE), }; - u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD); + struct iwl_host_cmd hcmd = { + .id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD), + .flags = CMD_SEND_IN_RFKILL, + .len[0] = sizeof(cmd), + .data[0] = &cmd, + }; int ret; BUILD_BUG_ON(sizeof(struct iwl_rx_baid_cfg_resp) != sizeof(baid)); @@ -2848,7 +2853,7 @@ static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm, cmd.alloc.ssn = cpu_to_le16(ssn); cmd.alloc.win_size = cpu_to_le16(buf_size); baid = -EIO; - } else if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1) == 1) { + } else if (iwl_fw_lookup_cmd_ver(mvm->fw, hcmd.id, 1) == 1) { cmd.remove_v1.baid = cpu_to_le32(baid); BUILD_BUG_ON(sizeof(cmd.remove_v1) > sizeof(cmd.remove)); } else { @@ -2857,8 +2862,7 @@ static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm, cmd.remove.tid = cpu_to_le32(tid); } - ret = iwl_mvm_send_cmd_pdu_status(mvm, cmd_id, sizeof(cmd), - &cmd, &baid); + ret = iwl_mvm_send_cmd_status(mvm, &hcmd, &baid); if (ret) return ret; From patchwork Mon May 13 10:27:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 796740 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 DF0CB14A61B for ; Mon, 13 May 2024 10:27:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596048; cv=none; b=I8UKr6XcOM0dasQ/9w7w9DCU+ctSTJ+V38I3S0yajsrixkO1XDSoFHk72pDnvQxdZ+ZgPiAmJX9lvjd4u0lb+g7NL99k3B0xXINcFTVMJ6PCt0Yl4icEeuAzGemF41d/Bo69vofNit79M0T8sO6GTg6vl6W7bC8gaqF90T6g5Sw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596048; c=relaxed/simple; bh=dYfuhCe6RwMSb+Vi0N0TYJPlT0h1+m8QLXI1q6AQ1Dw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uynDSTp9a22RqtMZmh91SHlvUoLaiKogQVEl3DEqOQGdPSBHpLZAhlEKaeHwplMp+znYHrAYmNeNs5izMOAv5JXYgUOSfyg5d1aAHn/aefPMABfIhgNgMjsd0jc5Yb8BMjBCAY4PyecKf9qkNgpMzXV9RNBaX8o/xrMBPFvOfXQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dt86Momu; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dt86Momu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596047; x=1747132047; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dYfuhCe6RwMSb+Vi0N0TYJPlT0h1+m8QLXI1q6AQ1Dw=; b=dt86Momu6qr/pcBdfNjJf3KUK2CPTCqFYUFe2sPLDbPNzyeLDSjUjwmT OFV2nxGMo5zqTBzWSrMaVKsR+JsQQkGuwZcAxYD5bUjko6v0yFM4EAU/W 9EbVPcWFlOWJAANCU+aXg7HiWuzzf9wRdo8K3vOfIkL1R8UQfaILl6dii nGzoG7+tmkNCrjeNfTHVOmpATxLhpV9SSv8vVi+CDX8jb28wvvlJPW7BB DX+gt6iu0Ptvd01vIoiYetLHmr8eDq5nsnJFF6EiLBJLlD5PzUp01vbsf NEP6JqPReAEsyugj7eY8opD1fp/SADxIpYDhRPY2US3J6SLQYCvdghZh3 Q==; X-CSE-ConnectionGUID: FefBrzw+Stqbw2ysGnp5ew== X-CSE-MsgGUID: rW9g+euPTBe4yCppfLLfyw== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928659" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928659" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:27 -0700 X-CSE-ConnectionGUID: qYq8CADDTKiWRTSnTj+kmw== X-CSE-MsgGUID: m0xpJ1KaR/i6uHmKF5eqsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516411" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:25 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ayala Beker , Ilan Peer Subject: [PATCH 4/7] wifi: iwlwifi: mvm: properly set 6 GHz channel direct probe option Date: Mon, 13 May 2024 13:27:11 +0300 Message-Id: <20240513132416.91a631a0fe60.I2ea2616af9b8a2eaf959b156c69cf65a2f1204d4@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Ayala Beker Ensure that the 6 GHz channel is configured with a valid direct BSSID, avoiding any invalid or multicast BSSID addresses. Signed-off-by: Ayala Beker Reviewed-by: Ilan Peer Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 11559563ae38..85d8cbe6d248 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1717,7 +1717,10 @@ iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm *mvm, break; } - if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE) { + if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE && + !WARN_ONCE(!is_valid_ether_addr(scan_6ghz_params[j].bssid), + "scan: invalid BSSID at index %u, index_b=%u\n", + j, idex_b)) { memcpy(&pp->bssid_array[idex_b++], scan_6ghz_params[j].bssid, ETH_ALEN); } From patchwork Mon May 13 10:27:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 797233 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3A41614A0A6 for ; Mon, 13 May 2024 10:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596049; cv=none; b=aE16wsQr8PdTeGKDgXrknH1oCNXCAY9ezbCi1djd6mlDbIhREO32NBp90qOza68QF/DIhQk+sTkj77vQD7TD/0MKQY7ZCMH1Eawg9Qu8sUbBcARIdXNspj4qEKA4Ajt4FfbUl9XHQgfe0CHI9bS4fXl2iNANFaOyfAJXSCcwcPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596049; c=relaxed/simple; bh=RKKWcwljq5xkvx8k3QVlHrC1gZJe/YGB0AlWBmV5/Pw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g111XZ8QVaOxE5/5VqIiTBtzd1dfJ8koA1834hkzP3bc43R3ZrnT0CfmzGXQF4/HO4ovqPE924yRFF24G+KyzCkHASPRfTaupG4cknYJoN4r189R8Dlc2TP6a+K/eHBPMLYvFMZNCLrNIYuVqD4v5AaQ7PlwITTG8bJYkgF3udA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cJhhCN8b; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cJhhCN8b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596049; x=1747132049; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RKKWcwljq5xkvx8k3QVlHrC1gZJe/YGB0AlWBmV5/Pw=; b=cJhhCN8br9sRgwT3tbpunNnr7JqU/uUupFMMgCKeit2kTdFsHYJFhj2c tl8eiWzW+oqZuSotm4lZtxPZAv82kNp1CDkF9tuoV2kfbqMz8ToQMglZJ FGLGUFGz05WvL1fBjfbIZ1hXfPfkdLDqHSHttTJdcTW930Fh0lSXtsCt3 oH47WrbCtBtna05mIJ7u+EsRWJnXc+ohFb5c8qeOmFC5JAhvhZeCn+IMt uIBJ66TkiIMHlR2RNH7bKeaM596Zeoc3qrwjvCIP/wzL4XuFzzdeBB+5F q13Ym+KxS/xqPKKJ6QxlPls/2jxePa3ra4bfwZue3ATAORh1fzaSy2ujr w==; X-CSE-ConnectionGUID: dtEqSW34QPmlhwP1v95hQg== X-CSE-MsgGUID: RF/88QhkSniIxzvpONx03A== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928665" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928665" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:28 -0700 X-CSE-ConnectionGUID: XTV8vse9S7evLT3LIFBx0A== X-CSE-MsgGUID: Z5U6lY62TN2LpMQiihkmhg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516416" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:26 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer , Johannes Berg Subject: [PATCH 5/7] wifi: iwlwifi: mvm: check n_ssids before accessing the ssids Date: Mon, 13 May 2024 13:27:12 +0300 Message-Id: <20240513132416.6e4d1762bf0d.I5a0e6cc8f02050a766db704d15594c61fe583d45@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited In some versions of cfg80211, the ssids poinet might be a valid one even though n_ssids is 0. Accessing the pointer in this case will cuase an out-of-bound access. Fix this by checking n_ssids first. Fixes: c1a7515393e4 ("iwlwifi: mvm: add adaptive dwell support") Signed-off-by: Miri Korenblit Reviewed-by: Ilan Peer Reviewed-by: Johannes Berg --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 85d8cbe6d248..bed2cd81f8b5 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1303,7 +1303,7 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm, if (IWL_MVM_ADWELL_MAX_BUDGET) cmd->v7.adwell_max_budget = cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); - else if (params->ssids && params->ssids[0].ssid_len) + else if (params->n_ssids && params->ssids[0].ssid_len) cmd->v7.adwell_max_budget = cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); else @@ -1405,7 +1405,7 @@ iwl_mvm_scan_umac_dwell_v11(struct iwl_mvm *mvm, if (IWL_MVM_ADWELL_MAX_BUDGET) general_params->adwell_max_budget = cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); - else if (params->ssids && params->ssids[0].ssid_len) + else if (params->n_ssids && params->ssids[0].ssid_len) general_params->adwell_max_budget = cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); else From patchwork Mon May 13 10:27:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 796739 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 B59E914A4C1 for ; Mon, 13 May 2024 10:27:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596051; cv=none; b=RdHuLZqu96M3OwItXpngaEE8PLwlzsOpstwPT0Xt7ZvX5CkLtJokfeX1GiRS7K3GNj8bNFkpNZWuAurnbR09KxpvjbH+Q4k3NgNcHoWqDI3wooNSszOTQgonm3zqnWdYrLQah/7Lt/Ub+geXGZhVVdcBoi+GxPHlOndHcM8K2x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596051; c=relaxed/simple; bh=FeymIdh95AzLVdL9RdeqDlwnsvZjtmwH9DYKFA8kNus=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AVtooISzc3u1Os5i8YEI9GTk6wesHs5DBXABgAVq+ab58obIwT8iF25OGe1KDGptnXoHGHWfovyWkwShUT+nmakIh9b/iz3sLXGlVajHNvPb37xv4/YgffZOfqLaYWvEzBASCnKXnZjDRU+yV7VTFwGSNft3eNMArgtNwGRKVqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UZOYI9p+; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UZOYI9p+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596050; x=1747132050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FeymIdh95AzLVdL9RdeqDlwnsvZjtmwH9DYKFA8kNus=; b=UZOYI9p+v92WJ3T1sQmX51oBGn66ir+SpO7uPyNahQasHSnCy/S/IXih bVadRihxnaw3JyM8O3JCjdu5v/e1ciz39VO8B403t6MpU6TB9nuNNToYY SnzgOcD0Rfvojg04e5wVjMEm6MV3wJAnkjJ/bbZWtq8CYb1nhRbBGaG4S DRnbqctsE78Og071YKCJ4HyNptl6JxAy+WHgZZ5Yvd46PQ4Mjos3edg30 1hXMsiLv42uh6uaIG8ffI/jSqSYRxrs2mV9pF5YJG7B+EG9g9khMPS2QF WaP7dkKZPDXZ6rkrmQUqgZ9G0SYOtnyRnpef13FYr8D4Yvp76wCLN5YDS Q==; X-CSE-ConnectionGUID: TJsYucinTaCaBNX5bmI4GA== X-CSE-MsgGUID: 9WRJUTJKSuCohDi8bTeUJw== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928667" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928667" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:30 -0700 X-CSE-ConnectionGUID: ExJ+Ww6wRaeInX5pV9j4xw== X-CSE-MsgGUID: J32SQDG6TQaPA7mtieyvGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516419" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:28 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer Subject: [PATCH 6/7] wifi: iwlwifi: mvm: Fix scan abort handling with HW rfkill Date: Mon, 13 May 2024 13:27:13 +0300 Message-Id: <20240513132416.8cbe2f8c1a97.Iffe235c12a919dafec88eef399eb1f7bae2c5bdb@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Ilan Peer When HW rfkill is toggled to disable the RF, the flow to stop scan is called. When trying to send the command to abort the scan, since HW rfkill is toggled, the command is not sent due to rfkill being asserted, and -ERFKILL is returned from iwl_trans_send_cmd(), but this is silently ignored in iwl_mvm_send_cmd() and thus the scan abort flow continues to wait for scan complete notification and fails. Since it fails, the UID to type mapping is not cleared, and thus a warning is later fired when trying to stop the interface. To fix this, modify the UMAC scan abort flow to force sending the scan abort command even when in rfkill, so stop the FW from accessing the radio etc. Signed-off-by: Ilan Peer Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index bed2cd81f8b5..18134e06b021 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -3249,10 +3249,11 @@ static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type) ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(IWL_ALWAYS_LONG_GROUP, SCAN_ABORT_UMAC), - 0, sizeof(cmd), &cmd); + CMD_SEND_IN_RFKILL, sizeof(cmd), &cmd); if (!ret) mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT; + IWL_DEBUG_SCAN(mvm, "Scan abort: ret=%d\n", ret); return ret; } From patchwork Mon May 13 10:27:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 797232 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3E58B14A0A6 for ; Mon, 13 May 2024 10:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596052; cv=none; b=qRCTB0S9c4CJ4Rpmg9Fyt0irToZM8PSa6EVgwFZjxbXa/1RJKTy6K/xVaSiLRllynVtD12hvY4yKqCsL1kexhI14XkwJKa1GMnoGWVKzeQVI4j9i777LwywlScel2EsV0kCb8riQJYglS4fJ67eZBVxHbA6a0o76pvsdVymnAjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596052; c=relaxed/simple; bh=u6kcOh1bm9cWMobY6O4a/TWDMNd/isGc9OGoEF17NaQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cwScQPZVTYuaGuiAG5z4tJ0NGW69RzUr2Tr6pbV2YUbAzjvpA2/hJZBW1wVvXV8E92NyCTx8qGszY/iRPFL7C6/vM6IMBJzZVE3BeO1QqUPvabl+7dQ3Fks0xtizSaaurqjv2v3dgpNo1ka0pgeXDB01xk7OfjAsBe5y2L5AqEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OdgnKe6T; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OdgnKe6T" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596052; x=1747132052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u6kcOh1bm9cWMobY6O4a/TWDMNd/isGc9OGoEF17NaQ=; b=OdgnKe6TuREFXkLbX2v0zb558CkAIBIQ9iyW3smYTKTnbNAKYtmwN5/Z 4opdk2iOdO+npb3NLwKe1FHwQRfmBoxwzSw5hslCGdBnBHlbq4xVIC5yB i+G76qMMu1fnoHQ9VnVoiF/n35fYHgWjDHWhnr3//itgB9MJZkqORFRam CIoFPNQHtI8hZStP6EBbgyLzbC5b7+dEGZmXaKnejCTGMIMGuwMxddL4x kCfP9vogk2t7CAC1oDoSs1F9rePznojvUtT2rJZVmbhZFD0P3YFwKJqnw +Dwl/BCNGQTT8kr5pkBjkVCOKYTfDqgEzMMJ+rXuAKLV/gdiEEcelZnQq w==; X-CSE-ConnectionGUID: ow6ZFIscSY6GiVPGRRThRQ== X-CSE-MsgGUID: 3BpVt1U5SjC/FEvltg9hug== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928672" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928672" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:31 -0700 X-CSE-ConnectionGUID: I+HkdxuKRbOUKNuP04wGzg== X-CSE-MsgGUID: wzt1AtFJQv6/SCaXL5IKXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516424" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:29 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Johannes Berg Subject: [PATCH 7/7] wifi: iwlwifi: mvm: don't read past the mfuart notifcation Date: Mon, 13 May 2024 13:27:14 +0300 Message-Id: <20240513132416.ba82a01a559e.Ia91dd20f5e1ca1ad380b95e68aebf2794f553d9b@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Emmanuel Grumbach In case the firmware sends a notification that claims it has more data than it has, we will read past that was allocated for the notification. Remove the print of the buffer, we won't see it by default. If needed, we can see the content with tracing. This was reported by KFENCE. Fixes: bdccdb854f2f ("iwlwifi: mvm: support MFUART dump in case of MFUART assert") Signed-off-by: Emmanuel Grumbach Reviewed-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index e1c2b7fc92ab..c56212c2c306 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -94,20 +94,10 @@ void iwl_mvm_mfu_assert_dump_notif(struct iwl_mvm *mvm, { struct iwl_rx_packet *pkt = rxb_addr(rxb); struct iwl_mfu_assert_dump_notif *mfu_dump_notif = (void *)pkt->data; - __le32 *dump_data = mfu_dump_notif->data; - int n_words = le32_to_cpu(mfu_dump_notif->data_size) / sizeof(__le32); - int i; if (mfu_dump_notif->index_num == 0) IWL_INFO(mvm, "MFUART assert id 0x%x occurred\n", le32_to_cpu(mfu_dump_notif->assert_id)); - - for (i = 0; i < n_words; i++) - IWL_DEBUG_INFO(mvm, - "MFUART assert dump, dword %u: 0x%08x\n", - le16_to_cpu(mfu_dump_notif->index_num) * - n_words + i, - le32_to_cpu(dump_data[i])); } static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,