]> git.baikalelectronics.ru Git - kernel.git/commit
cfg80211: initialize wdev data earlier
authorJohannes Berg <johannes.berg@intel.com>
Fri, 9 Oct 2020 11:58:22 +0000 (13:58 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 30 Oct 2020 09:03:59 +0000 (10:03 +0100)
commitd62bc4ee4461f6f206072a6a69c8970c833bd173
treecce51892def0ea5e22ea5631ed5f3679aa03519d
parent7a3133bd86e5552c01fbe2b9851b9074201e4279
cfg80211: initialize wdev data earlier

There's a race condition in the netdev registration in that
NETDEV_REGISTER actually happens after the netdev is available,
and so if we initialize things only there, we might get called
with an uninitialized wdev through nl80211 - not using a wdev
but using a netdev interface index.

I found this while looking into a syzbot report, but it doesn't
really seem to be related, and unfortunately there's no repro
for it (yet). I can't (yet) explain how it managed to get into
cfg80211_release_pmsr() from nl80211_netlink_notify() without
the wdev having been initialized, as the latter only iterates
the wdevs that are linked into the rdev, which even without the
change here happened after init.

However, looking at this, it seems fairly clear that the init
needs to be done earlier, otherwise we might even re-init on a
netns move, when data might still be pending.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20201009135821.fdcbba3aad65.Ie9201d91dbcb7da32318812effdc1561aeaf4cdc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c
net/wireless/core.h
net/wireless/nl80211.c