From patchwork Sat Oct 22 07:22:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092381wrr; Sat, 22 Oct 2022 00:53:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4an4fLZ7tJ8AvOR2xU9Hn0PcEwUJ2mWje4PUiRSnWD0osKhYTzh+WMGeokIOSEeTkyf7zn X-Received: by 2002:a17:90b:70a:b0:211:f163:ddff with SMTP id s10-20020a17090b070a00b00211f163ddffmr14369821pjz.202.1666425238417; Sat, 22 Oct 2022 00:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425238; cv=none; d=google.com; s=arc-20160816; b=VEtgTxZAvYnzCPHrpJE35+cq3GeReW7sQazoqvx+aCm6RDH6cJLNafOKx1C/8UktRY lojqWpjJQjVDScf8JraK4D9HUc157e8SLesGQKkWWdh6UzFMv+ZpBp+XwlVwY6tYO4lh smWEdkA4TNJDhaqYd9MeHBIGYgAcqWwP7mxMp+pXlJCsuvYeXXV9aMMEycoK/sSvhGts RxXyaL2G8yOBu3cvEn0Tu1il0Exfv1I/mHC5os5zZ/fF68wGpzZUM5H2DbJjExCzMa0/ fZB66Rej9Kg9QWtD7oC1iM12UAoTEj1a+H++7i295vwSgqwQAMqnIaWR9VMX80It0h/8 KhaQ== 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=1bOLkdT19YclZnPT6n2fCcYcZatIztYNhWXdqmD579o=; b=hGN2FnSrMinvCHFB4ZTHNtxO9aErnGzus+VLwSn3heiY5QL45jP0DQh/ZV+WwVAH3/ wz5DDz68Rx7cS3cEL0kkiCWtHFFyA/LYy/KtDV+4cdp3/uDSgW4TcXx11SJ5VEHiC3Og dGZQ5Q8K/goY8fgTENBNkGAcNq4GUVw/ppdW0gjTQ5+VMoBlI+IXXXoLNrP9iVT0XGJA Y9ETxRBoGK4VGlOD/U5xeK3CYHu6MULeBB1kB07BESYihMzJfczj+gP1LyOE+Gqqg6Pu Q2WrjmvKkUxaZbpCZ0etNudoCTSDDtxocquaC+m6HIW80JF1qxn7n6bl7u5yKvRY+TO+ AdnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ax7eEDoH; 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 u4-20020a170902e80400b0017a7506e0dcsi30442064plg.231.2022.10.22.00.53.44; Sat, 22 Oct 2022 00:53: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=Ax7eEDoH; 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 S232004AbiJVHx3 (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbiJVHvL (ORCPT ); Sat, 22 Oct 2022 03:51:11 -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 437EA5A3DC; Sat, 22 Oct 2022 00:46:14 -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 4176CB82E21; Sat, 22 Oct 2022 07:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96B74C433D6; Sat, 22 Oct 2022 07:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424711; bh=f8W3x/eNGh6+vFBt2F0UXR8CUiAaNf4piXlXCa3ZCGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ax7eEDoH3RmtZ75ulbYn38dkEYd+Z5wi2kTSMmhKG4BPqySFRLSelm+7u5fl3j0ze tMkMEr94uYasKYdnnfCKrnO8SQFh6q0BbECu1rc+4++ZJWtuw/aYGCVxLODQXU+//0 Gt5XqaCz+0Cy/d/4a3c1ZSoBtL8lCrVv/XOLGmTc= 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 5.19 247/717] wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload Date: Sat, 22 Oct 2022 09:22:06 +0200 Message-Id: <20221022072458.598094096@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?1747373510794161477?= X-GMAIL-MSGID: =?utf-8?q?1747373510794161477?= 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 22c9793e4a40..0316d226e38d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1390,6 +1390,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 @@ -1397,6 +1399,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)