Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3137476pxb; Thu, 10 Feb 2022 13:14:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQR4tv9C2NzVCOsYT4tbn1ac3V1JOmKwZChC1xCo6P8J9XkLOmWCMXse82zi26QBw2ESXV X-Received: by 2002:a17:906:faec:: with SMTP id lu44mr7676853ejb.216.1644527653998; Thu, 10 Feb 2022 13:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644527653; cv=none; d=google.com; s=arc-20160816; b=rvt2dGRCCWp7mYLuNqrKikJk6/xYRtdlf6kh95/tV8yQxdhElq3w3pt5EE/sbu3omz 4hy0sGrfgxavlSxf2Vmi8Xc4eQr7ZAAnlU0io3JEXwLeGV0HA0g6VmxWaLzRyAQIBjNM sI0bE7VcC3x2C9K8oJVPxQTQP3pjwtVg8IhfTiyjZwlywcXtz/1cnocV0pERxXmSGuBS WhVIeAZoBE6j0ZUaDAPdBj0p94i7ei+rfKSysEzZh+8WwkzxprTuOlmyx4EfKq2ZWfbF jxAwftnnpRieVtOC2zvCDX5nJILJZSziM4lwRdSCkcdliCvfVY9EoNi32M1jPxcAWJbB p9EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:subject:from:to:user-agent:mime-version:date :message-id:dkim-signature; bh=BQ1tM4eLAYA8OKVzE+9N45PjYV+ohh5YYkUsqsUdtCw=; b=Ai1U6JmqC5mPwISPJ2P7+mJ9tIyExuYKwxACuohcSIvyn07qhlD/PWA7eGagQ3q02k SQwWAzu+7nU6w6plEOcMnA+kfHYzcR841BeshNeePM2RN3ZvZy++DQavBk3F6aV2XwYB nn1rDexMHPbmqwuOGWY2S5ax5BgJYCSe8D+nx9c5t0GZrCYlCEUNt/7ErhS541OONI0L QjJ9/xPGGM5SfYx2sWP4AQbfgNkPDF+BCKS6y21um7mIM1zB1QF4zWWFfdyo6Htzjcuw vT2piOvmWSzCFYWowo5JCkPgKU+qh2yxYp8yI8SlPmx+GQwa1ffncSlf3/77V565df5S s1bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=h4BQqs5H; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8si16683879edx.400.2022.02.10.13.13.51; Thu, 10 Feb 2022 13:14:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=@broadcom.com header.s=google header.b=h4BQqs5H; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241204AbiBJMoH (ORCPT + 73 others); Thu, 10 Feb 2022 07:44:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233218AbiBJMoG (ORCPT ); Thu, 10 Feb 2022 07:44:06 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CF4F48 for ; Thu, 10 Feb 2022 04:44:07 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id l9so109889plg.0 for ; Thu, 10 Feb 2022 04:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=message-id:date:mime-version:user-agent:to:from:subject:cc; bh=BQ1tM4eLAYA8OKVzE+9N45PjYV+ohh5YYkUsqsUdtCw=; b=h4BQqs5HA8bVY7+duoC4vPhfUoKsDoCI6xLKT/Ff5mwtMtidKl0u0MgMH8Le8bb/sc EKzDd6rDxFqfimM7N9vis2QxcjqAUp6MawWhHkXNUKzU44uStLHZgFxUuPOikwCk0AuR Tq/5JhZiDZbDo/CRFbkeznDeqwg9akEwbbeE8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:to:from :subject:cc; bh=BQ1tM4eLAYA8OKVzE+9N45PjYV+ohh5YYkUsqsUdtCw=; b=RWTJsr+mU4uGV3onLBQq3aSbK80I+XPVXqMGDFfzStJUqS4xTBE4NRnaMkZhl8it/b rurrVJylvH4/+I1D2l4/8k8dNV0HO+Dyp1U3wEYAirtp/cdB5UoO9Cgw3pXXE5hrzdqK NXByfK1rLrCrCSlJur3VD4MUT10U1WOBxpk6zqR1rAIlE5a1atzqeWJ9yeQHbcePBvnJ zM7TDRq4ba9XstGf17DmtveEIj+dSNhXqJ0OhCm0JXbiAbslCvri3vESXx3DU4N68sYV X7NslCHpt1o1pxQyxlPPnD7acFhJaLmoCZTDSC1wmXp/7HTirCJY3DKd75pG97nALB6D DAyg== X-Gm-Message-State: AOAM533cKGMTSVRvnKv9uMISA+vasmNbErco0c1oa87DlpvNfmIh4pKL xfqkog9CtCbkshCZvoUvSh5Sz4p/1cNP23rgY8E= X-Received: by 2002:a17:903:2284:: with SMTP id b4mr7312606plh.91.1644497047237; Thu, 10 Feb 2022 04:44:07 -0800 (PST) Received: from [10.176.68.61] ([192.19.148.250]) by smtp.gmail.com with ESMTPSA id o8sm23923248pfu.52.2022.02.10.04.44.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Feb 2022 04:44:05 -0800 (PST) Message-ID: <6562d8c3-27f6-490a-7732-6c300eb3aa64@broadcom.com> Date: Thu, 10 Feb 2022 13:44:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 To: johannes@sipsolutions.net From: Arend van Spriel Subject: locking in wiphy_apply_custom_regulatory() Cc: linux-wireless Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000005aa02005d7a94ec7" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,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-wireless@vger.kernel.org --0000000000005aa02005d7a94ec7 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Johannes, I stumbled upon locking in wiphy_apply_custom_regulatory() and the history of commits make it a bit unclear to me if these locks are all really needed. beee246951571 added the rcu assignments without any locking. 51d62f2f2c501 added the rtnl locking. a05829a7222e9 added the wiphy lock. My understanding of RCU operations was that locking is only needed for readers, but here we use not one but two mutex locks which makes me wonder. Especially, as this function is called before registering the wiphy. Could you clarify? Thanks, Arend ---8<--------------------------------------------------------------- /* * no point in calling this if it won't have any effect * on your device's supported bands. */ WARN_ON(!bands_set); new_regd = reg_copy_regd(regd); if (IS_ERR(new_regd)) return; rtnl_lock(); wiphy_lock(wiphy); tmp = get_wiphy_regdom(wiphy); rcu_assign_pointer(wiphy->regd, new_regd); rcu_free_regdom(tmp); wiphy_unlock(wiphy); rtnl_unlock(); } EXPORT_SYMBOL(wiphy_apply_custom_regulatory); --0000000000005aa02005d7a94ec7 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQdwYJKoZIhvcNAQcCoIIQaDCCEGQCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3OMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTEwLwYDVQQDEyhHbG9iYWxTaWduIEdDQyBS MyBQZXJzb25hbFNpZ24gMiBDQSAyMDIwMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA vbCmXCcsbZ/a0fRIQMBxp4gJnnyeneFYpEtNydrZZ+GeKSMdHiDgXD1UnRSIudKo+moQ6YlCOu4t rVWO/EiXfYnK7zeop26ry1RpKtogB7/O115zultAz64ydQYLe+a1e/czkALg3sgTcOOcFZTXk38e aqsXsipoX1vsNurqPtnC27TWsA7pk4uKXscFjkeUE8JZu9BDKaswZygxBOPBQBwrA5+20Wxlk6k1 e6EKaaNaNZUy30q3ArEf30ZDpXyfCtiXnupjSK8WU2cK4qsEtj09JS4+mhi0CTCrCnXAzum3tgcH cHRg0prcSzzEUDQWoFxyuqwiwhHu3sPQNmFOMwIDAQABo4IB2jCCAdYwDgYDVR0PAQH/BAQDAgGG MGAGA1UdJQRZMFcGCCsGAQUFBwMCBggrBgEFBQcDBAYKKwYBBAGCNxQCAgYKKwYBBAGCNwoDBAYJ KwYBBAGCNxUGBgorBgEEAYI3CgMMBggrBgEFBQcDBwYIKwYBBQUHAxEwEgYDVR0TAQH/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