From patchwork Sat Oct 22 07:21:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7265 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091826wrr; Sat, 22 Oct 2022 00:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HP+RmD2q7UB/vAwoi6/DNYSmUIPSt0rUn2/9IB0Q40qKpEzXRfK9zHeCSvrpqfmtpPU2v X-Received: by 2002:a17:90b:1c8b:b0:203:dcf1:128a with SMTP id oo11-20020a17090b1c8b00b00203dcf1128amr60278101pjb.182.1666425118950; Sat, 22 Oct 2022 00:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425118; cv=none; d=google.com; s=arc-20160816; b=gY5AwexQ9W+Kl9P5x+A2Apgyu60+srh7AuvSd/QBAxl9UXeAoJV9TtmFAR+6s1aqOu gxoHVsTCen2shWVdTFhhMp88rmRJKbFgPeOfGB8sGN9MlFjLY8J2I1fAV5AFj4Fw/HCd aeHnva+4Xu+3aCr7pVgzDRPBd9Tiu55fHSqL0MHWeyaWSzF7IEuZY9jtE3LPFRhcxJgM moi9ti66ICXtCeQ8ZRP1rQlqx3zXBa7BwKtMRzcpvjuttSZrVYPEg3kRacEYc31sljqp AqYXN3QCytOCi4pvktVORSH9KwPm8exJtEZD6A4V/UNQC6KpxoDUVg+8XsoPQFvhKFGr WaAQ== 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=79qzC5ys4s8RdYle92aTycV7NqPJ9PsUiQ2nDpzcTlo=; b=wdmdwCXgwPlvy80Lhgt9keZatUggAQpsBdB5IfpPWjHNXC/iddHPn4z9YLyznJmHs2 goRDJ0gxfGI9yT1yIrkupBLrzvAlrV3VGMUSj9eSFZSRxKLzBfeZCB3NEVEffSxmqW+J B4AggtV3SkiO8SBBWz18yNzRJn/6DYa7V0vVLtxerZj5wPgx7CFBhWPSVamAXo2HBNO+ 6ImSIvo8St86MsQOqZzTeyqidJyUNv+4ibds2p4Vq/Ed0RlolDBRRWcyBR9lUdvlB9Bn KHO7cPCy+552rWPS8aqNC4VpVJ5FFDwB3T3xpK9kgRHeEizZhLmRx0tEbOEYReoEm2uT gk2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMvlb3I6; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902ced200b001865dfb6774si11437048plg.458.2022.10.22.00.51.44; Sat, 22 Oct 2022 00:51:58 -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=vMvlb3I6; 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 S231896AbiJVHv3 (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231854AbiJVHt0 (ORCPT ); Sat, 22 Oct 2022 03:49:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B20D7173FD5; Sat, 22 Oct 2022 00:45:56 -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 549EAB82E13; Sat, 22 Oct 2022 07:44:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C07C433C1; Sat, 22 Oct 2022 07:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424690; bh=A50efcMezfHBVBM3mdxcEfLUQK/RuFshzE7sArVfLNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMvlb3I6pdwJSsQUOGxoaMPkI7PShgbivu6h84KGQD4Z3UclDqkWWIAn1wDSOMeoi I6jmCH+zXkywMH7Sl/lYZnv704KNRZa8NHsDBACqo4zsLsogDrHfIH7r1jVbZVCKVm 4OrBVOiyw6KySDrE/qEf0V2jdpXm91Fa3N5tHBG8= 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 5.19 240/717] wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work Date: Sat, 22 Oct 2022 09:21:59 +0200 Message-Id: <20221022072457.410525308@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373385543743840?= X-GMAIL-MSGID: =?utf-8?q?1747373385543743840?= 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 def7f325f5c5..574687ca93a9 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -483,7 +483,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) @@ -510,7 +510,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); }