Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp449858rdb; Thu, 19 Oct 2023 08:54:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWRLJJz/zM/gz9/IhOrfqX8TmJ/JjJiPiUOR3n/IEuskTwFg7NM4pKgdeYE5WbQ99nK2Oy X-Received: by 2002:a05:6a20:4328:b0:126:42ce:bd44 with SMTP id h40-20020a056a20432800b0012642cebd44mr3350628pzk.17.1697730844909; Thu, 19 Oct 2023 08:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697730844; cv=none; d=google.com; s=arc-20160816; b=B6mkSzvFNxwLaaAM0prDjLgxeRQJdLlrN0+NBuXPdw2FvmXO+3tsJYBlZmw5sjWaJA 7ZFH7xiDh2ae5L9WgClsCuU1d8IWTD0pUBJ5CWYWuJrgWMq4opNaeQuh8roLY9SEgWu2 yM9L5EvJfftGvEHsxEhnxKvoMe2GSWHMDeFlwiSOCLaFNZSoCBcYiZvNlskj1I8ubIh2 P+emswpff204nUIPLb5Oksqtqtg2KE4gNewWRggz10RMtcch5NyQAAiMwmi8JTbfuORw pID4lTz+C/XvN3gXk26NKS6xvKKNMy/0pOVSgNTN7x1BY4In1jFblf8oQ9ZbjI0xeg2A 8HqQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=ufJ/aJNUlocfbpytwu1oFaTsNqP9MW6INhAHA80S3AE=; fh=kUn9h0HqmQF0pAmbCBEs17yQfTzFCCf/iTypTJqm3j8=; b=aYnfE3452fKzG3rvGKiopRNFfFHaRRXdDLWqP5AsQ/71Q3Qvevk9d1WDP3k9KZ+yv4 dF6Gf+tPigj1ctVlg1g8D38shi726FyKpFyNIY0jctx3sdBXN0+pjUVHqwVJXuPI0Y9v EtzeUgV5WLqa+K6nR0xUFfndZJOupgSQXVb83COZzRVyOn65RWvtVIC/rFdREFbrwc2y 1uqQo6fuaB+rMkI8pF1pNSExmG9tVc6cWPfwlqRPgmTAj+rb6lELx4VxMwn5jUKMb7f2 ujLlN3Dl81EzwYV+0gog7Xc8TV+vkDDt4R+2d+vTl+kObRS0XfOWQ+6prwIlYFiRYYQu 8E0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sXKWpTyl; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id h4-20020a636c04000000b00578eafd0826si3492979pgc.398.2023.10.19.08.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 08:54:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sXKWpTyl; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 12E3C82A854E; Thu, 19 Oct 2023 08:54:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235443AbjJSPx7 (ORCPT + 52 others); Thu, 19 Oct 2023 11:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233176AbjJSPx6 (ORCPT ); Thu, 19 Oct 2023 11:53:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E9C93; Thu, 19 Oct 2023 08:53:57 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1B09C433C8; Thu, 19 Oct 2023 15:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697730836; bh=wa4WXUdBJDSprT0pug2ujhG4LLF9gr+xArqonoxADzw=; h=From:To:Cc:Subject:Date:From; b=sXKWpTylvlESxh+A9Ob0R/6Ik+gMuidD6esDgwByGAV8s6TPXDJolqJ8+l+mEAHYh d1M59feYyobvivShElD7sHFA1952PL4IhTuygo2gVnCTiM2/+aOmL/VMxuVNXQlC4B Pkvr7U9z4QIB8r2Jy2rKHXVbYa09DwZn3Xd8/Aeg4Ou4eBbaFlpGA3Be3uOG7gU4aZ WtR6mxZnlEKNWalKmfIDIYPn/XQKlFxyTwnjR2f24gw0BqI3BQbR4AIdNxYFE0gNg4 RyNzKWp8mWJSCHYMNKmjQcGRBOQ8FnAi+LDtskbRn2XKQ/Ygc/VHfWOZL9VNFS+mPd ljpK+AzNp49rg== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qtVLT-0008Eg-2K; Thu, 19 Oct 2023 17:53:59 +0200 From: Johan Hovold To: Kalle Valo Cc: Jeff Johnson , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Carl Huang Subject: [PATCH] wifi: ath11k: fix gtk offload status event locking Date: Thu, 19 Oct 2023 17:53:42 +0200 Message-ID: <20231019155342.31631-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 08:54:00 -0700 (PDT) The ath11k active pdevs are protected by RCU but the gtk offload status event handling code calling ath11k_mac_get_arvif_by_vdev_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: a16d9b50cfba ("ath11k: support GTK rekey offload") Cc: stable@vger.kernel.org # 5.18 Cc: Carl Huang Signed-off-by: Johan Hovold --- ...and here's one more, this time using the ath11k_mac_get_arvif_by_vdev_id() helper. Johan drivers/net/wireless/ath/ath11k/wmi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index f0eac6cb84fd..78af659b1ccd 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -8618,12 +8618,13 @@ static void ath11k_wmi_gtk_offload_status_event(struct ath11k_base *ab, return; } + rcu_read_lock(); + arvif = ath11k_mac_get_arvif_by_vdev_id(ab, ev->vdev_id); if (!arvif) { ath11k_warn(ab, "failed to get arvif for vdev_id:%d\n", ev->vdev_id); - kfree(tb); - return; + goto exit; } ath11k_dbg(ab, ATH11K_DBG_WMI, "event gtk offload refresh_cnt %d\n", @@ -8640,6 +8641,8 @@ static void ath11k_wmi_gtk_offload_status_event(struct ath11k_base *ab, ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid, (void *)&replay_ctr_be, GFP_ATOMIC); +exit: + rcu_read_unlock(); kfree(tb); } -- 2.41.0