]> git.baikalelectronics.ru Git - kernel.git/commit
cfg80211: fix netdev registration deadlock
authorJohannes Berg <johannes.berg@intel.com>
Mon, 1 Feb 2021 18:20:50 +0000 (19:20 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 1 Feb 2021 18:30:54 +0000 (19:30 +0100)
commit3b6d5578cdfc62ddec7c65eb76660c54587e5d85
treefd01bc1a23dd89442544f2e9e56dd13269cdb00f
parentb55dbd626802fb6a5a193e59a9bdd73bbd8757e0
cfg80211: fix netdev registration deadlock

If register_netdevice() fails after having called cfg80211's
netdev notifier (cfg80211_netdev_notifier_call) it will call
the notifier again with UNREGISTER. This would then lock the
wiphy mutex because we're marked as registered, which causes
a deadlock.

Fix this by separately keeping track of whether or not we're
in the middle of registering to also skip the notifier call
on this unregister.

Reported-by: syzbot+2ae0ca9d7737ad1a62b7@syzkaller.appspotmail.com
Fixes: 03d71e9f6564 ("cfg80211: avoid holding the RTNL when calling the driver")
Link: https://lore.kernel.org/r/20210201192048.ed8bad436737.I7cae042c44b15f80919a285799a15df467e9d42d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/core.c