Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2563918imu; Thu, 29 Nov 2018 06:59:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/V6+Z7hMnsPfC8t2nVB6FjH05TzD7Cog5zT26Q/6lay+KqTeBQ7ZhVCkwdMT1hfHxyVRs2r X-Received: by 2002:a63:4d:: with SMTP id 74mr1558516pga.248.1543503546126; Thu, 29 Nov 2018 06:59:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543503546; cv=none; d=google.com; s=arc-20160816; b=k5m2keEO/eU1mK5q+RfAPet8MQImW+pU6zuWOQvqnEzmFbs6VQEi6W4CWJuJPnFJd1 +DioWzou7f4xjG5WYXBuV6/0bDkj5vPHrBrvA4NiNyr0AK6Eam801sRh09x3b19OcqBx Qx8LNFeHjUeTLVrQjFBkHMnOnD8I+v8C5CCVU2OhYujPAEznkqgaP07cL3E0s5DZobSW gZzL5fzhVhrwm3P2ftdRqmN8VpFgZpP9Tl4k/ALgSXQrpffCrcKMEZOf+zMBk5qy0wbF resyhL1Nk0rOjCUKVsmbr4kd9YsBu6m+EJeXhd3GHwrDs2Rtgr0be8agCF3zZuYz1O7v wAmA== 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=3eYKIfgdaVDLoA1ikv0BHqDY2HzGTXVU2DZ78Lfec8o=; b=iUNDXmnNbHv+urq8xQwgz/j6ahPcBJWM/yc7SKhFTpGbJvDq63hqqH5flxAVBE0DVO 1J3G/46JlPpZj3sEkpNAJSGXXOTeE9UesB4jer9Hm4dNBnVz6psRVatMiaw3vAwhL2mU UnnKLTO8lm6cvjNyrB3ounNAn2SutD9wE0zSPMyrGNea1r1E+agQx/wmF5AYO0cVnAaM a+K2sfA9uhfeNUf05komSkrquvv8JulpeUNFp7gHeFuqId52OvJ5i9iSH9sbinG6U+HP g2o/JLNzJqw9DqYn6P3fG5BFvBln37N00+W3C/AiwrFCpJ9dAC1DN9RzMTjfFnNs0izs Yc0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NaTVUC6T; 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 cb1si2612462plb.37.2018.11.29.06.58.42; Thu, 29 Nov 2018 06:59:06 -0800 (PST) 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=NaTVUC6T; 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 S1731341AbeK3BZ5 (ORCPT + 99 others); Thu, 29 Nov 2018 20:25:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:49486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728855AbeK3BZ5 (ORCPT ); Thu, 29 Nov 2018 20:25:57 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 416BE205C9; Thu, 29 Nov 2018 14:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501225; bh=sJx1rIn8oSWrfYtdyhj6nQEyWLygOqt+i9f9QKDADWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaTVUC6TdFPIsaKomsXNQ1Fhye9yKsrlOXVukSy3Y/1iSqNKJHYL7YarvuLv0oPpv R2P4+OMFsoUBvLcc8zLkFBPr8TYCsEwdp94EvAQwAiMRKt5Wf5wPFVpBP6BIGyDVz/ tfuMCpA123+E230rZPUhefjyclAukdtt14OzMDh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Grumbach , Luca Coelho Subject: [PATCH 4.4 78/86] iwlwifi: mvm: fix regulatory domain update when the firmware starts Date: Thu, 29 Nov 2018 15:12:43 +0100 Message-Id: <20181129140116.108090887@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140109.832117862@linuxfoundation.org> References: <20181129140109.832117862@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emmanuel Grumbach commit 82715ac71e6b94a2c2136e31f3a8e6748e33aa8c upstream. When the firmware starts, it doesn't have any regulatory information, hence it uses the world wide limitations. The driver can feed the firmware with previous knowledge that was kept in the driver, but the firmware may still not update its internal tables. This happens when we start a BSS interface, and then the firmware can change the regulatory tables based on our location and it'll use more lenient, location specific rules. Then, if the firmware is shut down (when the interface is brought down), and then an AP interface is created, the firmware will forget the country specific rules. The host will think that we are in a certain country that may allow channels and will try to teach the firmware about our location, but the firmware may still not allow to drop the world wide limitations and apply country specific rules because it was just re-started. In this case, the firmware will reply with MCC_RESP_ILLEGAL to the MCC_UPDATE_CMD. In that case, iwlwifi needs to let the upper layers (cfg80211 / hostapd) know that the channel list they know about has been updated. This fixes https://bugzilla.kernel.org/show_bug.cgi?id=201105 Cc: stable@vger.kernel.org Signed-off-by: Emmanuel Grumbach Signed-off-by: Luca Coelho Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 8 ++++++-- drivers/net/wireless/iwlwifi/mvm/nvm.c | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c @@ -322,8 +322,12 @@ struct ieee80211_regdomain *iwl_mvm_get_ goto out; } - if (changed) - *changed = (resp->status == MCC_RESP_NEW_CHAN_PROFILE); + if (changed) { + u32 status = le32_to_cpu(resp->status); + + *changed = (status == MCC_RESP_NEW_CHAN_PROFILE || + status == MCC_RESP_ILLEGAL); + } regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, __le32_to_cpu(resp->n_channels), --- a/drivers/net/wireless/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c @@ -667,9 +667,8 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, n_channels = __le32_to_cpu(mcc_resp->n_channels); IWL_DEBUG_LAR(mvm, - "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') change: %d n_chans: %d\n", - status, mcc, mcc >> 8, mcc & 0xff, - !!(status == MCC_RESP_NEW_CHAN_PROFILE), n_channels); + "MCC response status: 0x%x. new MCC: 0x%x ('%c%c') n_chans: %d\n", + status, mcc, mcc >> 8, mcc & 0xff, n_channels); resp_len = sizeof(*mcc_resp) + n_channels * sizeof(__le32); resp_cp = kmemdup(mcc_resp, resp_len, GFP_KERNEL);