Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1191137rwi; Wed, 19 Oct 2022 07:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qX1xJx+1/aMJuLYzdc5aBA4zfyh6BQXLqnFiKZCYR3Q1rPQ02YoNS5j4nLHp3LfQvamGu X-Received: by 2002:a05:6402:42d0:b0:457:d16e:283d with SMTP id i16-20020a05640242d000b00457d16e283dmr7815818edc.395.1666190607196; Wed, 19 Oct 2022 07:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666190607; cv=none; d=google.com; s=arc-20160816; b=GWNjgjoiYj5sE42H1JKuMYzFTVRFXCUtnDR9QP8uP/D7hFhoLDKnKGkqPuvKlgiD/7 0tDgGsXeNET6dFU7Tb8hTuKe+pVDKsIZYUau1cs9+3AoVFI+eOiV1h2mBaIshCAThkFJ FX/NDFIf+9/8qM9n8jKyf3l5lDvwSaJhcidNlUoiyS4R7IL5NS3vP7oac6ODGpyEgpWd d77YHv0Wlws5NhnRx/DxtDuRxFlgOIjVZaJOEhK/qTxTTt/wsaYlc21/2DDUdQnwcWDE da97JOC/Uw69HftCMNM7Nppczb931g++MyQX0L4Z5Tk4SGy8lB3QV3NonfPvF9qCHHT1 ceKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wGyU6M+G5l6uYKOeCAkkDjMBiMsUEQOgQuuSJlln4wc=; b=uGNuG2lF7TmqcClPV8+EV4SE/akZmhZskn10gWnij69bYIsHrI6GWo72jHBiRRRip8 hO3Q2oa0tA3/LaIGauGhnCfKwmQlxwjcxndDeO6l3IEXOYkH1p1JKwlBCy2L3TQhjElf h6P/VfJuRJ2noqGb6UByo4nO28NK4SxSt22V7rdjCsEpC8miEA/I1S2i4yPyQ+xAVdnE ygDne0LQLDmNlU44wWD6dJe7s37vbhtY1yCs5Jf8qbCF7MOFrSjKnmG3tpvUIPJwtZks i52n2cyTMUJnEAYPKv4gGkSaMr0+iZ5uDAhxk6rk0N0JWw6TTeyvAKZlnfL16EqfXzA9 hK8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsibVVda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a1709064c9400b00781d82a6fc9si11712402eju.264.2022.10.19.07.43.01; Wed, 19 Oct 2022 07:43:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tsibVVda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233740AbiJSN4u (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbiJSNxc (ORCPT ); Wed, 19 Oct 2022 09:53:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0B31CBAA1; Wed, 19 Oct 2022 06:36:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 594F2B82397; Wed, 19 Oct 2022 08:50:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C949FC4314D; Wed, 19 Oct 2022 08:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169440; bh=2K8Ly1+cLGZDbnIHbo7zA+ju2+Kk+NzBIKrGvopcenM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsibVVdaloTosFNd05+uqZ09lvFMf1NtJ9RYhn0FOd3GCJjUZa7kGeeqXzleZKsgz T3f/zvHuLCJNwrbxDNRFvbhs6Nlf+WJdyiuZKCknIWiuz60F8KSEnCwr6HSHBjWpWl h6pxaBNSiXzh/0iArATo6j6EFp6kPPi5xodBlMlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 278/862] wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work Date: Wed, 19 Oct 2022 10:26:05 +0200 Message-Id: <20221019083302.305602434@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang [ Upstream commit e5d78fd998be94fb459a3d625df7367849b997b8 ] Because wake_work and sdio->stat_work share the same workqueue mt76->wq, if sdio->stat_work cannot acquire the mutex lock such as that was possibly held up by [mt7615, mt7921]_mutex_acquire. Additionally, if [mt7615, mt7921]_mutex_acquire was called by sdio->stat_work self, the wake would be blocked by itself. Thus, we move the stat_work into ieee80211_workqueue instead to break the deadlock. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index aba2a9865821..fb2caeae6dba 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -481,7 +481,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (dev->drv->tx_status_data && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) - queue_work(dev->wq, &dev->sdio.stat_work); + ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); } while (nframes > 0); if (resched) @@ -508,7 +508,7 @@ static void mt76s_tx_status_data(struct work_struct *work) } if (count && test_bit(MT76_STATE_RUNNING, &dev->phy.state)) - queue_work(dev->wq, &sdio->stat_work); + ieee80211_queue_work(dev->hw, &sdio->stat_work); else clear_bit(MT76_READING_STATS, &dev->phy.state); } -- 2.35.1