From patchwork Sat Aug 4 20:31:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10555893 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69E5C15A6 for ; Sat, 4 Aug 2018 20:31:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B0B129A8A for ; Sat, 4 Aug 2018 20:31:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F24D29A94; Sat, 4 Aug 2018 20:31:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0201A29A8A for ; Sat, 4 Aug 2018 20:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728883AbeHDWdX (ORCPT ); Sat, 4 Aug 2018 18:33:23 -0400 Received: from mail-eopbgr720047.outbound.protection.outlook.com ([40.107.72.47]:52960 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727127AbeHDWdX (ORCPT ); Sat, 4 Aug 2018 18:33:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/FozBxDsVUqkgJiRynYZA+JoJoFMEBgPcS9FyJiFKPU=; b=x8lxAvQ1DsSLGCakArbprmKVc0grjpjPkozwb9/DHyjGYcZkl2DHgLtaHaeu+Z4JdX9diaL0GPQfrcpdNoBZCjOtyqq+LReuOBJjG4pocaWMfJ0b1bwOVFm1hHTXWbOUC3BXK1+G+azbqtr+wHCSXwAeo9P+yyu+BJm2isMV+Sg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BYAPR05MB4597.namprd05.prod.outlook.com (2603:10b6:a03:4c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.8; Sat, 4 Aug 2018 20:31:26 +0000 From: Sergey Matyukevich To: Johannes Berg , linux-wireless@vger.kernel.org Cc: Sergey Matyukevich Subject: [PATCH] scan: fix crash when driver doesn't report frame type Date: Sat, 4 Aug 2018 23:31:11 +0300 Message-Id: <20180804203111.31768-1-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR0102CA0028.eurprd01.prod.exchangelabs.com (2603:10a6:209:14::41) To BYAPR05MB4597.namprd05.prod.outlook.com (2603:10b6:a03:4c::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f30ba55-734c-41f2-49b3-08d5fa494155 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:BYAPR05MB4597; X-Microsoft-Exchange-Diagnostics: 1;BYAPR05MB4597;3:MoSGD8ZEZ/2RQtDOyifgQeSGGSn0WAkhdfUAYEtktzwRKjVYqyBAi7EkRdr0XjI6qwaDBNOChP4rY/uBB0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1dfbKucBJoXbPqOeR7hHR93+/rWkxc4Z2Gi7VUfQP4hc0zMgt6sSIwZEX1WvhW4an0xeHKUZk9wbeIYANcKjFs0bdjs7oL1rbZG4xgRT4pPRMzZgrkXbFP2EABhzbQYY8mfozE+67ISquhBUBcYZHtsm/kuQom4xmQnox4KDsmuXve6dIwf0Ah33fuZGsO7EeX5OUFy6ROuATrM6b5IcdQ/wLzX0Ft1lK5OJsiqlarj29p7NyDKeq2nJvZXWLzLeigVFp9ZH31Rxy5n/nvHVB4RGW;4:TdhJWAO78QvwA7dk7u+QLc2AAvgtCKArCDmWdNNMytUySM/jUWsNIP7kMKapNGKsoZDoWSRHXKGPsqLt51DukQJh7VlLe87ku0rYUQ/hcorQXajOtogBdxYMMoCex7eDOm079qt6u+JGFLK7sSXD7Xl5wtzA1ts1Jxaz7BZy1pv0WKyaFWZ8S/aEClppuBBeBj7aSKqGOb4Y804E4khRe52gHt0jyLyF4TeIfUrczCi5NxQkumGnxhnupMGdauyYk+wFzQUbZvWEeERKXnl7PjshYcdpIJSUD+vKgLefAeQNjUBxNcSjpMfAPc/7VZJI X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:BYAPR05MB4597;BCL:0;PCL:0;RULEID:;SRVR:BYAPR05MB4597; X-Forefront-PRVS: 0754F7E325 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(39840400004)(366004)(346002)(189003)(199004)(4326008)(81166006)(51416003)(106356001)(1857600001)(103116003)(1076002)(53936002)(48376002)(2906002)(386003)(50466002)(52116002)(105586002)(47776003)(107886003)(81156014)(3846002)(25786009)(8936002)(6666003)(16586007)(316002)(66066001)(7696005)(6116002)(2616005)(69596002)(50226002)(6486002)(7736002)(8676002)(86362001)(305945005)(53416004)(97736004)(476003)(26005)(186003)(36756003)(478600001)(486006)(16526019)(956004)(5660300001)(68736007);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR05MB4597;H:bars.quantenna.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:3;A:1; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;BYAPR05MB4597;23:AUWlpNe5bDcW1wYQ52jYgf183D+4i1cGO2jol13p/VnFxf3I1eq7erytPuhLlZbxr7YCtQl4D+27qbMEovm72VsAtbPDCrV+ZIECjmY4FxTKMKgjDnCTgMrudpcUwx5UhMObEZiqYOo4jDs1D++ODi59tTbDqQS548I1wdtBVhYtPhoEj8yTcRdE2uOoSo+eyl1x2FurLDxVRIutVMz9VKB+bQEDVLtyDJmADMUAkq4xZqH00Olv0DeR9Q3Pdf64LHm3Pc8N6BBB0mXRtF5W7j0tMUSrqmi4+xwrqSJmtfPbpWJ564NR7pP+C+wC83dfjjSrXNwLQP3XkBzLSKBgxfNKw6vVSShPJqHkImzRtB0pwCR9ivo4j1vg51/C4udkZujgi5qMLEBCuBhn/sTjFsrmNJm9ESEf+05Dgs7a2Pt5+lEuhBGiz1DhwDUgLtwXLiQC8aTZiWAhZdMk2bEJKWyIeh3/BHVFM+n3E1cMwEutln+5ft/6i5zPTe18Csq9yHuw3qigvdpiT1OxEhsQWCSwgcf4OsWSP8ClYLS1SmM3I9D/D/wMO5h7/LMo7VgixwvnDWPTgtleIZDGV2TeWRIbj7+pr/FlEI0/45NQqYSCQyHQtjSRn/kYsVHU+TxvcCvhrkBr+bJALWU7bPQFOksLhEwlgsrx2uVeK+8AEux4yDa9dz7aBWC1IbjW29ZQ5/0sDfEMxbvzf/LAGX8FnSA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mq3uRN3XlWKkI4ox0/ACqXvH5HU5T5GLpmhUpfbNvF3AQAEQxgR4gi+gO7cZlUaiJ/YsvDSt1y5oYwddlIuB3XJxAxvHIlu0pqthlCtakXPRUj9Q5wCBSiWumtvvX1RyjpNW8StpvJlVRUPQE4s8tx68On78bNivmvAsjgOwokrNs1S6JflQ9NxlAuaAK1liJDEq6I37hFnFvHttPx4fsVwD6haiCyAZUgqK2aWrsn3za6teHIvtN8IIQokst8dBwEs1Eab/+7JMdF4L2ZOGCwqwHnnbG9iwtZH6d/MFcqkpg==;5:MxUEKBWFN9Snhg5UNF+LdgMvXfoG7226DsAgV9EpoIerySJPcOSSATVXmoo93l3w84xA99jSCNHe9kAoP88tFKVXVii8rUUANT04E7fLdbIiA0ME5bKkZr6/+NiibnpEUfrGLMztQMDXfjnTvv/J5UKQ5CZDm3pnLCGkZjhIzwE=;7:yDwrmFa7Din1LoD4oU3aNx/iKFMU+HWOtZongeoaK7DMXh+aNzvFczUlW/eWmeQo/uAv50aJk3+l5lSen8xmaSG9IjTaxSSMrEiKWqtiYnEZEUXDox99bTCrBPJ1d+yowltohTedknvmlJBdyFwnBEqUugWwtt29loaFQ/JDaBgt2yYXAoFIm4ZQk5PJNgCuKnU90ijTVCWowfR6Ds12eOV/mU4/opUZEJoXZ60prAkF2fmEYG0VtzbqvcaI0vZb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2018 20:31:26.9201 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f30ba55-734c-41f2-49b3-08d5fa494155 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR05MB4597 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If driver does not know what kind of frame has been received from BSS, then it is possible to specify CFG80211_BSS_FTYPE_UNKNOWN in cfg80211_inform_bss[_width]. In this case neither NL80211_BSS_BEACON_IES nor NL80211_BSS_PRESP_DATA will be reported to userspace. Signed-off-by: Sergey Matyukevich --- scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scan.c b/scan.c index 09b04a5..d9681f3 100644 --- a/scan.c +++ b/scan.c @@ -2188,8 +2188,8 @@ static int print_bss_handler(struct nl_msg *msg, void *arg) struct nlattr *bcnies = bss[NL80211_BSS_BEACON_IES]; if (bss[NL80211_BSS_PRESP_DATA] || - nla_len(ies) != nla_len(bcnies) || - memcmp(nla_data(ies), nla_data(bcnies), nla_len(ies))) + (bcnies && (nla_len(ies) != nla_len(bcnies) || + memcmp(nla_data(ies), nla_data(bcnies), nla_len(ies))))) printf("\tInformation elements from Probe Response " "frame:\n"); print_ies(nla_data(ies), nla_len(ies),