From patchwork Wed Oct 19 08:26:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247543wrs; Wed, 19 Oct 2022 03:41:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM666V3vi2WAKjw9P+L6eqwIdfClLdwpKIeZLW+PcDSb7bMi/my3f0ujOb6StMIDzV3oGun4 X-Received: by 2002:a17:906:5dae:b0:78e:302f:4218 with SMTP id n14-20020a1709065dae00b0078e302f4218mr6478717ejv.22.1666176065898; Wed, 19 Oct 2022 03:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176065; cv=none; d=google.com; s=arc-20160816; b=po1hDptEZf5kou2IRMPfwFfYIhhHTj6yF74JcP9jlNQxR+Drm1/MACJtUVqYGSS+T9 qxWZS4boede8MtyO8EO1xVII8JetLdvFBJ0tm7fQ/e4puzqIyg9lYYXyct1dgotCkwmI Yh1qoZVthYcQ1mPtcuTaMCJ+ifMa9QlUKl3zklnYNpfX29ZjGHHtO/DPtstzp6qXTTcB GT/IXwbRSAS1uDTe772h8dIuF7dIQ3Bt7km9x3ukwQYCIc/nL29a0dz5paKRE/t8AqEC XZ0Lms8J0nnP423CIze4a1m2OkDKSGZhEk3i8SuEOaGIaiaiLZdZBb7iVNmN+MRIKTzq pCLg== 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=TxSQPc1PiCdqnAqxm87TMyulJScA6bOqZUXMDOhmHeI=; b=TtakjzqL7436Sxfx3nr6KyybztdZZ6N3dNlL66ayD9qNm4F0h709wn1GlI4kNRb1aZ fyk96Egf2dmWKBXSmLSXW/feYF1SuLSZr9bWEnt5kNaQfJ0NXVyNuelk8GFvDepKu9jQ yS1w1zkwzM7I8gVFmCKvgPdcRro8XKWU4wZErua3xgFN3hzx1H8d2u3UidLeS9G9N0O5 7Pc33MDSMAks2tgFjBDzohL2XgvovPsO5Cg73YpsIX96DAoi8Knjt30789IcxJHAUV08 LxC2yHAzelAvEFh/Gp3FZEOCuK0on8fHv6/A01QDle05ZkKYFIDmfJX5JzcneraX8mH4 soqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FwHvII86; 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 xc9-20020a170907074900b00730aa841c5bsi14229414ejb.964.2022.10.19.03.40.38; Wed, 19 Oct 2022 03:41:05 -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=FwHvII86; 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 S232035AbiJSKj7 (ORCPT + 99 others); Wed, 19 Oct 2022 06:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbiJSKjH (ORCPT ); Wed, 19 Oct 2022 06:39:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1ECE15626B; Wed, 19 Oct 2022 03:18:06 -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 4A4DFB822D8; Wed, 19 Oct 2022 08:51:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6E80C433C1; Wed, 19 Oct 2022 08:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169467; bh=mq8aG3PtaIpytEmkRarYYnE2UdSfF3zSy5rZl30dsz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FwHvII86Pg6LdAFn/a6yjs+dgURQ5+7duyhvgHtzqtKxDnhMcTjPYBrPmWpDWsouG hb9sH+sXSKeHwe4G5vX2+a8Ex102p6eR7voyjYi6SPBA0SplU1m6oTa+Cvt3VjvoYA s9jHc0dCGNjf8nW8RJvAD25tDovrhmY7gdU/LmUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Lorenzo Bianconi , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 6.0 287/862] wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload Date: Wed, 19 Oct 2022 10:26:14 +0200 Message-Id: <20221019083302.689314366@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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747112234421835395?= X-GMAIL-MSGID: =?utf-8?q?1747112234421835395?= From: Sean Wang [ Upstream commit 59c20b91786d5f140ee7be2f24c242b5f8986046 ] Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state. Fixes: 24299fc869f7 ("mt76: mt7921: enable rx header traslation offload") Tested-by: AngeloGioacchino Del Regno Acked-by: Lorenzo Bianconi Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 63fd33dcd3af..7214735011d0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1404,6 +1404,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; struct mt7921_dev *dev = mt7921_hw_dev(hw); + mt7921_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else @@ -1411,6 +1413,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, MCU_UNI_CMD(STA_REC_UPDATE)); + + mt7921_mutex_release(dev); } #if IS_ENABLED(CONFIG_IPV6)