Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5224214ybl; Tue, 27 Aug 2019 01:05:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnImRsP4AB9Sz0Wh4p3Nvaq6Gxa6c7eXzyqgPVN99n+k/i6iP1BVrKS/xuwpPOVRbm3m3M X-Received: by 2002:a63:d04e:: with SMTP id s14mr19201060pgi.189.1566893112169; Tue, 27 Aug 2019 01:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893112; cv=none; d=google.com; s=arc-20160816; b=cizYHc8R06fk5lq+KNRG7RJVTFGTirUjdFQNqp7MMmeTOLTjRzk6eYpaN2/feg39Xm ccL9vH4EFcpY7u86DnLJ2mpdI5fWTC0SKdTGQvN7JUNDOnAJpysn8Y9NCvmgaa2cazq7 /aggUBoP2SPGtJdebK+jsAgeU4b7k3RJiTkAiH/lz6cnuPbcxwuSplg9i0dZg/X/eQFc ToL4fHUZQ5Y0e90//AeLdcUfUYDSqgOABUTmfTEN3AAKiXxnr/mY2rQKBzidyjHehJ1l idWZlHpgkBdJc5w9goEOte4WQM46yiavSKuu9bPIcTDKa3rRJpvIDfkyH3c8IwD/7vtt LSAg== 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=MPHCB6mWMUwj5XYgV2gTaUbXJNjmCfmc/0qENUOSmVU=; b=JsWeZUqgfcqVnfVMjeutCGCFm9+QrkkJ96yyCJfyYbTRrr+bfG4VilixB8jpnodHi8 Nx9EpvqdfUdXruWo3l8MORGEfwDOr082owFtxTohBRL1d7QmkOQ/wDrbrA+3uSWDIm5z gTo+gjkXOnoY910lBq7YQsbFhugxMrjBIa9RRVymH5nLA8flPQtpmbxkwfCE7mCstSPE eqSP/G0ZNUUgJXkGMkn0q6cqlkeJ0GsMKcnetIe3KALfHrKsXs8W/Pusgod4uwdAXZVW Czqb3y/HCdT3Kn1hZ70rym9SwfbUHV7LsNOA3i8EJPr5AQQ+RHf8J6l6RVmTWOJyO1Dd wQTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1aUjc5E3; 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 s3si11713437plq.152.2019.08.27.01.04.57; Tue, 27 Aug 2019 01:05:12 -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=1aUjc5E3; 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 S1731553AbfH0ICe (ORCPT + 99 others); Tue, 27 Aug 2019 04:02:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:59196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731908AbfH0ICT (ORCPT ); Tue, 27 Aug 2019 04:02:19 -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 2F08420828; Tue, 27 Aug 2019 08:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892937; bh=sy0/m07PKMTkCdmcinVLBxpf0qhjiUFZE268cm2ABUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1aUjc5E3Nd/U3ph5gRRFIxEUF7I3H8xroHQ1b1q4/dCtMP1fowp8vhHoY5uqBPciL josIXwRXJwCWRdwrgrzUYUQlDqhQ/uJpLhquqEQdjRSKorSrpeQQpdo3xnGQyXT9fe oeoBtayyl0UO2U0mqe/BHzE8mUJ3uUo7dkoS87wU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.2 059/162] iwlwifi: fix locking in delayed GTK setting Date: Tue, 27 Aug 2019 09:49:47 +0200 Message-Id: <20190827072740.233875735@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@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 [ Upstream commit 6569e7d36773956298ec1d5f4e6a2487913d2752 ] This code clearly never could have worked, since it locks while already locked. Add an unlocked __iwl_mvm_mac_set_key() variant that doesn't do locking to fix that. Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 964c7baabede3..edffae3741e00 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -207,11 +207,11 @@ static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = { }, }; -static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, - enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); +static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, + enum set_key_cmd cmd, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct ieee80211_key_conf *key); void iwl_mvm_ref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type) { @@ -2725,7 +2725,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, mvmvif->ap_early_keys[i] = NULL; - ret = iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); + ret = __iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); if (ret) goto out_quota_failed; } @@ -3493,11 +3493,11 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, return ret; } -static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, - enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) +static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, + enum set_key_cmd cmd, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) { struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); @@ -3552,8 +3552,6 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, return -EOPNOTSUPP; } - mutex_lock(&mvm->mutex); - switch (cmd) { case SET_KEY: if ((vif->type == NL80211_IFTYPE_ADHOC || @@ -3699,7 +3697,22 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, ret = -EINVAL; } + return ret; +} + +static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, + enum set_key_cmd cmd, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) +{ + struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); + int ret; + + mutex_lock(&mvm->mutex); + ret = __iwl_mvm_mac_set_key(hw, cmd, vif, sta, key); mutex_unlock(&mvm->mutex); + return ret; } -- 2.20.1