Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2185373iof; Tue, 7 Jun 2022 22:31:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUTyb8Gg4v9U6zSZXvSwZnZOkb7VOLW2TJle2dmsegrz2ApPEgY0BKpJYdpVb65OIFXmv0 X-Received: by 2002:a17:90b:4b8d:b0:1e3:5147:6e63 with SMTP id lr13-20020a17090b4b8d00b001e351476e63mr36188296pjb.162.1654666300005; Tue, 07 Jun 2022 22:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666300; cv=none; d=google.com; s=arc-20160816; b=QNWpRk8SXPUpArA5v9BWbzz0KMJ90r9aeW+MyYAqltBsgP7/VmbyVPcmC6eDg/+JWr Tr+bFHdX8K7OeHQV8DoWc8KFvcKOpQiqV2yZKuTfo4ZEN4iigybmlGIiaFbicIbjtgQQ LM9S0wDBehoW4Zzcg/8nR4Ym0yWQWIQszva1H1cLZtHunn7/pmZV8rlCCQyDpQUuQKcS PrWt9Yprx/saCvsk0HiXu1P2t06ZLHx5tvoM2xTcwE7PV1YQqG1uEP28ZX6YZxPAjVF7 hfb357VPVUehsV2oXgNHslzzkmESPFicsvMJRY8XA/ZADF0ywJkjQhmnlpwrKKQwJr3J 3DtQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JQzhltj/tI1Hwj2MjfaVDgQTVeTSCaFgwfB/R5Z8ya0=; b=cq9rfrfjKQZBmLB1Dm1yhGVL7IiEpDavX9Yrxamwxc4TqzSGujvX97zCGr0elVFU/Q G1sCLBDDg8yeK8tBX3gZtVlUtz+EkWXZfRnlqY9e3JPMOCHWKu/D2COBZnGHeRz7j2Sc wK5JsUtafDfkulRbPc9D4QC+yL19YpLyzB6qmlN3kaoKY7O8mD1pduY72kR1zQsswwQW kzmEXwo98BNXvq7pghhtOz+xpni6RMv9neXv9qhxhjukvRguTlA/FcG2SmvVE9huR21c rDJs0S0dwmkXfIEh53PnxovC+yS2+PgR+hOGiW1hjdxg633mJp2+1FKnGW7eaYt0vazV c3Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O0Tb862z; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i62-20020a638741000000b003fe0ac55d2bsi4326558pge.134.2022.06.07.22.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:31:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O0Tb862z; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 345BC48F66B; Tue, 7 Jun 2022 21:58:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381757AbiFGW3q (ORCPT + 99 others); Tue, 7 Jun 2022 18:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380838AbiFGVRB (ORCPT ); Tue, 7 Jun 2022 17:17:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A1425D5C3; Tue, 7 Jun 2022 11:57:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C2F0617D2; Tue, 7 Jun 2022 18:57:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A957C3411F; Tue, 7 Jun 2022 18:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628273; bh=3lSHODUJjy7UczJbjszWlmWM73jIhvrMCrcbExh30ZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O0Tb862zTGG4ooiJfDB2aL8FXEFIoNAoE3IloSn5GqmDXmHhTNQoxMPNK2SaURA0o pMMSozzoquh1aJZX3XYkmIBdEYbspARwt8ox4FjU0RavuhEU1UqXuOh3btjfUdTkJD LSE+jXo4fwSwUzzeUVGsaqCufEET9iDgNrEDxyvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 268/879] ath11k: acquire ab->base_lock in unassign when finding the peer by addr Date: Tue, 7 Jun 2022 18:56:26 +0200 Message-Id: <20220607165010.628851110@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-kernel@vger.kernel.org From: Niels Dossche [ Upstream commit 2db80f93869d491be57cbc2b36f30d0d3a0e5bde ] ath11k_peer_find_by_addr states via lockdep that ab->base_lock must be held when calling that function in order to protect the list. All callers except ath11k_mac_op_unassign_vif_chanctx have that lock acquired when calling ath11k_peer_find_by_addr. That lock is also not transitively held by a path towards ath11k_mac_op_unassign_vif_chanctx. The solution is to acquire the lock when calling ath11k_peer_find_by_addr inside ath11k_mac_op_unassign_vif_chanctx. I am currently working on a static analyser to detect missing locks and this was a reported case. I manually verified the report by looking at the code, but I do not have real hardware so this is compile tested only. Fixes: 701e48a43e15 ("ath11k: add packet log support for QCA6390") Signed-off-by: Niels Dossche Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220314215253.92658-1-dossche.niels@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mac.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 58ff761393db..2c8d5f2a0517 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -7114,6 +7114,7 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ath11k *ar = hw->priv; struct ath11k_base *ab = ar->ab; struct ath11k_vif *arvif = (void *)vif->drv_priv; + struct ath11k_peer *peer; int ret; mutex_lock(&ar->conf_mutex); @@ -7125,9 +7126,13 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw, WARN_ON(!arvif->is_started); if (ab->hw_params.vdev_start_delay && - arvif->vdev_type == WMI_VDEV_TYPE_MONITOR && - ath11k_peer_find_by_addr(ab, ar->mac_addr)) - ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); + arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { + spin_lock_bh(&ab->base_lock); + peer = ath11k_peer_find_by_addr(ab, ar->mac_addr); + spin_unlock_bh(&ab->base_lock); + if (peer) + ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); + } if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { ret = ath11k_mac_monitor_stop(ar); -- 2.35.1