Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1023612ybe; Wed, 4 Sep 2019 11:17:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIMnfET0xBIKxs4biq6bsG8ehamTn5vz9fvmfvGGyqGPap8aPzpoIf2AXaxqOYb+5M0sDG X-Received: by 2002:a17:902:8c88:: with SMTP id t8mr1448334plo.130.1567621079450; Wed, 04 Sep 2019 11:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621079; cv=none; d=google.com; s=arc-20160816; b=bonaMeyzN/cvVyye4QL4DpAX33IPK4BfRzRg3RKF+mwctDvRNx2Ij8HbYWqdXbqLvo t9qigG0/ZdlehJH46SJ0AWspJpbySwJvkl1fEymrpU5iEOg+hhTR+7C3Ne/+1+KcCdrD ToV8hH3CK6RpZVxsCCsbk5v6VeMMXYcL/HN8wOdchmMmk9P614VF3W/PWfmOKL61zyeP O2mFtO90D3vp+XAiAMCwytequ8p7ECnZ0XB3OltHqhXhQ+WtPxM6h981vjaSvX+kDGJX dGA06NhrLGCLOZjggRE4eJeFfQSFnKwZBaFaUojiqgebCui67YeTEwH+/rW/d7OA+U0G dxaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HTT2LULeSozFRb8fL8yBdADi4S6tS3VvP5DseKIcEOw=; b=m91ti2bJpFSmYWqsg+a7y9580gTaYQtoo/qsTNvcJ4QwLZJ6HAmYYZxN2nWss6m3t/ Mw9HPjaQw6N0voA0H883XjqvD39lqMR5Q2ZCajK1jux5WAToH2cotX0U50999aU1t3Z7 veL8kmLumujlKHX2cW/VsFnZBZcGz4/iMaMrS39JhlVDJY0UNFTrOM/lbOTCIT5mm9pe NG+GgFuR7KoHrWMKTmbO1UfrM6SR3aW2CZ6ZNACQVA+BAFW0IfRoedLfxw20NU5corR/ b88OqKC6IwnGQuyzjXN0FBtrg3FpS6HgGiMTqnuCc/8w3miWnCLeVQ4UeVM72+mxmiai yPNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tfd520Jq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n25si14338698pgf.42.2019.09.04.11.17.44; Wed, 04 Sep 2019 11:17:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tfd520Jq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390821AbfIDSOd (ORCPT + 99 others); Wed, 4 Sep 2019 14:14:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:59828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390529AbfIDSOb (ORCPT ); Wed, 4 Sep 2019 14:14:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 581DB22CF7; Wed, 4 Sep 2019 18:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620870; bh=Gv3o9jc/CWvLdaxVZ2vJNVBL76ADaBp67Nglqgg26R8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tfd520Jq6G91u7LACHuJf0GiA1tV5YnkgSSOuNeqdTepCjH7T4aVDMMQ2dNH37X06 3L8gz07to8wwaDS32ShWWhekrbsCygDKgn2TGCn7AzAphea4YwA9VMoNi73ryDQ16Y lpdlgSScP8EGK5UbYkzatxOn4nXAYMZGfe+8a7Hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Wetzel , Johannes Berg Subject: [PATCH 5.2 126/143] cfg80211: Fix Extended Key ID key install checks Date: Wed, 4 Sep 2019 19:54:29 +0200 Message-Id: <20190904175319.336774224@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175314.206239922@linuxfoundation.org> References: <20190904175314.206239922@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Wetzel commit b67fd72e84a88cae64cea8ab47ccdaab3bb3094d upstream. Fix two shortcomings in the Extended Key ID API: 1) Allow the userspace to install pairwise keys using keyid 1 without NL80211_KEY_NO_TX set. This allows the userspace to install and activate pairwise keys with keyid 1 in the same way as for keyid 0, simplifying the API usage for e.g. FILS and FT key installs. 2) IEEE 802.11 - 2016 restricts Extended Key ID usage to CCMP/GCMP ciphers in IEEE 802.11 - 2016 "9.4.2.25.4 RSN capabilities". Enforce that when installing a key. Cc: stable@vger.kernel.org # 5.2 Fixes: 6cdd3979a2bd ("nl80211/cfg80211: Extended Key ID support") Signed-off-by: Alexander Wetzel Link: https://lore.kernel.org/r/20190805123400.51567-1-alexander@wetzel-home.de Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/util.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -233,25 +233,30 @@ int cfg80211_validate_key_settings(struc switch (params->cipher) { case WLAN_CIPHER_SUITE_TKIP: + /* Extended Key ID can only be used with CCMP/GCMP ciphers */ + if ((pairwise && key_idx) || + params->mode != NL80211_KEY_RX_TX) + return -EINVAL; + break; case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_CCMP_256: case WLAN_CIPHER_SUITE_GCMP: case WLAN_CIPHER_SUITE_GCMP_256: - /* IEEE802.11-2016 allows only 0 and - when using Extended Key - * ID - 1 as index for pairwise keys. + /* IEEE802.11-2016 allows only 0 and - when supporting + * Extended Key ID - 1 as index for pairwise keys. * @NL80211_KEY_NO_TX is only allowed for pairwise keys when * the driver supports Extended Key ID. * @NL80211_KEY_SET_TX can't be set when installing and * validating a key. */ - if (params->mode == NL80211_KEY_NO_TX) { - if (!wiphy_ext_feature_isset(&rdev->wiphy, - NL80211_EXT_FEATURE_EXT_KEY_ID)) - return -EINVAL; - else if (!pairwise || key_idx < 0 || key_idx > 1) + if ((params->mode == NL80211_KEY_NO_TX && !pairwise) || + params->mode == NL80211_KEY_SET_TX) + return -EINVAL; + if (wiphy_ext_feature_isset(&rdev->wiphy, + NL80211_EXT_FEATURE_EXT_KEY_ID)) { + if (pairwise && (key_idx < 0 || key_idx > 1)) return -EINVAL; - } else if ((pairwise && key_idx) || - params->mode == NL80211_KEY_SET_TX) { + } else if (pairwise && key_idx) { return -EINVAL; } break;