[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABPxzY++YMBPTV4quAkYvEAMfULjMXLkVfNzwocwubno5HO2Bw@mail.gmail.com>
Date: Mon, 6 Apr 2020 19:55:40 +0530
From: Krishna Chaitanya <chaitanya.mgit@...il.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: Kalle Valo <kvalo@...eaurora.org>,
Sumit Garg <sumit.garg@...aro.org>,
linux-wireless <linux-wireless@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>, kuba@...nel.org,
netdev <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Matthias-Peter Schöpfer
<matthias.schoepfer@...inx.io>,
"Berg Philipp (HAU-EDS)" <Philipp.Berg@...bherr.com>,
"Weitner Michael (HAU-EDS)" <Michael.Weitner@...bherr.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
Loic Poulain <loic.poulain@...aro.org>, stable@...r.kernel.org
Subject: Re: [PATCH] mac80211: fix race in ieee80211_register_hw()
On Mon, Apr 6, 2020 at 7:31 PM Johannes Berg <johannes@...solutions.net> wrote:
>
> On Mon, 2020-04-06 at 19:25 +0530, Krishna Chaitanya wrote:
> > On Mon, Apr 6, 2020 at 6:57 PM Kalle Valo <kvalo@...eaurora.org> wrote:
> > > Sumit Garg <sumit.garg@...aro.org> writes:
> > >
> > > > On Mon, 6 Apr 2020 at 18:38, Johannes Berg <johannes@...solutions.net> wrote:
> > > > > On Mon, 2020-04-06 at 16:04 +0300, Kalle Valo wrote:
> > > > > > Johannes Berg <johannes@...solutions.net> writes:
> > > > > >
> > > > > > > On Mon, 2020-04-06 at 15:52 +0300, Kalle Valo wrote:
> > > > > > > > Johannes Berg <johannes@...solutions.net> 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
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. Again depends on the driver though, it
should properly handle
pending ieee80211_register_hw() with start().
Powered by blists - more mailing lists