Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3125748rwb; Mon, 15 Aug 2022 18:46:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR4052JdJLAvbck83hVxH4rngWrOv9cl5casf0gj2sNl/9sxU2mJf+Y+f1EqLZRZPTdcfG4b X-Received: by 2002:a17:907:6089:b0:734:be0c:e0cd with SMTP id ht9-20020a170907608900b00734be0ce0cdmr12126996ejc.474.1660614378479; Mon, 15 Aug 2022 18:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614378; cv=none; d=google.com; s=arc-20160816; b=znZAgACvt1fC+qFw6b+864JG1BxXyIJ3JQ2gi+fUnNZy9R/Zl8Qwij/eLzujmSGzWv KaENIWphhPqeS+g83mx+LRmGPBHgKywzOuAhUl2EGeMPs4ANGb9znqRsMtfIgn5G45vM 52qc1zqqUKXO7HorpZ8uT56M9ngteAQn2ppICWnDMHyiKgYf4DjgI7xfvA1owtOW1wz0 uxujkqhPja5U82PvQMfaUFZPaGen+w1i8rRpsZq+PO1CkdLar7xZVJGGYHpULPfsGUQH jcaBKkT1w/lJwvxY7PaFkUqVvuynODj9tIWFK9uzlnE7D55oBFXSDJ0ZV16QC5YNTClw O4cQ== 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=GxweqlwuvKbjVM0e5yaCdQL63i0yamwmQTpVF54ztd0=; b=u5LExXBM1IH3cyBIgF3y/c8UlprQgH1C/p6dQ8A6saVePKJN+RNxDtycSYxVA+fqo5 /DZ7IgwHdjpWWAwGgb9F1VuPKPIyYJUI7slKcm34lmelBQWbqqxniGpiroOd4MAaVI83 DEq9l/K/6lynqKz+SmLZe5F3sqrHd0gJqO6z4osTOLTxGOcbJmnp1rvekCeDvbyV/Ym9 nnZYiIyIRVrWBCngm16bbjp5z1zlXasopagFxFSGElLioh/N+E4cZzcUHNOFIbHL9oBr FOsCTQbGCOSLvbmdfd3Kh7TVCIJkJ2WU87HUqzAhVN5Na6VmMmj3IHSlVhn2sFiYWDlc srqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OcFmjTcb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j39-20020a05640223a700b00442fd542407si9527884eda.284.2022.08.15.18.45.53; Mon, 15 Aug 2022 18:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OcFmjTcb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344655AbiHPBII (ORCPT + 99 others); Mon, 15 Aug 2022 21:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349012AbiHPBC1 (ORCPT ); Mon, 15 Aug 2022 21:02:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72DEBA9DA; Mon, 15 Aug 2022 13:51:00 -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 629BA61239; Mon, 15 Aug 2022 20:51:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69092C433D6; Mon, 15 Aug 2022 20:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596659; bh=tWf8Wi3b7/Prk4onpT6cSotfSRDeTf1Vrw/VKciE+D0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OcFmjTcbTjRtDYUIJyxcLX7rSVCEyBdlRZzI9FUkqqretIM8sXvEmuexAmv7++bWi LTDHIsV5ldCCQzrYcFA0/v555Uu/HtoEsz3xdX1oDxEKgN+F6qc72VoShgsvtm7UFR KG95lEB+aM4p38nhc5Agp1NQHUvtogrkOXdb0i78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg Subject: [PATCH 5.19 1149/1157] wifi: nl80211: relax wdev mutex check in wdev_chandef() Date: Mon, 15 Aug 2022 20:08:25 +0200 Message-Id: <20220815180526.483944476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Johannes Berg commit 31177127e067eb73d5ca46ce32a410e41333d42f upstream. In many cases we might get here from driver code that's not really set up to care about the locking, and for the non-MLO cases we really don't care so much about it. So relax the checking here for now, perhaps we should even remove it completely since we might not really care if we point to an invalid link's chandef and can require the caller to check the link validity first. Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/chan.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -1433,7 +1433,17 @@ EXPORT_SYMBOL(cfg80211_any_usable_channe struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev, unsigned int link_id) { - ASSERT_WDEV_LOCK(wdev); + /* + * We need to sort out the locking here - in some cases + * where we get here we really just don't care (yet) + * about the valid links, but in others we do. But we + * get here with various driver cases, so we cannot + * easily require the wdev mutex. + */ + if (link_id || wdev->valid_links & BIT(0)) { + ASSERT_WDEV_LOCK(wdev); + WARN_ON(!(wdev->valid_links & BIT(link_id))); + } switch (wdev->iftype) { case NL80211_IFTYPE_MESH_POINT: