Received: by 10.213.65.68 with SMTP id h4csp2114003imn; Sun, 8 Apr 2018 20:04:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx496Xi3F+LStcF9Nd3xJaxeFpX5j4mH5ruJU4qzkOnNWc4FPeRHDiqu9LTJP2IG2kv3q4wwg X-Received: by 2002:a17:902:69ce:: with SMTP id m14-v6mr37452014pln.358.1523243047238; Sun, 08 Apr 2018 20:04:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243047; cv=none; d=google.com; s=arc-20160816; b=lhtYdO85UgZh2CDAYdDx3gqaWM/UFKDaGbd5RDUfJYdtwrHTdbNAxOA80ZwuQJeyRc rwxcVBF4Jc0fOMHsWOgDL/SsQmDtKCjKhO1iAHT7/u0yRXjKxgBejGmYcZ7VZyBHrdfr 2ds/lOe+Cqb2tC0VntZ8AZsf6bCcOKT2x4UIZN+zfYR5QhcUaxMG6vbKRYmKXMsa2TVb HDnNXj6zx2dswaXsLnFz9Fgft0Y1th8KrEXvHRQnK3Aj4Nd5s+N+cMORCdpoWbx8Ui1f ijeBXe1kYhJ+sHcEpoNl9jmnVoQZPDZP0IU5PVwy5R0OHndBcQgMbZEe80tV6eBxgPpl uDag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=qrZH0SDKBNmtAU7fU11I8LTHao8AvPmDHn56LgmNTKQ=; b=WsQ9tzm8MuCjqGE6iriaFp+iTs5QnPCundRicR/ZBQjuAYjsYPixNofqhxilDUVr+o D2QFXb2wMPWtyk/sK9EPLTYiq5IdXDJpJNc4PqyXw05FiXD25XerFTpaJCbueWfVxet1 +JzfZQYr118rnbviucgx7l4+N678JB/hK1XjnN613AI9rjXjxKdN1gHEeuJ/r4aHXstj KN0tHFPnAbePlJwed8x0E/cM70na0h3mtN8NHJexGuLlt5N3ZdymqAFdFmQgqwl9MyMq 5Taj36T8ns3TM4xWTKOCiG9akvnejySiU2sXT48mDAibdarvSI3mOpks8/Ql1TcK/eV4 7eXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=WOyKkpOO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33-v6si13295201plb.429.2018.04.08.20.03.30; Sun, 08 Apr 2018 20:04:07 -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=@microsoft.com header.s=selector1 header.b=WOyKkpOO; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756340AbeDIAbe (ORCPT + 99 others); Sun, 8 Apr 2018 20:31:34 -0400 Received: from mail-cys01nam02on0107.outbound.protection.outlook.com ([104.47.37.107]:40886 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756294AbeDIAb1 (ORCPT ); Sun, 8 Apr 2018 20:31:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qrZH0SDKBNmtAU7fU11I8LTHao8AvPmDHn56LgmNTKQ=; b=WOyKkpOObBUyxhI40bZxy3D1FHNDqPb5A9U/y/xRfQadCRwiEBCqczkOZ9M8mBE6ZG0cEq9+QFZAaKzfSrTiLmXHPm9nj3y+OYOs037+/grPa/fvgMj6o4LQW1Zbi2X0QzUXioopnlKCEkLz8SWfT1XujgB9Wl0ibIaFWBcqBrc= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1126.namprd21.prod.outlook.com (52.132.132.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:31:22 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:31:22 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 177/293] iwlwifi: mvm: fix deduplication start logic Thread-Topic: [PATCH AUTOSEL for 4.9 177/293] iwlwifi: mvm: fix deduplication start logic Thread-Index: AQHTz5k5N+UyM3ftQUOyDhdpn1FCrA== Date: Mon, 9 Apr 2018 00:25:13 +0000 Message-ID: <20180409002239.163177-177-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1126;7:XTJJkSwL+9JiGHpupkVUM+r1mXEZtV7b9qip1EJ/jtFqGlKSIem3HGYfudvk4F3qJzQGqoRixwpxKiohBR7SI7HuIhSNLemCg0c6fYy+RCCdr6HP1+MjYZHknlhG7S4j6PDnAc0rOMF3vmSIkK1jRnFjyslyst3pM6l8xL7ruaBijSmezd2+LM7GPtPVARliHPoVafeF/RR/awe5pqRYgKOXOyxTY+ch0QBU4/C0mGZD59ZE3svJ9wLuc8JaSAI+;20:y8/m93qW2H+WE4Xgf8Kj6YLcy+Csx6cuziIfPvQdR+79H7t9/Lrh+nWwe2vDngVu0sz7o2Nlx8+AhPADRDbPna7oQFC05LbJBjwVDtb3omQz1LFe9UULLIjwPrXnjbb5+w/llWaTUK+N5OpN91QY6xNfvA5Gz/ae+9yQIfQscDc= X-MS-Office365-Filtering-Correlation-Id: 450a94c4-c100-4c5e-6d67-08d59db1388a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1126; x-ms-traffictypediagnostic: DM5PR2101MB1126: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1126;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1126; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(396003)(39860400002)(346002)(376002)(189003)(199004)(2616005)(476003)(81156014)(8676002)(81166006)(3846002)(486006)(2900100001)(6436002)(186003)(478600001)(72206003)(110136005)(54906003)(2906002)(86612001)(6666003)(2501003)(26005)(10090500001)(102836004)(6512007)(6116002)(14454004)(5250100002)(10290500003)(1076002)(575784001)(446003)(3280700002)(3660700001)(11346002)(8936002)(25786009)(6506007)(106356001)(4326008)(107886003)(36756003)(105586002)(53936002)(86362001)(66066001)(6486002)(99286004)(5660300001)(316002)(22452003)(305945005)(76176011)(97736004)(68736007)(7736002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1126;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Nd+MdnmMA/mAnzsBqiaQgGw0BGUWWcoyyL8EW/2QIsDL7cnC7alIBY75G9aYkUwr3C0lebr7bk8k1NW9Y389Bbn5x2j6FKx6PxCHiCdvrD7ta6VMhh/ELVHKVFRAzxslRlR4XF2iYvbaHDx7AXjWYS45jQWdpXkyMTe1IZKD3peZLNHxoEKIVyCh0sJ56SG/R090kch27VqnC9hfbcZzBOHPnlZCwepHwe5/vmWLc6tUOj/py6WxABpF2u0FS1YgbreSNiCX0OyPL2enlt4LwMzVULk9WC/gjSpQo18DUNJdUZhDbBQKPa6iP1XaCFmmJYlhNnQBT+KYNtyOlD4VQ85Op18rqKo43j/JpsX0vwEX72LEFiYEdbcw/CvU7T9wAlv9EWwBxDl8Uvw2YhaQtrVV/VFCTjtGPmFtXZXjTRw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 450a94c4-c100-4c5e-6d67-08d59db1388a X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:13.3939 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1126 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 92c4dca6f5fd3d29d8c1daf02e210dd48dc756ac ] If the first frame on a given TID is received with seqno 0 and needed to be retransmitted, we erroneously drop it because the deduplication data is initialized to zero, and then comparing if (unlikely(ieee80211_has_retry(hdr->frame_control) && dup_data->last_seq[tid] =3D=3D hdr->seq_ctrl && dup_data->last_sub_frame[tid] >=3D sub_frame_idx)) return true; will return in iwl_mvm_is_dup() since last_sub_frame is also set to zero, and sub_frame_idx is usually zero since this only covers the relatively rare case of A-MSDU. Fix this by initializing the last_seq array to 0xffff, which is an impossible value for hdr->seq_ctrl to have here because the lower four bits are the fragment number, and fragments aren't handled in this code but go to mac80211 instead. Fixes: a571f5f635ef ("iwlwifi: mvm: add duplicate packet detection per rx q= ueue") Signed-off-by: Johannes Berg Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wir= eless/intel/iwlwifi/mvm/sta.c index bdd1deed55a4..8efe965cab0d 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -1259,11 +1259,24 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm, =20 if (iwl_mvm_has_new_rx_api(mvm) && !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { + int q; + dup_data =3D kcalloc(mvm->trans->num_rx_queues, - sizeof(*dup_data), - GFP_KERNEL); + sizeof(*dup_data), GFP_KERNEL); if (!dup_data) return -ENOMEM; + /* + * Initialize all the last_seq values to 0xffff which can never + * compare equal to the frame's seq_ctrl in the check in + * iwl_mvm_is_dup() since the lower 4 bits are the fragment + * number and fragmented packets don't reach that function. + * + * This thus allows receiving a packet with seqno 0 and the + * retry bit set as the very first packet on a new TID. + */ + for (q =3D 0; q < mvm->trans->num_rx_queues; q++) + memset(dup_data[q].last_seq, 0xff, + sizeof(dup_data[q].last_seq)); mvm_sta->dup_data =3D dup_data; } =20 --=20 2.15.1