Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3335703ybb; Mon, 6 Apr 2020 07:02:16 -0700 (PDT) X-Google-Smtp-Source: APiQypJz3y8WT47x8CbbpKihbY3ESluzPkR5MbesD0MmCqrEa2YvliO0BtPAwrJeLq4JAfbYoNeJ X-Received: by 2002:a05:6830:1159:: with SMTP id x25mr7623145otq.110.1586181736151; Mon, 06 Apr 2020 07:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586181736; cv=none; d=google.com; s=arc-20160816; b=uitdSRirMISV/f/b5gKLrPx0Txcr5n2DolrqRHHzGU1OA88b5u/ZuD07hTNXCMaqJB FoE4+ohGeE/h2Wr3VEqnJRh9mB6BI5pOQ8XTir1uS2XZZgfzi2AONV3pJCXjI4z7VYsq aAc3rA5TfWVWzN2CWV7iXwmGT+r01P5gYx0z9NuN/traBEMpLLARxp+pXYoUp1wANmlk KVM/2Tb3jcD5MWSiHnlZSQYnAqzEJgDUPY5PW94p5JCbW6Z18QIwPQXbhsx/soqokHCu xAMc/OlEyKzT6RSrSPkAZHxCT6H3m8s/etk5n1TxRDsbLU0BygPSOjBOmVv02Y+RV5U+ 0WDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=kP69HSj01iK+2An2nHc3+yi9rqTIO4zCMFh1Z0sYqSE=; b=KefsDt8LkSkzi/81QyU5VSoKePVgcmVyk/5wmDe/+uPAjHaJCpIzZlxytjLpRUqZSV y1swaP/g0AfnF2Z6Xmol+/jlbTznhWP4dAFaMSfRCfw04/yer4c+aRUvlVSpqW67Sm1c mV8rnYxFeMVd2n7iCO7EFpDAt6c75nZgulE5BSZ9j96/XOfYP3yiB30ooF6tNjzJakpy nP30ha1L0lNHHPYvJWl1iEeAwBIPZZGayMUuhM+4oste/Lc2nFTukmNl1L5lm04EZQ8C 8sTtLEEdIPpgoOKA5G468hKDwK2kjukjn1r0j8NumoNlCMG+nGudheHtkgUSnaSWHICm gaxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si7786632ooc.16.2020.04.06.07.01.57; Mon, 06 Apr 2020 07:02:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728562AbgDFOBe (ORCPT + 99 others); Mon, 6 Apr 2020 10:01:34 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:59186 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgDFOBe (ORCPT ); Mon, 6 Apr 2020 10:01:34 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jLSJI-009wY9-PS; Mon, 06 Apr 2020 16:01:08 +0200 Message-ID: <35cadbaff1239378c955014f9ad491bc68dda028.camel@sipsolutions.net> Subject: Re: [PATCH] mac80211: fix race in ieee80211_register_hw() From: Johannes Berg To: Krishna Chaitanya , Kalle Valo Cc: Sumit Garg , linux-wireless , "David S. Miller" , kuba@kernel.org, netdev , Linux Kernel Mailing List , Matthias-Peter =?ISO-8859-1?Q?Sch=F6pfer?= , "Berg Philipp (HAU-EDS)" , "Weitner Michael (HAU-EDS)" , Daniel Thompson , Loic Poulain , stable@vger.kernel.org Date: Mon, 06 Apr 2020 16:01:06 +0200 In-Reply-To: (sfid-20200406_155543_424615_2CB4AD8F) References: <1586175677-3061-1-git-send-email-sumit.garg@linaro.org> <87ftdgokao.fsf@tynnyri.adurom.net> <1e352e2130e19aec5aa5fc42db397ad50bb4ad05.camel@sipsolutions.net> <87r1x0zsgk.fsf@kamboji.qca.qualcomm.com> <87imiczrwm.fsf@kamboji.qca.qualcomm.com> <87v9mcycbf.fsf@kamboji.qca.qualcomm.com> (sfid-20200406_155543_424615_2CB4AD8F) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-04-06 at 19:25 +0530, Krishna Chaitanya wrote: > On Mon, Apr 6, 2020 at 6:57 PM Kalle Valo wrote: > > Sumit Garg writes: > > > > > On Mon, 6 Apr 2020 at 18:38, Johannes Berg wrote: > > > > On Mon, 2020-04-06 at 16:04 +0300, Kalle Valo wrote: > > > > > Johannes Berg writes: > > > > > > > > > > > On Mon, 2020-04-06 at 15:52 +0300, Kalle Valo wrote: > > > > > > > Johannes Berg writes: > > > > > > > > > > > > > > > On Mon, 2020-04-06 at 15:44 +0300, Kalle Valo wrote: > > > > > > > > > > user-space ieee80211_register_hw() RX IRQ > > > > > > > > > > +++++++++++++++++++++++++++++++++++++++++++++ > > > > > > > > > > | | | > > > > > > > > > > |<---wlan0---wiphy_register() | > > > > > > > > > > |----start wlan0---->| | > > > > > > > > > > | |<---IRQ---(RX packet) > > > > > > > > > > | Kernel crash | > > > > > > > > > > | due to unallocated | > > > > > > > > > > | workqueue. | > > > > > > > > > > > > > > > > [snip] > > > > > > > > > > > > > > > > > I have understood that no frames should be received until mac80211 calls > > > > > > > > > struct ieee80211_ops::start: > > > > > > > > > > > > > > > > > > * @start: Called before the first netdevice attached to the hardware > > > > > > > > > * is enabled. This should turn on the hardware and must turn on > > > > > > > > > * frame reception (for possibly enabled monitor interfaces.) > > > > > > > > > > > > > > > > True, but I think he's saying that you can actually add and configure an > > > > > > > > interface as soon as the wiphy is registered? > > > > > > > > > > > > > > With '<---IRQ---(RX packet)' I assumed wcn36xx is delivering a frame to > > > > > > > mac80211 using ieee80211_rx(), but of course I'm just guessing here. > > > > > > > > > > > > Yeah, but that could be legitimate? > > > > > > > > > > Ah, I misunderstood then. The way I have understood is that no rx frames > > > > > should be delivered (= calling ieee80211_rx()_ before start() is called, > > > > > but if that's not the case please ignore me :) > > > > > > > > No no, that _is_ the case. But I think the "start wlan0" could end up > > > > calling it? > I am still confused, without ieee80211_if_add how can the userspace > bring up the interface? It can add its own interface. Maybe that won't be 'wlan0' but something else? like iw phy0 interface add wlan0 type station ip link set wlan0 up johannes