Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp282618rdb; Thu, 19 Oct 2023 04:37:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWUT8PQftipmEB2pJU2cmu2DhCD+NAOTO4cRThBZaAQLS+sNgjHetYkDLrytEeXoKE/iTL X-Received: by 2002:a05:6a20:144a:b0:15e:707c:904 with SMTP id a10-20020a056a20144a00b0015e707c0904mr2020722pzi.24.1697715461167; Thu, 19 Oct 2023 04:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697715461; cv=none; d=google.com; s=arc-20160816; b=gbQcIXtZxLM6A6/q++b9p6DZKyIMRIrfo/hRIvFHByw9/jA7dzuTgmVumPcvu11woG IqkVoT2Im1uN5oHDZ5iNSLx6uW7kwoE0nI8MEyMkXVe0RBXEojAhK9YNBmD5gfSaAcYv uS60mFvvoYcwCAaXFZCui2RE+JRONQtucHDWdIviaWeAL2mPjzBVMtHq6UKW/bSF3Faq 0T8aA2IkjXMf6PTOyVXWRvTjo582p2HaKudEvxvVS6cV0cj+NrzrwagXZKgvOOIhd5Hj h5VBuSXRMwmbXgdfaicPz/8FS9tZEfo7zc4EjNX1hpVSnM4K2ACfK5mmEkFvcEqBKjk0 qQOw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6qdChLOBhZMq+eIsXpLezu9KxeKG3Fq9v/CRzM2U8WI=; fh=b6T4KNXBGnFylkmvSy/6uFAUWVxpZjzq9hie5jLqwwk=; b=CQNtz7BkYeCUYWCpyLADuQUdwUAd+Tut/8F5Bw5EBIkRLiP7oE0pOksef15DOLf9c9 5SekxQnvcG7u4hT1aX8OM3ezy2/3t70kDYqF6miYTb6VR/fqcipu9MZxXJp19y5DJgFl hGaIzg7Bd7Ydyf+X0u6tlQz/9rCGN2EdwQ635iQm8POZM4WN7VfD6amSyj8C7hjvgpwK WlB5bGw0I6sboGBBVLYrPTrAQFBUXCtcJ0ZZRVhBgNkvX622ZhtRox429isSvWZjqO6n MqP8bH8HcfNSAhZHf2VhnqQw5z+NIfIcd2IpQrBgYVxd00zuJpeZn7smWUEkaYiFxHhO A+PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QHLwYH8I; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u3-20020a170902e5c300b001c9e422c587si2021333plf.368.2023.10.19.04.37.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 04:37:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QHLwYH8I; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 83148818CC93; Thu, 19 Oct 2023 04:37:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345251AbjJSLhZ (ORCPT + 52 others); Thu, 19 Oct 2023 07:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345381AbjJSLhZ (ORCPT ); Thu, 19 Oct 2023 07:37:25 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52047131; Thu, 19 Oct 2023 04:37:22 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C28DEC433C8; Thu, 19 Oct 2023 11:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697715441; bh=Fl3AWQhRpM38FD8RxKjmnV0l3qxACyYQ/7kTZ5GaoTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QHLwYH8IyxMBa7gIp3HRiTFnlCMEWvzafAS97eM+kJu2uAfpF5pO+X4jo/yFxSzjj 6TUvRsAAtVX9ClOg2wiXBI2Iv0fQE85XmtzjGqlR3Eon3SNbZJGkmlxQ0ss4eEtFgq mdp4Iew5tgDMMzZSHijCxWhATPJ+3qvTnD/lsfy89a2g2eBckQg9xfJYKODEhVQc+5 SOH30zBw/W5Qe7f0MpHPP8JfCtbGQnmMesZJMSm4sMKE4J30syVf1/HPic4Hh0hZ0s PqTJG3l4Mdd8cbhUvsXlaymPHJZSbeq1nSnKsl3SIupX2Uj+fi/HnNmQ6B/cCwECgX sNeAkiBiRiy1w== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qtRLB-0002Mg-07; Thu, 19 Oct 2023 13:37:25 +0200 From: Johan Hovold To: Kalle Valo Cc: Jeff Johnson , ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/2] wifi: ath12k: fix dfs-radar and temperature event locking Date: Thu, 19 Oct 2023 13:36:49 +0200 Message-ID: <20231019113650.9060-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019113650.9060-1-johan+linaro@kernel.org> References: <20231019113650.9060-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 04:37:37 -0700 (PDT) The ath12k active pdevs are protected by RCU but the DFS-radar and temperature event handling code calling ath12k_mac_get_ar_by_pdev_id() was not marked as a read-side critical section. Mark the code in question as RCU read-side critical sections to avoid any potential use-after-free issues. Note that the temperature event handler looks like a place holder currently but would still trigger an RCU lockdep splat. Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Cc: stable@vger.kernel.org # v6.2 Signed-off-by: Johan Hovold --- drivers/net/wireless/ath/ath12k/wmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index ef0f3cf35cfd..1a1f57c7ac7e 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -6476,6 +6476,7 @@ ath12k_wmi_pdev_dfs_radar_detected_event(struct ath12k_base *ab, struct sk_buff ev->detector_id, ev->segment_id, ev->timestamp, ev->is_chirp, ev->freq_offset, ev->sidx); + rcu_read_lock(); ar = ath12k_mac_get_ar_by_pdev_id(ab, le32_to_cpu(ev->pdev_id)); if (!ar) { @@ -6493,6 +6494,8 @@ ath12k_wmi_pdev_dfs_radar_detected_event(struct ath12k_base *ab, struct sk_buff ieee80211_radar_detected(ar->hw); exit: + rcu_read_unlock(); + kfree(tb); } @@ -6511,11 +6514,14 @@ ath12k_wmi_pdev_temperature_event(struct ath12k_base *ab, ath12k_dbg(ab, ATH12K_DBG_WMI, "pdev temperature ev temp %d pdev_id %d\n", ev.temp, ev.pdev_id); + rcu_read_lock(); ar = ath12k_mac_get_ar_by_pdev_id(ab, le32_to_cpu(ev.pdev_id)); if (!ar) { ath12k_warn(ab, "invalid pdev id in pdev temperature ev %d", ev.pdev_id); - return; + goto exit; } +exit: + rcu_read_unlock(); } static void ath12k_fils_discovery_event(struct ath12k_base *ab, -- 2.41.0