Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D907C433FE for ; Fri, 25 Mar 2022 20:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbiCYUXD (ORCPT ); Fri, 25 Mar 2022 16:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232209AbiCYUXC (ORCPT ); Fri, 25 Mar 2022 16:23:02 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1480C5DA69; Fri, 25 Mar 2022 13:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=b5wJQQ7YqCa3aFhJqIL39US+IJSbvv4VXqtaGEmA6ik=; t=1648239685; x=1649449285; b=CXFnQ8EcqIPxkIZDl6uyj8xPm1TCgANxFC5vmJMRmEWlEim zD7Mp0BhY9R79BpE9noxVMnq12N/vFVsqQXQqll877EK9buQnWPJg4I+qkO8n/wRxkBcUt29e+ttQ DOpMvboK5z2JSvdTqjAcEgrjJ21naFa75Y8Yg+162bhOhHlmW1/YTFtV1JrjWKiqx5Q8pEL9xXZKz HzofRBD+2TlvuyhuTXK5EQiTbqPXh7YAzcgA9RrsngnWvAb/S1HTx4YQngVHNQFGQkmIR5ZgmcBS9 Crpq8b79thPjsJEOS8DGPiEqqdxNubU1eyVgR7XfILisUl3W6I0jISQzm1yyGpvw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nXqQq-000UKo-TY; Fri, 25 Mar 2022 21:21:12 +0100 Message-ID: Subject: Re: [BUG] deadlock in nl80211_vendor_cmd From: Johannes Berg To: William McVicker Cc: Jakub Kicinski , linux-wireless@vger.kernel.org, Marek Szyprowski , Kalle Valo , "David S. Miller" , netdev@vger.kernel.org, Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , kernel-team@android.com, Paolo Abeni Date: Fri, 25 Mar 2022 21:21:11 +0100 In-Reply-To: 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> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, 2022-03-25 at 18:08 +0000, William McVicker wrote: > > I'm able to reproduce this issue pretty easily with a Pixel 6 when I add > support to allow vendor commands to request for the RTNL.  > Hm, wait, which of the two issues? > For this case, I just > delay unlocking the RTNL until nl80211_vendor_cmds() at which point I check the > flags to see if I should unlock before calling doit(). That allows me to run my > tests again and hit this issue. I imagine that I could hit this issue without > any changes if I re-work my vendor ops to not need the RTNL. What are the vendor ops doing though? If they're actually unregistering a netdev - which I believe you mentioned earlier - then that's quite clearly going to cause an issue, if you unlock RTNL while the wiphy mutex is still held. If not, then I don't see right now how you'd be able to trigger any issue here at all. The original issue - that you rtnl_lock() yourself while the wiphy mutex is held - can't happen anymore with your rework I guess. johannes