Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2612597lqp; Mon, 25 Mar 2024 04:33:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3/bifvkzGj4IC684odvcR6rOeFUeE6N1/lNPHLvMr7TOME/jLUVPucVznaH5UJyaGeoeoFByGHehf+d+w9EiIHk6UQk8JS7e9uqOysw== X-Google-Smtp-Source: AGHT+IFzH6rGGFtmGPD80svFZrLk6/xEpQ707T7r3Hi8KpNMwDv4l53/j9814Ku4Qz/UK1oG4JY4 X-Received: by 2002:ae9:f80d:0:b0:789:db13:61a1 with SMTP id x13-20020ae9f80d000000b00789db1361a1mr7517809qkh.37.1711366384480; Mon, 25 Mar 2024 04:33:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711366384; cv=pass; d=google.com; s=arc-20160816; b=KO42Vld7A1qbXJgBvlznNmdioA2fhYK/fy12twmRZI1Re982kFnSKHuRTP3WxtVWVq P7QVgkdetI4cOP5evkh6jVTcnvwpJa2Zw868OBVtnMJVlVG6lHbZFrynEHZB3zWhC3cT RIVJ9HkYtNN9fa6wc0Nr3MlhjlQuAiVsUjdewGMXW1kZ2HfVTfp/Ry/iGKsaJpgEj+sj SKxN12WfN/fRMUW4AueeUKPhEpRA4AFIn9nXChadInyC8+DQTOdUu5UQZF9A/Q6+qQqu /jQMV5j+rsyzC3BYNthxQsSH6v8abYO0f4RlTmJf6873x5I7BkiQFe0eZtDPnpbfqbyY 3FSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=naXHp1YJvCTIMEARl0jNvLjP7qrJ5L/b0ntcoT8u2Qo=; fh=xsI81Od66GsWG5stXc+hD9XZa00Wm8Rt44GRJ5MLtLI=; b=TLn/7MTEVBvzlD/KTp1rg4N1ryAnIKMAo4qb7vW0z1QEpIuqWjSsCTGEeH709ZfogF 5K4x9HvYZaYwLsNX2VjpUfJOUUBecFZbp9elqP7FSAot6sr1codllO/zkuhi34kvWxGe pr9QiANxkhFJiD7Uhe2AB3ANdNuxfoeddbgX0Ox/imHxO9xElg2ux0OA0XeqtwUGykNu ztI6viz21n3YTnaDDD7ITGI8wIjLLHapvcEj+R8dgTUUVNrzWp6siWg8TbWqlll+PgK4 naoeYOBrZdQkt/sSAXM+/ANGVt32PTDA95LNpyxCBQhgYoqT+M4XH5Ah8K5YKD2HW3JL d1QA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G1fO2aqS; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115634-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115634-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w27-20020a05620a149b00b00788648ab232si4904769qkj.646.2024.03.25.04.33.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115634-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G1fO2aqS; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115634-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115634-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 111C11C3086B for ; Mon, 25 Mar 2024 11:33:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D34434D468; Mon, 25 Mar 2024 02:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G1fO2aqS" 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 9DE49132C37; Sun, 24 Mar 2024 23:04:32 +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=1711321472; cv=none; b=UTVYF3JZcwyT+Gk3fxNW/kglmmM0IBMgqWf/VLKuu7mUAJ2jFuD4o3gKCJcXUwhs1trA0mzTwg+dL0zcsqCZ1WjA1VZsJ6lwtYnTmnT4f3hI3RY2WmfVJ8GE8zKSnJ22Gt1Wjar0EjpESHPMfCFioiLu3QIgb5CRH/wE8v2RUlk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711321472; c=relaxed/simple; bh=qBDDt3UEpEEh1v+s/AaZiH9vTDwgz70LlK5QGjZqtYk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IMOkWZlEd0FKE+tZ93xxBN93OkRv7H1UgnyWiuno1BYKc/EyikvJ92AdmNgCUkgki2mcPazH+aq7xffCE9ugefgwJwOuNV2tU5Dl4FRUeKCgAO401LoMWYCuVudKQppmRIsbbOZhDcE2o3A9H3otkQRfGQWyg5liQR900p1uZJw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G1fO2aqS; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 730FBC433C7; Sun, 24 Mar 2024 23:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711321472; bh=qBDDt3UEpEEh1v+s/AaZiH9vTDwgz70LlK5QGjZqtYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1fO2aqSrjRzqyFIXNa4OzgIUy8jXNGB9tldZEnaz0iquAcBlT6psk4KHLYxTTT0Z p0BYAng+dL56QuQkIeDC5P8lrBUPBiWP5McvVzFgpm2Xy0HxggSgR4SWvdezQ5GWKy 1955xHgraJej3M5oir0U4tiPQoG3T1PhGNCYBkthcG7NmAwcIad2kf+DgSAONQ24dh O7OvaVVPDwNKPlyiwzQ0jU5wjiGJhWJzybozKQif12qENSvQOh79tS8xPSpEdLGqvy keIlvmzx6Kw9mwwLAfAq8pgJ1ucyF9CRYU14lsVSExXenAt8344eSqxxl0oIC/kJQS pGBQZf8opffGg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Emmanuel Grumbach , Miri Korenblit , Johannes Berg , Sasha Levin Subject: [PATCH 6.6 197/638] wifi: iwlwifi: mvm: don't set the MFP flag for the GTK Date: Sun, 24 Mar 2024 18:53:54 -0400 Message-ID: <20240324230116.1348576-198-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324230116.1348576-1-sashal@kernel.org> References: <20240324230116.1348576-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Emmanuel Grumbach [ Upstream commit e35f316bce9e5733c9826120c1838f4c447b2c4c ] The firmware doesn't need the MFP flag for the GTK, it can even make the firmware crash. in case the AP is configured with: group cipher TKIP and MFPC. We would send the GTK with cipher = TKIP and MFP which is of course not possible. Fixes: 5c75a208c244 ("wifi: iwlwifi: mvm: support new key API") Signed-off-by: Emmanuel Grumbach Signed-off-by: Miri Korenblit Link: https://msgid.link/20240206175739.2f2c602ab3c6.If13b2e2fa532381d985c07df130bee1478046c89@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c index ea3e9e9c6e26c..fe4b39b19a612 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2022 - 2023 Intel Corporation + * Copyright (C) 2022 - 2024 Intel Corporation */ #include #include @@ -62,11 +62,13 @@ u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm, struct ieee80211_key_conf *keyconf) { struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); + bool pairwise = keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE; + bool igtk = keyconf->keyidx == 4 || keyconf->keyidx == 5; u32 flags = 0; lockdep_assert_held(&mvm->mutex); - if (!(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) + if (!pairwise) flags |= IWL_SEC_KEY_FLAG_MCAST_KEY; switch (keyconf->cipher) { @@ -96,12 +98,14 @@ u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm, if (!sta && vif->type == NL80211_IFTYPE_STATION) sta = mvmvif->ap_sta; - /* Set the MFP flag also for an AP interface where the key is an IGTK - * key as in such a case the station would always be NULL + /* + * If we are installing an iGTK (in AP or STA mode), we need to tell + * the firmware this key will en/decrypt MGMT frames. + * Same goes if we are installing a pairwise key for an MFP station. + * In case we're installing a groupwise key (which is not an iGTK), + * then, we will not use this key for MGMT frames. */ - if ((!IS_ERR_OR_NULL(sta) && sta->mfp) || - (vif->type == NL80211_IFTYPE_AP && - (keyconf->keyidx == 4 || keyconf->keyidx == 5))) + if ((!IS_ERR_OR_NULL(sta) && sta->mfp && pairwise) || igtk) flags |= IWL_SEC_KEY_FLAG_MFP; return flags; -- 2.43.0