From patchwork Tue Jul 25 20:07:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108690 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp14392obm; Tue, 25 Jul 2017 13:07:58 -0700 (PDT) X-Received: by 10.99.173.70 with SMTP id y6mr20948114pgo.9.1501013278202; Tue, 25 Jul 2017 13:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501013278; cv=none; d=google.com; s=arc-20160816; b=Ng6XFWJ/BQr1vZOENIVe2kVkhJVZvBBhW1wstIdyC239bn35keyWkL1E3N7OL1HGuq 6FnmG7eojrKCEakepsslX+P0UrGzwgy/dQEFI2jwMnn4TKqV9FH5rV5Y7GLg7Va+pIJn KxK3/1KIFVEuw+ltB7+QAANqUpgbx5WE6FpTKnLl8t0sTqTFUFnaCnu7CD7igyfAq0dq jdT/wE/cmk+mreECyr8GkOGvGyd33Qt3ahYDyP8TBdk1V+GT8T/C7T33sjcAKFEmF7/b P0uWkXnyWraxaNJAAqs/A6ZoMs8ZMhPvw3BupyNDz2gmKQEtdCLUQCHxbC1DZMfgki+X mAwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=QeMz3X7oLXLp5Zl8Lyn/3vdg7q05qn9ew2xCCqocD/Y=; b=Lt7GUNLmYD4QBuzc3q2iOn4uNwhRHIAyBRLlx9LC4IxAfjmLaLEsDb1jn5JaIlK5tP /Z95/NVZKDUPwcjgAPScDwipEadjb7CvoQWUpH7cnEggoYIgDjC898T6CEeXWjJLja0l jzpUr8bYVr0iodGuVtbMHS9pCm2uwQiL1a9Yg8WfaSvO+J64UY2FWqpYFgqFj3iZ/eQQ xJkWAlQMNmCyagnK73y9tpBU0Fr77SiIp+a5EkC86MruO2HKdJgXfLD6yawWqiMU+z/F WplR0xFHXaKpVAyLit2zvW7LiM55CEiX1+HWo/4Tlk5X7JJNUFZw+lzYdgZyQAfzoenA 8xLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=i0sDxl0q; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si8970990plk.237.2017.07.25.13.07.57; Tue, 25 Jul 2017 13:07:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.b=i0sDxl0q; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753256AbdGYUHz (ORCPT + 6 others); Tue, 25 Jul 2017 16:07:55 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33162 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752116AbdGYUHx (ORCPT ); Tue, 25 Jul 2017 16:07:53 -0400 Received: by mail-pf0-f172.google.com with SMTP id s70so62312720pfs.0 for ; Tue, 25 Jul 2017 13:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QeMz3X7oLXLp5Zl8Lyn/3vdg7q05qn9ew2xCCqocD/Y=; b=i0sDxl0qilz7EySskIA2YynhjrvczCKE3eQOnpFd96e2UQWhogLOoRjxCwOLWou7Wf XAWjD/7NTts1qm+jhxUXgNIKvFVtL6bjgLcXR79YVvLcknEdIxQ1T/JdFNbagujtQaoH IJQ3Kztgbcv4CTwLlX1WI7/3PLlLEBk8iAQZg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QeMz3X7oLXLp5Zl8Lyn/3vdg7q05qn9ew2xCCqocD/Y=; b=kxPuaPs0Y9ECae+O+/rHMCuBBafP2AgNOItDBE5JP97ayJ3qCUHl9Iw21SyNkih4+z RPndkBzv1ildvRedMn4FJX8xfo3/YA4Rr4ie40OMsIkKUQ5Rlr54FRFy+QhaaUdJysCc fyzrj8OOMz/5ZCnDkRRfw8BodauxIIlkmuYl7omtzMLFnq4nXyqn/I78tfLBJqgsiU8n 4yBYU3mpzJBAUYiW+itvj/sKRAW5PpDNEOqYsdEJV29zItseFUgNfeq8YBgBCR7fzKNa qR3qqhwxzzj1eYLJtxlgl3UN2kITE66UKN6h3UPbNdFBkS/nGBQJbUx//Oie65tEVnXy PbCA== X-Gm-Message-State: AIVw110IJTMpyC3s6oiTzZXX4XrOzjB39b4FEKWwt5qfrXQ2fskYkFkd JRhW7HumJkvJCG2d X-Received: by 10.99.140.13 with SMTP id m13mr20130787pgd.335.1501013273362; Tue, 25 Jul 2017 13:07:53 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id c76sm27684356pfj.91.2017.07.25.13.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:07:52 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Lior David , Maya Erez , Kalle Valo Subject: [PATCH for-4.4 09/13] wil6210: fix deadlock when using fw_no_recovery option Date: Wed, 26 Jul 2017 01:37:17 +0530 Message-Id: <1501013241-31961-10-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> References: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lior David commit dfb5b098e0f40b68aa07f2ec55f4dd762efefbfa upstream. When FW crashes with no_fw_recovery option, driver waits for manual recovery with wil->mutex held, this can easily create deadlocks. Fix the problem by moving the wait outside the lock. Signed-off-by: Lior David Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Amit Pundir --- drivers/net/wireless/ath/wil6210/main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index bb69a5949aea..85bca557a339 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -330,18 +330,19 @@ static void wil_fw_error_worker(struct work_struct *work) wil->last_fw_recovery = jiffies; + wil_info(wil, "fw error recovery requested (try %d)...\n", + wil->recovery_count); + if (!no_fw_recovery) + wil->recovery_state = fw_recovery_running; + if (wil_wait_for_recovery(wil) != 0) + return; + mutex_lock(&wil->mutex); switch (wdev->iftype) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_MONITOR: - wil_info(wil, "fw error recovery requested (try %d)...\n", - wil->recovery_count); - if (!no_fw_recovery) - wil->recovery_state = fw_recovery_running; - if (0 != wil_wait_for_recovery(wil)) - break; - + /* silent recovery, upper layers will see disconnect */ __wil_down(wil); __wil_up(wil); break;