Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2135067pxb; Fri, 25 Mar 2022 11:42:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+pcvJfheAcl91oAj6AZlcLhmhv82aGRRRyh3Z16G2aAaNXziRfVXwt2G1ucU2RQyoUvPh X-Received: by 2002:a63:1063:0:b0:382:adf9:e0c9 with SMTP id 35-20020a631063000000b00382adf9e0c9mr705101pgq.508.1648233755570; Fri, 25 Mar 2022 11:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648233755; cv=none; d=google.com; s=arc-20160816; b=PiK2BpxhBeigcSfMnqLXnBLHOC7sUetyTFlxGt+9PxhEtr8gpti2vTMzoeJEgbycIX 10BJGX8fya17zP7YuVK2o5wZKiVGUNBq5G4/jUoH9mJ1G3F+vrJmmsfbSGWWH7iwdGzM eUG1VCLWNrLv/HluP3YSFHXvwP4zJeZBnJZNxXcMMYcUyBTWzFvb+aXvSqUDuZrvFpgv 4wcjaWzXege+EPicSyiC84n0kgk1fWbOX2SKvn3KbTjB6QLk+bsP2s4M1uil5038mluk 4URUZGkTrAkFWg9BI+6sK1xDzqedv73H0NKBATIcxby9+e1hMn1a3p82cby828AO79an hAew== 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:date:cc:to:from:subject :message-id:dkim-signature; bh=yMAPFSA+Ih8GIc2c5GQDeXNSvNCWIB+Ei3ovhBAqMrY=; b=CtOdyn8bIDAi5OGAG4LLg2SGvuItGKsrEtbl84lyHAkB22KYCbKdpXtKq/i7YPAG95 XWDH6X9Nkl4KltbxeB5TaUDT2iPeElsKvwzaAOXvGSaHQMAtnAw8I+vS0TS98Ke0dJlU ij1503iOOzi0tjn2KDluqj9xkQa4PSE1qNmIydiqgMqZR+BlvTHBhUQMN/7itiHl11M6 S02joDbhDPQB6U3yhnHoo4QT8zfCcAbi0inj/Uhfl3FCX4LsIqnNyG0+IzeCqabd9Ty0 pvhNfmjU9ct3pTqkLW/5RsLTK2k+0kak4F4nBjzZP7ImtMgFx/R2GPGzKvPmmR0DEfGq QuBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=t+uoKBJJ; 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=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 131-20020a621989000000b004fa3a8e00adsi3538052pfz.356.2022.03.25.11.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:42:35 -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=@sipsolutions.net header.s=mail header.b=t+uoKBJJ; 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=REJECT dis=NONE) header.from=sipsolutions.net Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B1961925AE; Fri, 25 Mar 2022 10:59:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236383AbiCYQF5 (ORCPT + 70 others); Fri, 25 Mar 2022 12:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359567AbiCYQFz (ORCPT ); Fri, 25 Mar 2022 12:05:55 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B47AB3EAB6 for ; Fri, 25 Mar 2022 09:04:20 -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=yMAPFSA+Ih8GIc2c5GQDeXNSvNCWIB+Ei3ovhBAqMrY=; t=1648224260; x=1649433860; b=t+uoKBJJlsavcxxNdh3XaSC/FCcPqTLoa+87J1BKK7W0FO/ wX8p+79r6pGBrZZugKLhoKu+R+8QJP7Iyu5HJ+sH95cJWDj/mludNHkzWAykddddgbM04NLrCFSl9 v+xg967B6h61FwW8x9zbuiBBRK7KmLKbflY6c6nOYEVo3vYZcW+BqJyPgWn9cagUkpXKmfo1sF4Vc rgbzErfaN39u34EDHVA7/lrlMdFaTWfCDq1GocLAOm1nKISZKqQ4ij2WnRSUBmCwNNKR81djSFWwS KI2GRINATx5lLHi3DDgspN/ld7EdBxU/XqpGCCW2Kwo2gZ3h4KW43uHrva5jLOkw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nXmQC-000PI4-ID; Fri, 25 Mar 2022 17:04:16 +0100 Message-ID: <1c6d5a1f033ef079cef4e3aaf6ead9f946da4db0.camel@sipsolutions.net> Subject: Re: [BUG] deadlock in nl80211_vendor_cmd From: Johannes Berg To: Jeff Johnson , William McVicker Cc: linux-wireless@vger.kernel.org, Marek Szyprowski Date: Fri, 25 Mar 2022 17:04:15 +0100 In-Reply-To: <2b2fa5d9-238a-81fa-8978-94bd9753b73e@quicinc.com> References: <0000000000009e9b7105da6d1779@google.com> <99eda6d1dad3ff49435b74e539488091642b10a8.camel@sipsolutions.net> <5d5cf050-7de0-7bad-2407-276970222635@quicinc.com> <2b2fa5d9-238a-81fa-8978-94bd9753b73e@quicinc.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: 7bit X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,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=no 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, 2022-03-25 at 08:59 -0700, Jeff Johnson wrote: > On 3/25/2022 5:09 AM, Johannes Berg wrote: > > On Tue, 2022-03-22 at 21:58 +0000, William McVicker wrote: > > > > > > It would be nice if nl80211_vendor_cmd() could support taking the RTNL lock if > > > requested via the vendor flags. That would require moving the wiphy lock to > > > nl80211_vendor_cmds() so that it could take the RTNL and wiphy lock in the > > > correct order. Is that something you'd be open to Johannes? > > > > Not very, to be honest. If we had a good use case for it, maybe, but > > you're not even saying quite what the use case is :) > > I believe Will and I are up against the same issues. Out-of-tree Android > drivers use a large number of vendor commands to support the > requirements of the Android framework. Prior to 5.12 these vendor > commands would always be called with the rtnl lock held, and in some > cases the implementation of the vendor commands care about that, > especially when calling back into the kernel. In particular we are faced > with the issue that there are some kernel APIs that require that the > rtnl lock be held, and as a result of the lock infrastructure change we > can no longer call those APIs from vendor commands. That is a pretty > severe limitation to work around. I'm not really sure how sympathetic I am to an out-of-tree use case I cannot even see, and I'd probably consider problematic in the first place :) Your easiest option might be to just patch NL80211_FLAG_NEED_RTNL into your kernel for vendor commands and call it a day? johannes