Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4861676rwb; Mon, 21 Nov 2022 13:00:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4/ybCOyjRQEPm7TXyBEzo8vwe4U8lMFWWQ2gG1uOYGz96U21ehqcqoIHWKokE+shgHA5rk X-Received: by 2002:a17:906:bc86:b0:78d:8580:8e07 with SMTP id lv6-20020a170906bc8600b0078d85808e07mr16737685ejb.131.1669064412481; Mon, 21 Nov 2022 13:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669064412; cv=none; d=google.com; s=arc-20160816; b=Xwi7UH4fUl0idnMaizy88+6gncEnqkZiYqZi17ztFEg3y9WcVVI3pMsP+rK8b+bqAX lC3zYkd77bimRDa4QGRBESe55pZ7ozhPN50vPwP9S6pOYe7oJrfhQ5X5ltIzV7xFaYZU QiBVbf+P6gBtiV0W913fDlgWrv9cOkK1hFiUOkgQ26ck43q6/W0I/HTIPdsDM9VN3Jpr J/5Texbp9cKSLADgssVMo3blivSgdQnauvQCzKV5h4OXtU2gigcHSDr2aTm4azuFKHN0 BOItbUDa+Cd+UK0NG5JzeILhrJpggQfVkf7Vur8DMyHE3NZDuGnBJRRUCR01PlOy7YLn aHDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=gTd30YK/ndNhc2JUcwma2+6/k1BhlViOKiNWVRhMlrM=; b=JlenRUiWdzuoZBU4QDtU9jzmnvjiKIFxVAgyGrSnbig9BLUODvU3Ga0fzpYkCFW6Oc /yuQQCEP1c2y/2TODQGCkBQdB3RjpXmnkr+y37RQmojVu9emLu66eZ/8Ys7tAV6SFrrb 0qNdRqUPJ0O3a4oHjW4mU6rvznf7s2IfbvW2EDlT8Y2/E56bNw2Q4bez+6kq3WLawFcv YoOXz/mszSKScqCEoEV7FZ3lgm5nyLtdZUaecOiq7mFP29l33ddtxkCwyGDGy2NZt1/L WunjssZJ8yOsTom4ZB1nDguGvW2hSQgyYYQaCjLE467C/Jj1d8bciXDH3JfrjwZQdDIE hz7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bP446rL7; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp8-20020a1709071b0800b007986956bd8esi11238321ejc.472.2022.11.21.12.59.52; Mon, 21 Nov 2022 13:00:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=@gmail.com header.s=20210112 header.b=bP446rL7; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbiKUU5G (ORCPT + 68 others); Mon, 21 Nov 2022 15:57:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbiKUU5E (ORCPT ); Mon, 21 Nov 2022 15:57:04 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA5A3D08B6 for ; Mon, 21 Nov 2022 12:57:01 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id bs21so21669976wrb.4 for ; Mon, 21 Nov 2022 12:57:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=gTd30YK/ndNhc2JUcwma2+6/k1BhlViOKiNWVRhMlrM=; b=bP446rL7jauaeRbyXQ5dFGXnm3LufjkC3lw+v4I070gZpCu/U9yMvhqXIMS5WDdJvi WvkZ8MviewfBy/JwhNPvojoMF32F/oNZwsH+Q/EGjR92IEm4HupynTaz8UyJ2echdU1z 8UonEwle4aTN8x3b1z/J3J2nO8fT+WfKo4+uZFhJjtk+HjDrFXm468ypgiW4Mvjcds/l 1w0/EzRE9nQZ0CXvjlr/7cwYNT66EPVGgNq5mVMz5rfC4ZZnHeRoc61W+QjxHj0DJ8bX NaF1gg05U6tgA6c7Y5uOFAucvgixNqMPvsMvSM6rAQCPKnAsx2o24gT7ZlATDhZLt5ma yqig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=gTd30YK/ndNhc2JUcwma2+6/k1BhlViOKiNWVRhMlrM=; b=yGxXCADDIauBYXaLYHB+z6rXcgsmqSg94HylNhPL+mlENcO2trEcKNv3e476PUoMwG X+bczE4Clz8EEDrtaSirwXCSK+EV3jdbl7YOTvPyE4XCywrgO+sbclV9QnRUbwPmZSI+ QhUHWdUzab6NhkMuxm2JvSinRIuF1NQU+kRQwDGYgv5qc5p+ZrshdC2o1A48bUzSsPmk nOhUi31I2YBd5BjQ60lIvtKaxr56Uo05hJQidlgbDExJvLgxAk5tCyViZvqKbCfVq4Lw V2uHHLduJJqFKZo5Ewfh7KpdI2rhM3o2x2oszcLEADksPvawTLjXsqAcyV+WvTozO9Ix pKCw== X-Gm-Message-State: ANoB5pnRy4G+AslaTB7Zvl9chXcWzhqklTvnMLUhpmmiTNGjtsQ8HXXT 04079U9axPVII5+JrO7CdZa/LB+54Is= X-Received: by 2002:adf:f90d:0:b0:236:6efd:ed6a with SMTP id b13-20020adff90d000000b002366efded6amr13028974wrr.32.1669064220296; Mon, 21 Nov 2022 12:57:00 -0800 (PST) Received: from [192.168.1.50] ([79.119.240.254]) by smtp.gmail.com with ESMTPSA id b6-20020a5d45c6000000b0022e3538d305sm14496912wrs.117.2022.11.21.12.56.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Nov 2022 12:56:59 -0800 (PST) Message-ID: <3c82ad09-7593-3be1-1d2c-e58505fb43cb@gmail.com> Date: Mon, 21 Nov 2022 22:56:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Content-Language: en-US To: "linux-wireless@vger.kernel.org" Cc: Jes Sorensen , Ping-Ke Shih From: Bitterblue Smith Subject: [PATCH v2] wifi: rtl8xxxu: Fix use after rcu_read_unlock in rtl8xxxu_bss_info_changed Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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-wireless@vger.kernel.org Commit a8b5aef2cca1 ("wifi: rtl8xxxu: gen2: Enable 40 MHz channel width") introduced a line where the pointer returned by ieee80211_find_sta() is used after rcu_read_unlock(). Move rcu_read_unlock() a bit lower to fix this. Fixes: a8b5aef2cca1 ("wifi: rtl8xxxu: gen2: Enable 40 MHz channel width") Signed-off-by: Bitterblue Smith --- v2: - Adjust the commit message. --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index e8fcd531c437..28f136064297 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4645,7 +4645,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (sta->deflink.ht_cap.cap & (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20)) sgi = 1; - rcu_read_unlock(); highest_rate = fls(ramask) - 1; if (highest_rate < DESC_RATE_MCS0) { @@ -4670,6 +4669,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, else rarpt->txrate.bw = RATE_INFO_BW_20; } + rcu_read_unlock(); bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate); rarpt->bit_rate = bit_rate; rarpt->desc_rate = highest_rate; -- 2.38.0