From patchwork Tue Aug 25 08:58:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 259491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, RCVD_ILLEGAL_IP, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5CC2C433E1 for ; Tue, 25 Aug 2020 08:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 916BE2071E for ; Tue, 25 Aug 2020 08:59:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="XhaglZ1b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729057AbgHYI7C (ORCPT ); Tue, 25 Aug 2020 04:59:02 -0400 Received: from mail-bn8nam11on2079.outbound.protection.outlook.com ([40.107.236.79]:20448 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728033AbgHYI7B (ORCPT ); Tue, 25 Aug 2020 04:59:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFSQVmTRjNq9WIa7CbjmsdUXnqVPnI6EPaksGiR/I/jAKOAriAJoTe7MyolFEKOb8dmrbymp/qZiNejCxozrlYgSaNXj3LjKHP7ocs0IzvwYOlMUUzYK+rdRTiVZusCT26kwP3WWo1PdjM3eLJKd7ck5dR0JfhMBhPg4Jzo6z8Bgdj5zyYT+AaJ8D/nwkNVCamZQbgR5Dv4GFfBELTUxxHHAWhS9V1SpAz0DKGP7OqcxyE4gQQwTVogTNPxpWvO5iSHnnPnw6N/+e1sEoZ6C78g8Z11mwQ+3fXvJokzd0ZacFBc4uTRG3axoMrQNhSJo39HFkXIroSkEVSkC5gYtaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HulzlNPJ0vKnS1DE7gqTcXMUbsJBNAI5ANqEA6+6cIk=; b=JydQ2SDLMqTSE0de6Wt2u/ATEuITEIvWYDGec88YgkGj35w1bYssk3fSmEvTZzGiEJ0JmjLjFUOOKfZajWGu1c0iTogB/tChzXhhch6KaS9WXC5dZWqrQHVQCGxptE6wo4Ei3C+Zh4FNFQOGRuiynzRqbwbjR8JVWaSU3RG8zZ0iW04Iyn1epnIl81HwXZA+ekJfI7cpMBvzsdlRBhQLgHlHrpYpGuXsGErzVqORtbFOYLOHrNUKxyHFCW+IY04/P90iBSLAEF1ZiXgbRdbL6Mo/dPnPBrvR85H0gOaeTWUzMOv4UWuDwhqWTKopFLLodVa8/DOHFLeUZkiStBh07w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HulzlNPJ0vKnS1DE7gqTcXMUbsJBNAI5ANqEA6+6cIk=; b=XhaglZ1b1LnajPC67+tFTxcTu00bl0N7NvUJfH1r5IZ8jCBTAQCLu5QI59Nt9yvCDo8x4TAPTzECucCdyb1Zeb8B4Vk21Ag7DrpOWGjXbdfVIk6xHBRcYGlyJiVD5UaAlpMQXo1xr4SiWCF1sv+aEYtgPON2AnYwqUT8K4VqJzI= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SN6PR11MB3501.namprd11.prod.outlook.com (2603:10b6:805:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Tue, 25 Aug 2020 08:58:55 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::85c9:1aa9:aeab:3fa6%4]) with mapi id 15.20.3305.026; Tue, 25 Aug 2020 08:58:55 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 01/12] staging: wfx: fix BA when device is AP and MFP is enabled Date: Tue, 25 Aug 2020 10:58:17 +0200 Message-Id: <20200825085828.399505-1-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 X-ClientProxiedBy: PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from 255.255.255.255 (255.255.255.255) by PR3P192CA0002.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Tue, 25 Aug 2020 08:58:53 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fa8b919-00df-4385-9d65-08d848d51878 X-MS-TrafficTypeDiagnostic: SN6PR11MB3501: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XWFS3VFJRNLi4sYpO2lOw4akxNPDR9r1ovaOWlH1Z+JQt/4HNv5g3i1qy4QEYb4EIbgzgov7Jf4rR2E+zfdWxRsEDGY57JrqaYAvxvUwwVIricTVTpzbDJ9gN5wi1B6xsVoehRsLhhU3E8Yhuhzi3aZmWacbQWbbDHNbX/r3oOhxSCjgC0UM5hCZlKwn1fJbCnlkN7ZCdE397bohtz9IqpzClCTHeniTnUqzWTUF35BFYnpG3OnTBTdQOcTVjfxInSXgLvCjRSIGPHSilaay6lWj7SRhAZsnscEdklhUW8NTyvVlAk/RFoZUt03kZCMqjlK723jAuGzItJNAXP3oCg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2718.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39830400003)(396003)(346002)(376002)(366004)(316002)(5660300002)(478600001)(107886003)(1076003)(8936002)(83380400001)(16576012)(956004)(66556008)(66476007)(26005)(2616005)(186003)(8676002)(86362001)(66946007)(6486002)(54906003)(6666004)(36756003)(4326008)(66574015)(2906002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5Brjpm2Z62h7oN4411l5CZwDuKYWFQPeYTgB0Q0GLH+lVpkhwNyOOfJs6zLtks8FWrPS81tfUr1e9q+uLWD0Pz4r06A1L2EnRkTBfKZD6sh05xtYdegLBkiIIHxFA6fEG04U5c18DGNMxaDzrvXuqIhgS+/y9rvNFdGQdOBasAzDxSfn/WJ4qOMHUjFtdirRiromcJGNKs0kqObLuf+QHvFny1PvWT69JTfru7od5/1PDkWNmGFvAIN0ooRoxiaDcrdHeYYGoPm2tRspii4rAhL5D2WdK4PEaqAZZaVSF5JUAz58FefIdVbquF7XyANAt1yXTh+LkUXnlSxshXnOviMz8flkHuk4SoKcbej5bmJt4S6hx3/BC3N0To3nyCZt1UFRo+Y/Up5zy1mEQW/o9K6okLVfzg0Vt8LKIoHDh7AMqjj4l5B8vm6T3B19YmkGlE/Vjna4zgkf68Pzw7JRmuaVgyeZobKL//p7kcZwQNeUsRQ5MGzcCJRXzb6ZH95bfZr29XmBBqQHoBXeHjKNRi8Wtxu4hmQccxBDVWnFZcWJnvDLVpZRm4VjnG2BeZK1mLHEo6PZEImut69vx8KU+RlHaxDcN0IBnO9TTZxH/O4qQ/PpST+HcyLQqMFfe8PurcrMJTv3Zrcd/1FDwbUuMw== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa8b919-00df-4385-9d65-08d848d51878 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2020 08:58:55.1095 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BhS5+tsNR1gDOZ9E43xmaUrbT4vEWReR9ZAt6pNDVkbO9kvghjBB1JeMujzViIP5AuHYWipy00YpomUyFyK+lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3501 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The protection of the management frames is mainly done by mac80211. However, frames for the management of the BlockAck sessions are directly sent by the device. These frames have to be protected if MFP is in use. So the driver has to pass the MFP configuration to the device. Until now, the BlockAck management frames were completely unprotected whatever the status of the MFP negotiation. So, some devices dropped these frames. The device has two knobs to control the MFP. One global and one per station. Normally, the driver should always enable global MFP. Then it should enable MFP on every station with which MFP was successfully negotiated. Unfortunately, the older firmwares only provide the global control. So, this patch enable global MFP as it is exposed in the beacon. Then it marks every station with which the MFP is effective. Thus, the support for the old firmwares is not so bad. It may only encounter some difficulties to negotiate BA sessions when the local device (the AP) is MFP capable (ieee80211w=1) but the station is not. The only solution for this case is to upgrade the firmware. Signed-off-by: Jérôme Pouiller --- v2: - Check that ptr does not point out of bounds of skb. drivers/staging/wfx/sta.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index ad63332f690c..c31e302d05c9 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -434,7 +434,7 @@ int wfx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, wvif->link_id_map |= BIT(sta_priv->link_id); WARN_ON(!sta_priv->link_id); WARN_ON(sta_priv->link_id >= HIF_LINK_ID_MAX); - hif_map_link(wvif, sta->addr, 0, sta_priv->link_id); + hif_map_link(wvif, sta->addr, sta->mfp ? 2 : 0, sta_priv->link_id); return 0; } @@ -474,6 +474,31 @@ static int wfx_upload_ap_templates(struct wfx_vif *wvif) return 0; } +static void wfx_set_mfp_ap(struct wfx_vif *wvif) +{ + struct sk_buff *skb = ieee80211_beacon_get(wvif->wdev->hw, wvif->vif); + const int ieoffset = offsetof(struct ieee80211_mgmt, u.beacon.variable); + const u16 *ptr = (u16 *)cfg80211_find_ie(WLAN_EID_RSN, + skb->data + ieoffset, + skb->len - ieoffset); + const int pairwise_cipher_suite_count_offset = 8 / sizeof(u16); + const int pairwise_cipher_suite_size = 4 / sizeof(u16); + const int akm_suite_size = 4 / sizeof(u16); + + if (ptr) { + ptr += pairwise_cipher_suite_count_offset; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + pairwise_cipher_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + ptr += 1 + akm_suite_size * *ptr; + if (WARN_ON(ptr > (u16 *)skb_tail_pointer(skb))) + return; + hif_set_mfp(wvif, *ptr & BIT(7), *ptr & BIT(6)); + } +} + int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct wfx_vif *wvif = (struct wfx_vif *)vif->drv_priv; @@ -488,6 +513,7 @@ int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ret = hif_start(wvif, &vif->bss_conf, wvif->channel); if (ret > 0) return -EIO; + wfx_set_mfp_ap(wvif); return ret; }