From patchwork Tue May 29 12:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10435115 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A50B602CC for ; Tue, 29 May 2018 12:01:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BE6328724 for ; Tue, 29 May 2018 12:01:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7090628733; Tue, 29 May 2018 12:01:00 +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 0592528724 for ; Tue, 29 May 2018 12:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933656AbeE2MA6 (ORCPT ); Tue, 29 May 2018 08:00:58 -0400 Received: from mail-by2nam03on0088.outbound.protection.outlook.com ([104.47.42.88]:23410 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933652AbeE2MAs (ORCPT ); Tue, 29 May 2018 08:00:48 -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=XfAB6mU2JefBafwqlDOaUaTl7eSmK4QeEmMGkMhfiMA=; b=Jrv/T8dhSWtAZkMvSFSAXN4rgo6eCEZziMw0z/Td0njOZm2+IS4+fR+TLNnipwKkQZtdc/3kStA5KnahZUtaRs8JLjU4zQIbFjNyr1Jy09tGa+YGysYb6fq+UKQaMAgA9CXjnks5DkwgW8D9S/f7XRsoZUA01H5CTesAnTLJ5yQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BLUPR05MB1923.namprd05.prod.outlook.com (2a01:111:e400:52ad::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.5; Tue, 29 May 2018 12:00:33 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Andrey Shevchenko , Sergei Maksimenko , Dmitry Lebed , Sergey Matyukevich Subject: [PATCH 9/9] qtnfmac: fix invalid STA state on EAPOL failure Date: Tue, 29 May 2018 15:00:05 +0300 Message-Id: <20180529120005.21498-10-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180529120005.21498-1-sergey.matyukevich.os@quantenna.com> References: <20180529120005.21498-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: AM6PR03CA0031.eurprd03.prod.outlook.com (2603:10a6:20b::44) To BLUPR05MB1923.namprd05.prod.outlook.com (2a01:111:e400:52ad::13) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BLUPR05MB1923; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 3:sLF6dhBpGH+m8p3neorvcfcPx7pNgBC/NbzjkyJlzYlFzL1/SWQ9u6o1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++6Karkx8hHDRGzK/6MGUBqS1Ioj0p+oftb8Qk3w4kxAJgpKjOTZdUjkxaEkLPQR+Zgl4mEeWgg3+sKL2uSXsHAKyPKYoC8Ku3QKSo5XOLmxka9xZE3MYrvDM/pDu26cmnPAKLA9qnMtfToPnA5F+72IVH1Y1o54gOS3lQjJkkafMnAuJrZygGA/PimptWDM22Fs+cT5ILvJbxJgqCWpp5zjS4k298pdEa5qFWbypEkBMLBOcVdXsqAoqNbAjpDunVXUsSY5Y06KzsE5/PPd0Mis9aW8q3dnK; 4:6EZE7zjZaCc17Bfvjetx1h58lgLFUuuVbPWvFQfc0RQH9OV9r/I0ZAFcH5o5/JRgrvGxHPWWimHcCHk9uGRFyGADEWkY8t3kXZ3dk0VPEeSncm0o9xXGN/tust7Kcv7F94uWt3oNNp27U/cJVur5psvPYEymbiZI0YoRUTHCMywAemT4YCb10cYOn5P2/1GJOXvQ/J7o7JZrPiLdZrV545i85s3b04KcK9bMs3xaPN6g+FpNOBkkz8fXMiuB+06j4ZHkIwnSQypJ6zePHR7OCSj/BddBzVJlKKVdEu7/R1j0NugfOPSqhlUeSuiJ21t+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(21532816269658); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:BLUPR05MB1923; BCL:0; PCL:0; RULEID:; SRVR:BLUPR05MB1923; X-Forefront-PRVS: 0687389FB0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39840400004)(396003)(366004)(39380400002)(376002)(346002)(199004)(189003)(2361001)(2616005)(11346002)(51416003)(956004)(50466002)(107886003)(50226002)(48376002)(97736004)(446003)(478600001)(2906002)(476003)(86362001)(106356001)(81166006)(76176011)(66066001)(105586002)(3846002)(47776003)(6116002)(7696005)(486006)(81156014)(316002)(186003)(1076002)(53416004)(36756003)(25786009)(26005)(16526019)(103116003)(68736007)(54906003)(52116002)(6916009)(5660300001)(7736002)(69596002)(6666003)(305945005)(8676002)(16586007)(4326008)(386003)(2351001)(53936002)(8936002)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB1923; H:bars.quantenna.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB1923; 23:P7ocG/pw5aFMJ399M6AzZcrzX+qT7n6xnsNtK2515?= =?us-ascii?Q?Rb/SuPnpaxNT3ZUU2kh0KDwX0WQvXpemdbVbA25etnEF/9gCGxUQ3g0RBqQ8?= =?us-ascii?Q?4rP7TNfI8f2tkAGitABJV2/i972YH8PsR5SqlI9F8opH4miiy1YdmA+f8ujK?= =?us-ascii?Q?w1KokEVQqGamdyql1yODOYf+cnp290rcI9XpTr4dZ9+UK2X8mUK+4HbilfLf?= =?us-ascii?Q?xlYeokIBPGWY5sbnd+0y8dkGQ1PGXOVLjVxYWHj9K9YRBA6gZHliu2gJYGLv?= =?us-ascii?Q?jPhx1ns3uBOqc/L2x5sL/gtTiNeLJfIxj+MFQGjjoyMnICrptlgtmDpofUto?= =?us-ascii?Q?vPokLl2jMqHxHCwPwvMC9ANf92+fw1ScT6vQ+u+ggM5Mc/02ohHsohLS1O3C?= =?us-ascii?Q?SFg3/c6RCGGrFQh8my808FtMYTYKTLwxzIdRyaEnHaHnChfADt3Pa0BilbQa?= =?us-ascii?Q?LjDhkaBQtZnHhFfpKIfHocHCSKrbXL0n8mOrm1mP6b0No+RV6LAPA5yS/T/Y?= =?us-ascii?Q?yF/VylIPsVfAZz+5llCgwyPc0UxFtIhyG72q6CeE6KU7LOJ78w+Qb8XTB4MS?= =?us-ascii?Q?OTJskq+eaB3noz79DtZsJ0kcuBs5SpPjF9OOiCRIQ/648rduAzwK1xezjaOA?= =?us-ascii?Q?T2EL+57d1vsR4jxaUWHpLVC43CY0mPf5uBS69yHkCi8Om+qkgwJH5ttQfhBt?= =?us-ascii?Q?+JODAfnttkpFuLKDGpwLUYcJzYW9CDoitLv40AoSufyj/N+M7Kx/RhtTxsT1?= =?us-ascii?Q?PN2t8dGhXbM2Hop8Icwyvp500jeqqBrYKaRa8JCukEDMTnkGKLHUdmjbfaY7?= =?us-ascii?Q?P3AdxEosdoruLuOB3WFEJyUfqk8xjnvMILB8fbvDQ8lpYfosZ2VXfxlZwOfS?= =?us-ascii?Q?vTbFObIzG8/KuiQylRoFKrmintwSn9mDAd9Pw7Hz1v8XegGChIHvHHibRwCB?= =?us-ascii?Q?MvWR5TkKHET5lvGL3mAhPnoMWJm7JgY0dg3AjmrYA2J0ftxEDCJFqqqog0nR?= =?us-ascii?Q?LibQazAPdt41MbySPjtU+iMJEOV2fLxa4eoJ/nqIL7BlErF80hJhmvU6bMDO?= =?us-ascii?Q?OrOhtu1oIUAraDU5t95F9CtvIc+I5eWGGtHOyccYmCOV2pn/B429QlMsDFuC?= =?us-ascii?Q?oTO85KXg1295e3iyQvKuQH9Mmz9Q8iv77AJJyasvTwc73xfuBnYCQ9ujQEQ2?= =?us-ascii?Q?5AlS0XFdzf7kyGRgsNlZO1p2y/XFHrkzLd0TgfkLGo8959LzSbb1tSDgfzM5?= =?us-ascii?Q?slfFFpCqSdQfzEaRFNaiw9LTxWbRfqXu4Xw4na7Q/2F54C45/L7yvVotDZ2K?= =?us-ascii?Q?wp96qKgTEQGs2+lkKCkx90=3D?= X-Microsoft-Antispam-Message-Info: q80ln/qp5u4oru5V3v+WQR2T26jNMyC/22kF6kmI4A3xn+jM2StQ7nXDrR2wYbw6wk7jqF3e+4uN0Aq4AdNz1ueAr8WAmrRtjvHL6ModZprfgA36b4IzUcpkAw9UaG7sarSoxNmQY9kB/gZ9ofzy28UwqnZaqxfnCamMIElccB8dYj3i7DdMx/twnWTFFVad X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 6:ksWT4bQw95QNrZQaxVzM04E1aqICzBmzznZd68sZz4CUJaMDgVpNH+X2YRWj/+bjecVusa0H0NOOI04uy7hnuiJPM4RzkRkyKl32hwiJN46c0cwRKEhADgwdFTt/yNYq6GQLOA0UsBxcOhrmribnKLA4fA/lDadC4vzeOlmgDjBTlc3Vp+WzwUcEcY3cCQC6KSdbnLGzRvyrewe2gb9ehnYgdckPl/ZB78InBljSq0f8E2GhdU/UM8U94i/4z4dQ8ARVmFSt7NENSE6qBXx1Ho3oRPgXrwR3nQMeyVUM+oNpRvvi2hP7TJroCp7xnwVw1LLGqGd7iTpST0t1sd+cE8khMNQkDk9k18/XrFvLKXwkDb00Q4SZFJFbzDEwA5n+8Cxbe0aJVvjZO5JFgyRonIwRngOaEJC7WdF94CnzNYOD6T5f9J/zIiA79wpMY355F5x9HY8B9lvmB+HwoYM0aw==; 5:O5SHx64CBv+1pbVBQS9Z2D5y/itAZ6jOnlgbsDQemxecHjoqNYurrIulWxPRXezZ4AP+pWFYUF0MtviI0GIoYiUCKXaGznwXeb5gqeRXhrs8qgDR1QmE4SY20xiyO0opB+aoAiKFNa/b7dXA7SvJ3SumDVq0TuADuINQqv7sAqE=; 24:bG08LbcE+8F2hdUba9pOBaopDe1F5nc4Yqh0V9FHFtyIz8auTtf8FOznXzXJI/yyVY1yfhHdBa2MBV3REom8nfh5DZpw6YACBQ8LC1lN/ws= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB1923; 7:rrfSRVUPBjSZBGiUGi9Cd8m14ivjxge8LXrFsreWAoi/k8xKdi8NfovzPyZX/jOm3kunc6briG0SO/XEc++hpaSCdP7yHPPx+G55k78y1Amm7wxMwZEQkaAMfw5D7JdU7H1QWe7cHmMD7ywaiy0z3W5nWTD5TJECw6aL7g80g07W7fqHtwmcYO8Ke3K/39tS1q435hzaRw3bWe1iLDkB7QVf0Xp9JtP6bc4k+2ECn8sZPQkl2UaKfNalM6v8UHJ3 X-MS-Office365-Filtering-Correlation-Id: 1b2b6668-d193-405a-2e14-08d5c55bc8b9 X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2018 12:00:33.2018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b2b6668-d193-405a-2e14-08d5c55bc8b9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB1923 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 Driver switches vif sta_state into QTNF_STA_CONNECTING when cfg80211 core initiates connect procedure. Further this state is changed either to QTNF_STA_CONNECTED or to QTNF_STA_DISCONNECTED by BSS_JOIN and BSS_LEAVE events from firmware. However it is possible that no such events will be sent by firmware, e.g. if EAPOL timed out. In this case vif sta_mode will remain in QTNF_STA_CONNECTING state and all subsequent connection attempts will fail with -EBUSY error code. Fix this by perfroming STA state transition from QTNF_STA_CONNECTING to QTNF_STA_DISCONNECTED in cfg80211 disconnect callback. No need to rely upon firmware events in this case. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 21 ++++++++++++++------- drivers/net/wireless/quantenna/qtnfmac/event.c | 8 +++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 1fcd94bf7c59..220e2b710208 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -649,30 +649,37 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, { struct qtnf_wmac *mac = wiphy_priv(wiphy); struct qtnf_vif *vif; - int ret; + int ret = 0; vif = qtnf_mac_get_base_vif(mac); if (!vif) { pr_err("MAC%u: primary VIF is not configured\n", mac->macid); - return -EFAULT; + ret = -EFAULT; + goto out; } - if (vif->wdev.iftype != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; + if (vif->wdev.iftype != NL80211_IFTYPE_STATION) { + ret = -EOPNOTSUPP; + goto out; + } qtnf_scan_done(mac, true); if (vif->sta_state == QTNF_STA_DISCONNECTED) - return 0; + goto out; ret = qtnf_cmd_send_disconnect(vif, reason_code); if (ret) { pr_err("VIF%u.%u: failed to disconnect\n", mac->macid, vif->vifid); - return ret; + goto out; } - return 0; +out: + if (vif->sta_state == QTNF_STA_CONNECTING) + vif->sta_state = QTNF_STA_DISCONNECTED; + + return ret; } static int diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c index 16617c44f81b..68da81bec4e9 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/event.c +++ b/drivers/net/wireless/quantenna/qtnfmac/event.c @@ -211,11 +211,9 @@ qtnf_event_handle_bss_leave(struct qtnf_vif *vif, return -EPROTO; } - if (vif->sta_state != QTNF_STA_CONNECTED) { - pr_err("VIF%u.%u: BSS_LEAVE event when STA is not connected\n", - vif->mac->macid, vif->vifid); - return -EPROTO; - } + if (vif->sta_state != QTNF_STA_CONNECTED) + pr_warn("VIF%u.%u: BSS_LEAVE event when STA is not connected\n", + vif->mac->macid, vif->vifid); pr_debug("VIF%u.%u: disconnected\n", vif->mac->macid, vif->vifid);