Received: by 10.213.65.68 with SMTP id h4csp1756750imn; Mon, 19 Mar 2018 12:24:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELslwuE4HSEvN0aEqYEYb2F7NBJvvR6hz6fb6L1vRnL7c4epFUQuP1Ytu9Gd7TXffq41X2PN X-Received: by 10.101.85.204 with SMTP id k12mr10242530pgs.40.1521487477704; Mon, 19 Mar 2018 12:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521487477; cv=none; d=google.com; s=arc-20160816; b=sQj4dgZRRFH5asIj5QaB5rY4hwwI+JsMwPbG17TkCjjt/pf7Uz1gcj853pcL3AUZsN VmsRP2nFifo80p4vJFsUcb8a5wUxJEQbbDIjcop6Is2KMEscv0cmYjl8xx1xlmC7MtXV a+JfUxrBGGluDAL6l8I6hEWnugrfAMIGE0D08m4cIOktmrPk63LpcYoP31ZAylO9EmIn 9+4MKRGOSPsRkRrcfEtmuptLMYl/RlIztF98OVc9iZbP2d96kgaNzsu+xPJNhb3TNSSS eFdTIupVS9iw+bxt22XP6ePDVZIbd5WMhrMB4Q6VZrmzwxI/SQvXRrRxmfAUEYSc+wj2 +Dhg== 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=7NDfgmXAJup6Gjs7rGR73YVAswxHltb9BYNGwXlCOjI=; b=fMCFPmS3kDA42P3EArcIzs/oGtQe03XyceYxR277hkHq8wEl5QrVHtcA8mCor4jfOC LxvJR8/KEPQfQ7Bn5mk9XIvAhb1Y5CayD3lQHMUz7RMlspgKFqaOfw/X/RRVul1Uw7lh YiCEd4ROGA96T6YEdKtufGQbeZ949vKllC95II51azosMiL1kmU8T7fcKXOdcS6vALHZ 5csiNo9OpiKHPVkZBjish2SZDKbwj0FV5OhWsZY0NYzRu5nNJiRuFVjemSGr3eDUUjZV tOUgG03fYpcDu/ibON3TL/PqhoOza3PcFztnGBO/+YcrgJj4pektA7NMduE6V7SLp0+a T57Q== 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 q5si393014pff.398.2018.03.19.12.24.23; Mon, 19 Mar 2018 12:24:37 -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 S965728AbeCSTWd (ORCPT + 99 others); Mon, 19 Mar 2018 15:22:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50236 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969709AbeCSSZG (ORCPT ); Mon, 19 Mar 2018 14:25:06 -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 3D1B7FD2; Mon, 19 Mar 2018 18:25:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hamad Kadmany , Maya Erez , Kalle Valo , Sasha Levin Subject: [PATCH 4.9 160/241] wil6210: fix protection against connections during reset Date: Mon, 19 Mar 2018 19:07:05 +0100 Message-Id: <20180319180757.792911861@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: Hamad Kadmany [ Upstream commit b819447dfc4bd120c9d6cd8521252d544fce8fe7 ] Existing code that ignores connection events during reset flow will never take effect since it locks the same mutex taken by the reset flow. In addition, in case of unsolicited disconnect events ignore those as well since device is about to get reset. Signed-off-by: Hamad Kadmany Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/wil6210/wmi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -501,16 +501,16 @@ static void wmi_evt_connect(struct wil62 assoc_resp_ielen = 0; } - mutex_lock(&wil->mutex); if (test_bit(wil_status_resetting, wil->status) || !test_bit(wil_status_fwready, wil->status)) { wil_err(wil, "status_resetting, cancel connect event, CID %d\n", evt->cid); - mutex_unlock(&wil->mutex); /* no need for cleanup, wil_reset will do that */ return; } + mutex_lock(&wil->mutex); + if ((wdev->iftype == NL80211_IFTYPE_STATION) || (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) { if (!test_bit(wil_status_fwconnecting, wil->status)) { @@ -608,6 +608,13 @@ static void wmi_evt_disconnect(struct wi wil->sinfo_gen++; + if (test_bit(wil_status_resetting, wil->status) || + !test_bit(wil_status_fwready, wil->status)) { + wil_err(wil, "status_resetting, cancel disconnect event\n"); + /* no need for cleanup, wil_reset will do that */ + return; + } + mutex_lock(&wil->mutex); wil6210_disconnect(wil, evt->bssid, reason_code, true); mutex_unlock(&wil->mutex);