Received: by 10.213.65.68 with SMTP id h4csp37660imn; Mon, 19 Mar 2018 18:46:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELvvieAYA5P3XioLZ0XiUpezPzMnZ1uLkIjcd1SF8GtIpQE0MRw80Sc5Fa26kXuI32Pq4oim X-Received: by 2002:a17:902:6ec5:: with SMTP id l5-v6mr14517891pln.113.1521510378028; Mon, 19 Mar 2018 18:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510377; cv=none; d=google.com; s=arc-20160816; b=b+IaZ0Erj1DYj/rZ+9DTmlTz3pka6lF4q4vz1Xv0UeQ47ztxlHMkw8UeuzvHLAcase R2GuwT88D4sDmrGCRCtjt+FBUmf7xMpDkBCW6K+7mckq/ycpvngLMqqUZDibtPGoDQLq 96egabMiQhl+7nzPKKt+ZDWtIS5EUorBwYnqjrpRVf04xJzWnb5zHf8gd5TtVw+bRDWd kqUwwYCP0GSBlNvoi/PFYGKvvqYsXMFo0DeO2D1/ZzSUKBMSzKbKunjeFOytC/CN8Ubm R8bXVIiU3pLDhzvephnW7uh5wXW9KOHZ+2GUaK4I4wALklciQZLXr6Nxl/NODlseTU5n /zOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Pu3ODLePSwaIs2rLOgWxPuGgYa6eTEmRZTSqmfNih14=; b=OARX+DgHG+BnsBI+YJe4MXpn6Ze8zhPCXhUlmVEDmgulaO8w3v/ueqa8nB0PPeBiN5 0K8LDBh8MYHTTjLe6xOwaNAHrOROiWMXC3u17BN652xBv5hDKP4PmKBcvTz1hFTk14ta dvx/7BVAfqqUamXyCT6aq1OkP/iPtsyTk7eP/kTwWZAA93qDgfgxhDTUpj8929f5rLuv hESrVJe+T96W8Zjhq+QAkqt02TlEPgwN/6Ik/0/hb+GfjABt8TpyQLJ59VWyNO7LklG+ szSojrFqIfOZ5SGHy2zPvccp1hlSz1sVHNVNcn2t5/9ZmnLen087031TNcjBuz2JA94l GPfA== ARC-Authentication-Results: i=1; mx.google.com; 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 14si426124pfk.412.2018.03.19.18.46.04; Mon, 19 Mar 2018 18:46:17 -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; 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 S935711AbeCSTVQ (ORCPT + 99 others); Mon, 19 Mar 2018 15:21:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50372 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969716AbeCSSZZ (ORCPT ); Mon, 19 Mar 2018 14:25:25 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B6FE2FD2; Mon, 19 Mar 2018 18:25:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emmanuel Grumbach , Luca Coelho , Sasha Levin Subject: [PATCH 4.9 167/241] iwlwifi: mvm: rs: dont override the rate history in the search cycle Date: Mon, 19 Mar 2018 19:07:12 +0100 Message-Id: <20180319180758.076792547@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emmanuel Grumbach [ Upstream commit 992172e3aec19e5b0ea5b757ba40a146b9282d1e ] When we are in a search cycle, we try different combinations of parameters. Those combinations are called 'columns'. When we switch to a new column, we first need to check if this column has a suitable rate, if not, we can't try it. This means we must not erase the statistics we gathered for the previous column until we are sure that we are indeed switching column. The code that tries to switch to a new column first sets a whole bunch of things for the new column, and only then checks that we can find suitable rates in that column. While doing that, the code mistakenly erased the rate statistics. This code was right until struct iwl_scale_tbl_info grew up for TPC. Fix this to make sure we don't erase the rate statistics until we are sure that we can indeed switch to the new column. Note that this bug is really harmless since it causes a change in the behavior only when we can't find any rate in the new column which should really not happen. In the case we do find a suitable we reset the rate statistics a few lines later anyway. Signed-off-by: Emmanuel Grumbach Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c @@ -1867,12 +1867,10 @@ static int rs_switch_to_column(struct iw struct rs_rate *rate = &search_tbl->rate; const struct rs_tx_column *column = &rs_tx_columns[col_id]; const struct rs_tx_column *curr_column = &rs_tx_columns[tbl->column]; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); unsigned long rate_mask = 0; u32 rate_idx = 0; - memcpy(search_tbl, tbl, sz); + memcpy(search_tbl, tbl, offsetof(struct iwl_scale_tbl_info, win)); rate->sgi = column->sgi; rate->ant = column->ant;