From patchwork Thu Oct 19 11:36:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 155450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp318054vqb; Thu, 19 Oct 2023 04:37:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEyITxOnpGBD7JmX6nkfiVcsY4e/JO5sicr9WEGvKPGL54l3t9XrLY2bsb2rs0/v1DnmZt X-Received: by 2002:a05:6359:6d4b:b0:166:dc89:8c8f with SMTP id tf11-20020a0563596d4b00b00166dc898c8fmr1583843rwb.17.1697715470177; Thu, 19 Oct 2023 04:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697715470; cv=none; d=google.com; s=arc-20160816; b=Rtq0Fc5MmLHBXrtTO7FhhWQKlOJM962FTwkRKmrs5IxFFqhtyenYReV2ts116Wih5q BwhR9c6T/b7zH2pCDfWrleW6A/fPZqWw7OYthp9e3hTiDs82X/62PhU+wdBEJ5hd58Dq IZmSkXId2n1HR6KWKS/crlBAGFDXsUSn+K4yCf3wWc74Gwn1IEuNF/oHz7xFMpPLNqOT fnxRmzoZj0PFsfqQ+2QPEnWwMDAeGy+/oZDpyICyGUeKdjP7X7nSHoG+AQ7ECk6nAFzB eZI5GoTqH8n9Zd6Rq0dCelU42KsctJP42ixTdbc3630EGSmJW6+OBQlWb+9nvKWLdv1z RmkQ== 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=OypCZJtoC3yDPcsdhE+dITxYdYIfFDdqKi9rccJPOyM=; fh=b6T4KNXBGnFylkmvSy/6uFAUWVxpZjzq9hie5jLqwwk=; b=PGxE+Oq3nr5Bpz2eEmkYf6JhbEjilMXaidXD4fq8X4LnQJBVpxWseEh/mfKpdahjqh LqVE5y8ICsjcGQP3+AeU3alxY38508/93A4fksnK48Gz++G/+us3iKWNAyCqM2P8H+r0 KMTXL1laqJ5mElCAYAB6tikafd9BaiJumiBDKgUEFGcd3ESpbQl7imuUhh9IUtG/m/wf 2FVUBx0Dbm0l4wIsrd51G3emxuGCKNJOJu+Q3+aYOqJmaQTu8yZTTWPc5FJaW0EHRVFv 2YEL76gHMUiIVFOqzi9VLIgQi1BdsJMioi8c15MpoXGHbQgb9iFSfKIyqCTxHYENXrjJ /esQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oxUv1OUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g6-20020a636b06000000b005b837c29d13si2821456pgc.133.2023.10.19.04.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 04:37:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oxUv1OUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-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 pete.vger.email (Postfix) with ESMTP id 7021581A73CB; Thu, 19 Oct 2023 04:37:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345402AbjJSLh0 (ORCPT + 25 others); Thu, 19 Oct 2023 07:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345348AbjJSLhY (ORCPT ); Thu, 19 Oct 2023 07:37:24 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F81BBE; Thu, 19 Oct 2023 04:37:22 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8AC8C433CC; 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=AlrEZPik1jxL6sdyw6sk2fh7vSfCW6AGj33Rbxfwiss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxUv1OUW44Gy2DI6jjcgUUKlurn88h9liKBHyTR8b2U+XPsosnOfQ+S3t8uh9jOlZ +cFpbWANwm8rsYP5on73ULXaczg4UxnvN1vLyIaJpUKen2unUKqGEt45X1dBD2MBWk znEzlvO0qjoPpDuQj/l+i8JM6medNMFkAjWadX6EopLqSOv0jSqnqTmcyOWoZ8gS0X r1s5u/ZkvhlWc0qXoHPNr11M24QGsLsyxpnEj/tl/FTd6hVFb72CHLrYFfdt0lua4R 4VwiXJ+yTNAxO30U52+xcqRAseMeIMeZgn6CiZ8nOSKssNstHLskSIZNEcBpAK3IQC gdXEE5ZZHUjeQ== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qtRLB-0002Mi-0N; 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 2/2] wifi: ath12k: fix htt mlo-offset event locking Date: Thu, 19 Oct 2023 13:36:50 +0200 Message-ID: <20231019113650.9060-3-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 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 pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 19 Oct 2023 04:37:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780183696960675875 X-GMAIL-MSGID: 1780183696960675875 The ath12k active pdevs are protected by RCU but the htt mlo-offset 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 an RCU read-side critical section to avoid any potential use-after-free issues. Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Cc: stable@vger.kernel.org # v6.2 Signed-off-by: Johan Hovold Acked-by: Jeff Johnson --- drivers/net/wireless/ath/ath12k/dp_rx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c index e6e64d437c47..3294625650dc 100644 --- a/drivers/net/wireless/ath/ath12k/dp_rx.c +++ b/drivers/net/wireless/ath/ath12k/dp_rx.c @@ -1641,11 +1641,12 @@ static void ath12k_htt_mlo_offset_event_handler(struct ath12k_base *ab, msg = (struct ath12k_htt_mlo_offset_msg *)skb->data; pdev_id = u32_get_bits(__le32_to_cpu(msg->info), HTT_T2H_MLO_OFFSET_INFO_PDEV_ID); - ar = ath12k_mac_get_ar_by_pdev_id(ab, pdev_id); + rcu_read_lock(); + ar = ath12k_mac_get_ar_by_pdev_id(ab, pdev_id); if (!ar) { ath12k_warn(ab, "invalid pdev id %d on htt mlo offset\n", pdev_id); - return; + goto exit; } spin_lock_bh(&ar->data_lock); @@ -1661,6 +1662,8 @@ static void ath12k_htt_mlo_offset_event_handler(struct ath12k_base *ab, pdev->timestamp.mlo_comp_timer = __le32_to_cpu(msg->mlo_comp_timer); spin_unlock_bh(&ar->data_lock); +exit: + rcu_read_unlock(); } void ath12k_dp_htt_htc_t2h_msg_handler(struct ath12k_base *ab,