Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4075264ybb; Mon, 6 Apr 2020 23:43:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKacc2T8AoMVYSDs0rhdiesWabmm+OsYthQfkBvPxlqWNfoqR5S3vwCWUhIYRkZxlC4YFNn X-Received: by 2002:a05:6830:1d95:: with SMTP id y21mr409904oti.180.1586241813956; Mon, 06 Apr 2020 23:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586241813; cv=none; d=google.com; s=arc-20160816; b=gvTp+T8/NbuOUsPdmfEXi5FYM9JwoT3wDqk7+tMhsh9RZsEVarWvHQNl4UHM9fuUEc QF1xEZtEXUTGvqxmyr/Ko5Hzy51YDIMIlHCMVfdv39kwIXDaFkkJ+alF8XRgqeYBZotE FW/GeEsOIJ/RUF/jBjrS+xA+ZLe4YgsBGFRDk6F+pVC36ETNRnlfExvLqa+0Vm9+ZfGq QQU8WZKhIEe4KzR5czSji+fzSvau1IoMVN8BGoON8DE5sI6iLunsWBXgkMZwZAtTTzsh 6XEWZjZMAO6KSa75iCtajMIXQi8yUP+D8uAFHMA7OZuAKVz4VKLnGgn71IV7YPUnDcv7 54aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OivOvN/o8gD1CI0/RRvNf9QuUqmaxYvN8Wf6SB8cHhk=; b=dTCVhKP6p03x62D34AuNvVt/Qjiv1l55m8qfRuRwDa0afygQHWRxZXA1+V+WwLT/Ph QkSdAJwFwWn+bbZ9xFZXa1CqDUSXoLbZvQxIBLL/yV4ACkiCC9rsBZrk2vDJKeDy3Bbu M8Y5tdK53BE9EGCn4QBMoNZiAlfWqF+6FdTdi8sz54504fXHOnqb/TrSh9fr/DbYMTZQ t/o1TZPAgnJM7PQqYdTXltCu5wh/7ZA+IBHrCAD7Lp995UZ9VtPlWQRgVm2/C3SeosWB t6qgBGSoF12A4MPo6wLfo7oKEDgwHWsKNpq7PAQ0jVNVhq5FT3V1xi7fxcze4RpBFbZ0 xRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mxhMTlXa; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si1002765otf.226.2020.04.06.23.43.13; Mon, 06 Apr 2020 23:43:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mxhMTlXa; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbgDGGnJ (ORCPT + 99 others); Tue, 7 Apr 2020 02:43:09 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:39608 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726808AbgDGGnJ (ORCPT ); Tue, 7 Apr 2020 02:43:09 -0400 Received: by mail-lf1-f65.google.com with SMTP id m2so1453435lfo.6 for ; Mon, 06 Apr 2020 23:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OivOvN/o8gD1CI0/RRvNf9QuUqmaxYvN8Wf6SB8cHhk=; b=mxhMTlXaTWQOfj6UOAJK4K+XlKKUSLakafb8CAFJsq1PQC/hBcA34JiOdrRqMJnEGY ZgjnmOq44EvutBSgvMEnI95N8byxPCRJrAQFbIeKRQJu/Qq7syLFZ5eeo/mkoJ0xiomK sroYl33qPbntRAwCjfoihnS4GB4I3d7CCYOLRvo34xM5Vig70FEiQ06yE4gHt1fn+Qi6 j6YiDyx3W5KTvI6MfhE/HaT0Dh54hpqJOxM2y/n3BlNZ/SrYsHSspdl0LwTFTUtJNNyw atB/jqPqTClkM282cfExVVnAxn5RwZfRtKpZKLMyq61mPupJy7ebVlNytIawKcZrxDCl uS1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OivOvN/o8gD1CI0/RRvNf9QuUqmaxYvN8Wf6SB8cHhk=; b=kh/3pJjIsgtwRknN5RkCEL85VCMRYgO6yClYz1qyV5fn/73D4v0tBltcJyj/NELcqy uygiGKaR+FwYK7gUlPViiD6Jxw8vIlhmoe4lMoD2NnuoCte7w4Hw99DY1d/7VTeLdtus AjcVB79Gv9vpagpGd68mHz0BbzLI2PHmkgPRgtaXEEIl/meeMQV8c3i85P0DPW89sgnQ LY5UiHmYBniNhQ5mJF2FYTRhFWuOULvQwro7VikvRv6dlpFqEw11O2OrT/dbYiVBjY1c mw/trIvBJJoCY89xpGovZmeZjs3NJ5GMJsoPrOQ0qlykXM0y88QpCgXadQuQTYW9eeYk gmWg== X-Gm-Message-State: AGi0PuYGW26NP+hv8Otto/7P/VanRxtUP4zGLerQmxqiMJrNomGyJtYN QgQWD5Rae22o0P5jB8I72TPrYrIcwM1wdBoMM/8tXQ== X-Received: by 2002:ac2:5c07:: with SMTP id r7mr552282lfp.160.1586241786676; Mon, 06 Apr 2020 23:43:06 -0700 (PDT) MIME-Version: 1.0 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> <35cadbaff1239378c955014f9ad491bc68dda028.camel@sipsolutions.net> <5575dfe84aa745a3c2a61e240c3d150dc8d9446f.camel@sipsolutions.net> In-Reply-To: From: Sumit Garg Date: Tue, 7 Apr 2020 12:12:54 +0530 Message-ID: Subject: Re: [PATCH] mac80211: fix race in ieee80211_register_hw() To: Krishna Chaitanya , Johannes Berg Cc: Kalle Valo , linux-wireless , "David S. Miller" , kuba@kernel.org, netdev , Linux Kernel Mailing List , =?UTF-8?Q?Matthias=2DPeter_Sch=C3=B6pfer?= , "Berg Philipp (HAU-EDS)" , "Weitner Michael (HAU-EDS)" , Daniel Thompson , Loic Poulain , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, 6 Apr 2020 at 23:39, Krishna Chaitanya wrote: > > On Mon, Apr 6, 2020 at 8:36 PM Johannes Berg wrote: > > > > On Mon, 2020-04-06 at 19:55 +0530, Krishna Chaitanya wrote: > > > > > > iw phy0 interface add wlan0 type station > > > > ip link set wlan0 up > > > Ah okay, got it, thanks. Very narrow window though :-) as the > > > alloc_ordered_workqueue > > > doesn't need RTNL and there is a long way to go to do if_add() from > > > user and setup > > > the driver for interrupts. > > > > True, I do wonder how this is hit. Maybe something with no preempt and a > > uevent triggering things? The crash is reproducible while working with iwd [1] which is basically a wireless daemon. It can be started as "iwd.service" during boot that can detect wiphy registration events and configure interfaces. Have a look at this text [2] from iwd manager. To have a simple reproducer, please have a look at this trigger script [3] from Matthias in CC. With this script I am able to reproduce the kernel crash with approx. frequency of 1/10 across reboots on dragonboard 410c. There is nothing special like no preempt. [1] https://wiki.archlinux.org/index.php/Iwd [2] https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/src/manager.c#n563 [3] https://github.com/DasRoteSkelett/meta-iwd/blob/master/recipes-trigger/trigger/trigger/trigger.sh > Probably, it might be specific to the dragonboard410c configuration > As described above, it isn't specific to any dragonboard 410c configuration and one should be able to reproduce it on other boards too using iwd depending on how long it takes to start corresponding wiphy device. > > > Again depends on the driver though, it > > > should properly handle > > > pending ieee80211_register_hw() with start(). > > > It could, but it'd be really tricky. Much better to fix mac80211. +1 -Sumit > Sure, anyways it is a good change.