Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp217373pxv; Wed, 14 Jul 2021 02:19:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFPyJBbrVJwbXelAzQg/+R3bm0NgafBlo/663AXUO3qImcriAKWf2faQWlbrVgTpbVsy68 X-Received: by 2002:a6b:4f08:: with SMTP id d8mr6599103iob.199.1626254373061; Wed, 14 Jul 2021 02:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626254373; cv=none; d=google.com; s=arc-20160816; b=niX/EkUIoOz9IhiPtR2gAMSvhEd+bHpZ5P/rutCnj9Dg8JTzyvEE/tJ6NmgHXH0ukr cJNN6mHaGMAIANSpvvzIYh0RqY4r8KozBrZcUeO+VsU/jJBei94BdzMOV6StD18bBlkF frQdbUbQlSOGL/QH4JnDxt4vtoucuxY7JQKMQYv6UDKWUY5E/xDDXqrCsxFviwnFQFoC 63J8Xj+UiV1CWxGjY06rCFUGzWNVmT4NjHNLEEuMwExVVG58qgAHnrXkiPjy6lJkigdp 1cG2f0Cr6kIxvYn76MfTtDkdYIPOMRIG5iGx13KjblvkuXkZZJ6cK5PfXBjo9pqtjDI7 GVIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=/e02EWErJpgOP42UJVYT9uwvUouXboVU99+/EFgUQOA=; b=sWcUOFuHW9gUlAIsQU3yjdTb7OsepNJqk/R8SEZYiJxlYrcAxKGBEHQCFozahvtPsC oxcbs/u6ULlWsq9Mf2lXBXzWBsbmrOoBnCICmgtW0iKrHQAEqdI8MwmxiaaN7cUlbj4H wvkMyYB0kuLjbBECNe+0p2gScx5ddaQJD1+buSpERXyI8TQbZO05zfBJV8sD/xH7J5Sz uFx+b/8jmzDFO1nrdI7B4WTC6dh/JG0nJB1mnOvYaU9HtDMenVDjjWBYGrEA28Ohkki6 lq+w0eWvAK6VQeQA1lUJ6hTyPSjtJ6fmpoBjwjPVr4fCZaLCh0OIiHEOzcqtxjtTBZ6f qeRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si2092081jat.64.2021.07.14.02.19.17; Wed, 14 Jul 2021 02:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238769AbhGNJVu (ORCPT + 99 others); Wed, 14 Jul 2021 05:21:50 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:40602 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238291AbhGNJVs (ORCPT ); Wed, 14 Jul 2021 05:21:48 -0400 X-UUID: 9dd61a7b90fd4f889a1089211f52885b-20210714 X-UUID: 9dd61a7b90fd4f889a1089211f52885b-20210714 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1640123618; Wed, 14 Jul 2021 17:18:53 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Jul 2021 17:18:52 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 14 Jul 2021 17:18:52 +0800 From: Ryder Lee To: Felix Fietkau CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , , Ryder Lee Subject: [PATCH v2 1/4] mt76 mt7915: take RCU read lock when calling ieee80211_bss_get_elem() Date: Wed, 14 Jul 2021 17:18:48 +0800 Message-ID: <50730853fe09fb75418484770a0c95c23b44deb5.1626253920.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As ieee80211_bss_get_elem() derefences an RCU to return ie, both the call to this function and any operation on this variable need protection by the RCU read lock. Signed-off-by: Ryder Lee --- v2 - fix typo in commit message --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 863aa18b3024..4d2e5b5e6389 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -923,12 +923,15 @@ static void mt7915_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, struct mt7915_he_obss_narrow_bw_ru_data *data = _data; const struct element *elem; + rcu_read_lock(); elem = ieee80211_bss_get_elem(bss, WLAN_EID_EXT_CAPABILITY); if (!elem || elem->datalen < 10 || !(elem->data[10] & WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT)) data->tolerated = false; + + rcu_read_unlock(); } static bool mt7915_check_he_obss_narrow_bw_ru(struct ieee80211_hw *hw, -- 2.29.2