From patchwork Thu Oct 19 10:42:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13428618 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 514D4CDB484 for ; Thu, 19 Oct 2023 10:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232888AbjJSKnN (ORCPT ); Thu, 19 Oct 2023 06:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230297AbjJSKnL (ORCPT ); Thu, 19 Oct 2023 06:43:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03EE5119; Thu, 19 Oct 2023 03:43:10 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A9BEC433CA; Thu, 19 Oct 2023 10:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697712189; bh=+65hIKor49TrWPpX1MZLxHjHl0a9EdHwn7yekofvZVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kz3CVktyrqbK/5jucRIqPe4Bg8/2aUDx5aCC5oLs93UOJ5tvN73wKlRdWq5NTtP+W Mc/TknTyh1iGgz1UoQOadGAH77q/0zr3L/5nkjnJtDc+TUTjMLONonwsLMMLi6/Pew 3Hwej3Jtows5gPsRuMU8pPa6+PjI7jxF7eVJ7dgWctg0OqH626yg0pGxs/mE26M9db YX16xbHr8mJY4dsZzDyBYrnUHJXh3pWb/3FbYzuzp/f1/2DMdPtAgJhkyHsBhuSfZb MLmLetIvMB22OLHJZdUvpmCg7XGbuTQ0WektV7RzW8qKEaH8S6nGaT9Zw+wF5tuqb1 /yYqoFvMDy3gw== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qtQUi-0003ao-2U; Thu, 19 Oct 2023 12:43:12 +0200 From: Johan Hovold To: Kalle Valo Cc: Jeff Johnson , Pradeep Kumar Chitrapu , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/2] wifi: ath11k: fix dfs radar event locking Date: Thu, 19 Oct 2023 12:42:11 +0200 Message-ID: <20231019104211.13769-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019104211.13769-1-johan+linaro@kernel.org> References: <20231019104211.13769-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The ath11k active pdevs are protected by RCU but the DFS radar event handling code calling ath11k_mac_get_ar_by_pdev_id() was not marked as a read-side critical section. Mark the code in question as an RCU read-side critical section to avoid any potential use-after-free issues. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Cc: stable@vger.kernel.org # 5.6 Signed-off-by: Johan Hovold Acked-by: Jeff Johnson --- drivers/net/wireless/ath/ath11k/wmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 980ff588325d..fe6b70a503d0 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -8337,6 +8337,8 @@ ath11k_wmi_pdev_dfs_radar_detected_event(struct ath11k_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 = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); if (!ar) { @@ -8354,6 +8356,8 @@ ath11k_wmi_pdev_dfs_radar_detected_event(struct ath11k_base *ab, struct sk_buff ieee80211_radar_detected(ar->hw); exit: + rcu_read_unlock(); + kfree(tb); }