mac80211: Prevent unregistering of unregistered hw
PATCH v2 1/1 mac80211: Prevent unregistering of unregistered hw
At the moment it is possible to call ieee80211_unregister_hw() for an unregistered hw structure. This will cause a big panic. This patch will add a BUG_ON() line to warn about this situation.
---
net/mac80211/ieee80211.c +3 -0
@@ -4765,6 +4765,9 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)/* TODO: skb_queue should be empty here, no need to do anything? */ rtnl_lock (); + +BUG_ON (local->reg_state !=IEEE80211_DEV_REGISTERED ); + local->reg_state =IEEE80211_DEV_UNREGISTERED ;if (local->apdev)ieee80211_if_del_mgmt (local);
Johannes Berg
maintainernet/mac80211/ieee80211.c void ieee80211_unregister_hw(struct ieee80211_hw *hw) · line 4770
Quoted 11 lines · Ivo van Doorn
net/mac80211/ieee80211.c +3
-0@@ -4765,6 +4765,9 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)/* TODO: skb_queue should be empty here, no need to do anything? */ rtnl_lock (); + +BUG_ON (local->reg_state !=IEEE80211_DEV_REGISTERED ); +
Hm. Maybe that's better since then there's no race like in my patch. Use this one instead of mine please. But it does kill the system pretty badly if you BUG_ON with rtnl held :)
johannes
Jiri Benc
AppliedQuoted 3 lines · Johannes Berg
Hm. Maybe that's better since then there's no race like in my patch. Use this one instead of mine please. But it does kill the system pretty badly if you
BUG_ONwith rtnl held :)
Who cares? ;-)
Applied, thanks for the patch.
Jiri
Signature · 2 lines
Jiri Benc SUSE Labs
Quoted 9 lines · Johannes Berg
Quoted 7 lines · Ivo van Doorn
net/mac80211/ieee80211.c +0
-0@@ -4765,6 +4765,9 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)/* TODO: skb_queue should be empty here, no need to do anything? */
Quoted 8 lines
net/mac80211/ieee80211.c void ieee80211_unregister_hw(struct ieee80211_hw *hw) · line 4770
Quoted 4 lines
net/mac80211/ieee80211.c +3
-0rtnl_lock (); + +BUG_ON (local->reg_state !=IEEE80211_DEV_REGISTERED ); +Hm. Maybe that's better since then there's no race like in my patch. Use this one instead of mine please. But it does kill the system pretty badly if you
BUG_ONwith rtnl held :)
Well it would increase motivation to fix such a bug in the driver then. ;) (yes, fixing that bug in rt2x00 is on my todo list :P)
Ivo