Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2370243lqp; Sun, 24 Mar 2024 16:13:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXeVYQQ96K9HyEh8dqah3Bc00oroibNNOXtaAwP/ocAgxdlsQ92v39YqbO1U29eYKgRKahTHRScKTUVaigQsnMktaHMZFWI0wFdMDmjDw== X-Google-Smtp-Source: AGHT+IEgtdtxjDWHbkKrvoATcL22/Z/JZJTA7vtBJiCqOAEq9UIAGrChmMj4YSLD2Lk3gpHG6cpD X-Received: by 2002:a25:8e09:0:b0:dcc:9e88:b15 with SMTP id p9-20020a258e09000000b00dcc9e880b15mr3533180ybl.41.1711322037755; Sun, 24 Mar 2024 16:13:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711322037; cv=pass; d=google.com; s=arc-20160816; b=nH//uStFvk5JM7ne1p+TonHcpN40XEoCFD5qJVK3aUuo8gEd2w4EG0NFth+wqJgwVN dLDXJqDJ6zTDOiN02gCtDkYO14Zq1unaNoE2xK6OP/BWI5GjymUNNi1jkv8mlBKmhmQr F8zNN+ejyPhv5u2v3JbP9dZA3u+liZ2ANUj4O9gCUWgISED1g7nqBvcGEUXvW53zeQKF THHokhNGd6IgEUjasLbe6W1DZg3fTOLQPsqCEvAeXuqHdqZksPmgoTAnwSeObTYUuakQ OBGvUZ3GdPIWb9G9Rv/avyfrg6YphPi36PERpbwaiIfLHiRIhtTVD4Zb5qQ3hPtfLe5i 0LSA== 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=fuJYkeNvahEKjRj/mzugvxX8HsNv/N9XaA26z/XUR3SQ4R2dUZcR2FuHIEFFPYm68T DQLZwQEPS5fVxPd/ZFySn8R7kBD49H5jGZJiCaBqvyKablCKcfSeO6Ps3pTV57IJ1WaE bcjd0Lnasywns13wIS5mEQRM5f4yAIgfOlp7CmrpNmxcizM8Bko3O/0FmCr9l6I6j7TY XqLvhlQx2R1u/tvGJO190e0UFIhEvWItvdo2lWowvCPbYrb5HrQlycjVCglR6rTt0bTy t1Hel8KR7X1oHw1Pamo3luT0NYR5APkKuDR2ZOUS1N3hFO8hdhEH8vVH/MkuUpb1vFo4 aiNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OBKO+7sl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113059-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id og6-20020a056214428600b0068fda00db1asi617682qvb.173.2024.03.24.16.13.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:13:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OBKO+7sl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113059-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 75B741C214F6 for ; Sun, 24 Mar 2024 23:13:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED09D1474A6; Sun, 24 Mar 2024 22:37:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OBKO+7sl" 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 F33FB146003; Sun, 24 Mar 2024 22:37:47 +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=1711319868; cv=none; b=itb1twZ4+Q8LzaHorA7Z1awJSq3978NIr9OrR9axgQLYHqQSlkpigjWf2mu+Qq30Lk0p/3vC/+uFMHQTErLWUs719S6Jo24LGXKH8t2YV3R42dz3diVetx/T0jp56W3qlKZYDh0Q0po4pTKNW7wNXYZmknRg809keXkrdrEvNDE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319868; c=relaxed/simple; bh=qBDDt3UEpEEh1v+s/AaZiH9vTDwgz70LlK5QGjZqtYk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o5xxcvEev1YFNY6B0zlZfJqNmbryQkRGtXvjbEvMetrtojd5yx6DAUaTKbrYBdz+ouxYF2WDYKHYfdDjkABCxQTTEBDsvdOkNAYXhvQudPpNQmmhl1v3ekgGj0Af1T38bECf4ktvB//h2HoJ3EcXZ7GXA7PKoRCFAy90wqdR/gk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OBKO+7sl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA12CC433F1; Sun, 24 Mar 2024 22:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319867; bh=qBDDt3UEpEEh1v+s/AaZiH9vTDwgz70LlK5QGjZqtYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OBKO+7slTxKBCgh9Vz7djSdm2L9URXoOneQvozyb1s5rJ6zMn4g7deAAsCZdMdr+/ l3x9jXT3IJ4k99hnzlkBFDyBqWCqFtwN1LgION4Aj30HLXYbUro+rnuwBr+fGebvg5 D3VEWxinlTaBfAVWL2ifUO2IhJbw4xtElreJ9SUlIHswYpHglvJlMor/rwN6Mw9iED YkTimyA8pQaButRKuT6A13sg6XZnCanh64ENkB+IdxnRUywt6yLB5RY0nXf08oqMyY DGZtI8JxWXv6yV3hQY7zS/0/qf2LVCIq7XtoOr/s8umsGPmCcdvr6mLSzuAe7dXx3+ brPFbRaRi4HLg== 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.8 172/715] wifi: iwlwifi: mvm: don't set the MFP flag for the GTK Date: Sun, 24 Mar 2024 18:25:51 -0400 Message-ID: <20240324223455.1342824-173-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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