Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2311767pxb; Fri, 25 Mar 2022 15:13:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+raD4IuyqGE5LaCBMoePGDXoZyMZCOumxsXzk5lFWdmcuFxO5EBT90cUkF7mhRHxN7OPE X-Received: by 2002:a05:6a00:ac1:b0:4f1:29e4:b3a1 with SMTP id c1-20020a056a000ac100b004f129e4b3a1mr12268875pfl.63.1648246410361; Fri, 25 Mar 2022 15:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648246410; cv=none; d=google.com; s=arc-20160816; b=pt/dbWco2eSpsdEf8iErMpNFB0iS1fXiP3pg8gD5dsOiwrlljdjQyYcFTrkMVzN/bO 7aka6T0QDe/TyUKhBJG30Tt8SBlE4Srmeiqi1aqC9If0a2osjqZMLEzPmLZoRPDwDp5A xqZsDaaSD0okzYpftmGlX15Zve3voMyT7c5PtxegN1PQ+ciUn3jHs4yCTMS53soQK1DI h93LZ548RzMt2Y4aby4URfIR4MSYsZxNlf9TiSDiKB4ROB5asA5uRDvCBed5KQIPBzGb 1O4a20cuc7SFyO9bJEtCMiWEcms6ZR1EKD+J/unYf3cNbHXaLG1GlQjYDO9qD+cSigqK 90dw== 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:subject:cc:to:from:date :dkim-signature; bh=lVuMWueJnQaaL0ZdhEeDl2MkPoFt1lNqVus0jPK2uwM=; b=wWLIqUo7rKZdVGhRvqmbdQRhkpXN31DCkU2OxHCL3RyBGvziljeMfr2PImAYWMnv4W MX12h2FI9LEFjwElPq1YT7K8BgvLXjfSy1qkHH10KfusFy2MJ2zhVlhjl937vReVUAUg 4JzvZPAr3gwfksc2ipjhG5L4gQWnB8mnC2UHytXI9g5RWYJi9vJdd7LVS065mRSyZSlU 7z2vHUu4735ms5huXd9S8OgT678OQM1Hlc/Ls9paHe30MsupcrlZFq/GtbM4V57l5Hwj 8Mkg93ma25dUEdU0ohA5wERPppt8aJWB59zX9qVSxqflOXN3BkywUl1vPOc7+1kZl660 SyUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o7wYz+O2; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d4-20020a63f244000000b003816043f054si3557393pgk.585.2022.03.25.15.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 15:13:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-wireless-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=@kernel.org header.s=k20201202 header.b=o7wYz+O2; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E56FE26E033; Fri, 25 Mar 2022 14:48:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233562AbiCYVuU (ORCPT + 70 others); Fri, 25 Mar 2022 17:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233526AbiCYVuT (ORCPT ); Fri, 25 Mar 2022 17:50:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159EC15AAF8; Fri, 25 Mar 2022 14:48:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id B60B7B829BA; Fri, 25 Mar 2022 21:48:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDB32C2BBE4; Fri, 25 Mar 2022 21:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648244921; bh=g3tMjcH8Q1ET2Bd+kcytt3Y3iDDh51rlme44+V0MJas=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=o7wYz+O2Ruoaq98WvBaydW+RfhoZE9XDULwEk5PULFW6Rrl6KNo085xqkgHwzdgDR ET2DppVTaCNrcuEQ6gghWc+snJbqdYcY/Uasu8P2PaCgrc65855Kewera4YoTclbIW nKf5Nzr1olQV4SaxHtvHKllQqSrqX/6jkFTK4fefoIg/3JIjkDjEaqlJhFPov1jKSJ PYh4Kyb5X1xs/UWjObQkTvQf3NPT7jVKpg/PkSrIE1QjTHcEJ1rL8US2ii2tTUmlPp GaZE9LWtXB8IX0e1VzLxdJrt/DpPnjzEv6Vx7tBhzSJDSwIYvEwEHg/4Xu/FfKfl/t xuOk2otDHeH2A== Date: Fri, 25 Mar 2022 14:48:39 -0700 From: Jakub Kicinski To: Johannes Berg Cc: William McVicker , linux-wireless@vger.kernel.org, Marek Szyprowski , Kalle Valo , "David S. Miller" , netdev@vger.kernel.org, Amitkumar Karwar , Xinming Hu , kernel-team@android.com, Paolo Abeni , Eric Dumazet , Cong Wang , Cong Wang , "Eric W. Biederman" Subject: Re: [BUG] deadlock in nl80211_vendor_cmd Message-ID: <20220325144839.7110fc8d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <46b8555d4cded50bc5573fd9b7dd444021317a6b.camel@sipsolutions.net> References: <0000000000009e9b7105da6d1779@google.com> <99eda6d1dad3ff49435b74e539488091642b10a8.camel@sipsolutions.net> <5d5cf050-7de0-7bad-2407-276970222635@quicinc.com> <19e12e6b5f04ba9e5b192001fbe31a3fc47d380a.camel@sipsolutions.net> <20220325094952.10c46350@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20220325134040.0d98835b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <46b8555d4cded50bc5573fd9b7dd444021317a6b.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-wireless@vger.kernel.org On Fri, 25 Mar 2022 22:25:05 +0100 Johannes Berg wrote: > > > With some suitable commentary, that might also be a reasonable thing? > > > __rtnl_unlock() is actually rather pretty rare, and not exported. > > > > The main use for it seems to be re-locking before loading a module, > > which TBH I have no idea why, is it just a cargo cult or a historical > > thing :S I don't see how letting netdevs leave before _loading_ > > a module makes any difference whatsoever. > > Indeed. > > > The WARN_ON() you suggested up front make perfect sense to me. > > You can also take the definition of net_unlink_todo() out of > > netdevice.h while at it because o_0 > > Heh indeed, what? To be clear - I just meant that it's declaring a static variable in a header, so I doubt that it'll do the right thing unless it's only called from one compilation unit. > But (and now I'll CC even more people...) if we can actually have an > invariant that while RTNL is unlocked the todo list is empty, then we > also don't need rtnl_lock_unregistering_all(), and can remove the > netdev_unregistering_wq, etc., no? > > IOW, I'm not sure why we needed commit 50624c934db1 ("net: Delay > default_device_exit_batch until no devices are unregistering v2"), but I > also have little doubt that we did. > > Ah, no. This isn't about locking in this case, it's literally about > ensuring that free_netdev() has been called in netdev_run_todo()? Yup, multiple contexts sitting independently in netdev_run_todo() and chewing on netdevs is slightly different. destructors of those netdevs could be pointing at memory of a module being unloaded. > Which we don't care about in cfg80211 - we just care about the list > being empty so there's no chance we'll reacquire the RTNL.