]> git.baikalelectronics.ru Git - kernel.git/commit
mac80211: shut down interfaces before destroying interface list
authorJohannes Berg <johannes.berg@intel.com>
Wed, 8 Jul 2015 12:41:50 +0000 (15:41 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 17 Jul 2015 09:16:26 +0000 (11:16 +0200)
commit796733b2703c61078f405a2465a0c4efcf67d9bb
tree70a36b93a979d0660e679a3726eb223c7d03a2ef
parentb109801c6cf8ac4d33a20b96ae475b4f16f2ec4f
mac80211: shut down interfaces before destroying interface list

If the hardware is unregistered while interfaces are up, mac80211 will
unregister all interfaces, which in turns causes mac80211 to be called
again to remove them all from the driver and eventually shut down the
hardware.

During this shutdown, however, it's currently already unsafe to iterate
the list of interfaces atomically, as the list is manipulated in an
unsafe manner. This puts an undue burden on the driver - it must stop
all its activities before calling ieee80211_unregister_hw(), while in
the normal stop path it can do all cleanup in the stop method. If, for
example, it's using the iteration during RX for some reason, it would
have to stop RX before unregistering to avoid crashes.

Fix this problem by closing all interfaces before unregistering them.
This will cause the driver stop to have completed before we manipulate
the interface list, and after the driver is stopped *and* has called
ieee80211_unregister_hw() it really musn't be iterating any more as
the memory will be freed as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c