Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3290372ybb; Mon, 6 Apr 2020 06:08:55 -0700 (PDT) X-Google-Smtp-Source: APiQypLmB45NBjz8F8NYurw0luhXmVQcXFIvwh65ToFFguLEz3Qo+BmfRCZL82AAWxWxGM24by+p X-Received: by 2002:a9d:24a4:: with SMTP id z33mr17728201ota.105.1586178535207; Mon, 06 Apr 2020 06:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586178535; cv=none; d=google.com; s=arc-20160816; b=jzatZFlsd1nXIXC8FYhEi8SBEMzW8zu/ZDdf7UNchUiMlGzFSi9HOALa19FK6AD6xJ 2aX7IgwPz6nvjIgfP1vMM3D5PO3XAAu+Ci/CTgQkOnWl7CPuu7w+2VSfiwPDXDOOy3Or zI4UM2WRRJivqGQyk2rPhRH/7GRARPpebo/M3E2pmhGyZPPjOe1MIKtcoaMZpN6cPsaW rJ641M0bbmUqE6q4LHwTdG6OjytPNRQ0+134x/LbG4LFt+kLoSqW43sQek6FgZmsGWcL alsTG5nac5l3LC9qpEStbTZ3/7qQlZY9/HNMxkw6EiMTVN9kVLJDq/gXQbz28tMPbwLA 1I7Q== 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=A/JbFTChbnWXuGtLf1v7YhSZIvOpdugF62GtlAyh7lQ=; b=lPVrWGf45GVQoQHwpu8VvuVIfnxNMUgHMVlZ6oXJ0aF0SY9GjYmJCfxsWMOxEqe9ln hOjRW8CpYD4dP9K1Q5FTYVuw4HNnpKASOoqTK4BzCUpOK4vD8wpyQRG32HDjBkiu5LWU eDSzkAs7apbALBvBAZZsxGustJk7CSE/T5YSOAwOi56AdzEaX7dNvuCT7TN2YzjSg2n9 aevetJ9eGJtKujOs51ZHE902wHUeuVUdZkbtJ5O4xgG+pQgWQwkNb6Tmz7+RipXZxNMQ 5sBlWViRxDZqF4Js0kFVBPFdS9P8NC7frwmestuVONHyq5YzePP+FsVgHMfE5S4esH1g e0Rg== 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 w15si8104787oth.84.2020.04.06.06.08.41; Mon, 06 Apr 2020 06:08:55 -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 S1728262AbgDFNIG (ORCPT + 99 others); Mon, 6 Apr 2020 09:08:06 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:58226 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728154AbgDFNIF (ORCPT ); Mon, 6 Apr 2020 09:08:05 -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 1jLRTq-009oJ0-Nc; Mon, 06 Apr 2020 15:07:58 +0200 Message-ID: Subject: Re: [PATCH] mac80211: fix race in ieee80211_register_hw() From: Johannes Berg To: Kalle Valo Cc: Sumit Garg , linux-wireless@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, matthias.schoepfer@ithinx.io, Philipp.Berg@liebherr.com, Michael.Weitner@liebherr.com, daniel.thompson@linaro.org, loic.poulain@linaro.org, stable@vger.kernel.org Date: Mon, 06 Apr 2020 15:07:57 +0200 In-Reply-To: <87imiczrwm.fsf@kamboji.qca.qualcomm.com> 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> 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 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? johannes