aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-26 08:27:23 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:11 -0400
commit5b2812e925c8e976852867f8d760637c5926d817 (patch)
tree5e8ba3ec4fa8273822334eb64bb899a0b3afcbd3 /net/mac80211/ieee80211.c
parentb4219952356baa162368f2f5dab6421a5dbc5e15 (diff)
[PATCH] mac80211: fix interface initialisation and deinitialisation
When an interface is registered it is still uninitialised so ieee80211_if_reinit() can't be called on it (it will oops.) Hence, we need to move the uninit method assignment. Also, this patch fixes the bug that the master device is never initialised nor deinitialised at all. Oddly, the deinit code had an if statement to not run some code when running for the master interface (which never happened), but that if statement is also wrong. Fix that too. Now that the uninit code is run for the master device, another bug surfaced: it tries to remove all dependent interfaces and that oopses or BUGs at some point, either because it unregisters already unregistered interfaces (missing list_del bug) or due to trying to iterate a list that has had other things removed. Fix this too by handling the master interface specially. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211.c')
-rw-r--r--net/mac80211/ieee80211.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index ccf84634f156..52638194e45f 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -265,7 +265,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev)
265 dev->open = ieee80211_mgmt_open; 265 dev->open = ieee80211_mgmt_open;
266 dev->stop = ieee80211_mgmt_stop; 266 dev->stop = ieee80211_mgmt_stop;
267 dev->type = ARPHRD_IEEE80211_PRISM; 267 dev->type = ARPHRD_IEEE80211_PRISM;
268 dev->uninit = ieee80211_if_reinit;
269 dev->destructor = ieee80211_if_free; 268 dev->destructor = ieee80211_if_free;
270} 269}
271 270
@@ -551,7 +550,6 @@ void ieee80211_if_setup(struct net_device *dev)
551 dev->change_mtu = ieee80211_change_mtu; 550 dev->change_mtu = ieee80211_change_mtu;
552 dev->open = ieee80211_open; 551 dev->open = ieee80211_open;
553 dev->stop = ieee80211_stop; 552 dev->stop = ieee80211_stop;
554 dev->uninit = ieee80211_if_reinit;
555 dev->destructor = ieee80211_if_free; 553 dev->destructor = ieee80211_if_free;
556} 554}
557 555
@@ -1242,6 +1240,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1242 goto fail_dev; 1240 goto fail_dev;
1243 1241
1244 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); 1242 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
1243 ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP);
1245 1244
1246 result = ieee80211_init_rate_ctrl_alg(local, NULL); 1245 result = ieee80211_init_rate_ctrl_alg(local, NULL);
1247 if (result < 0) { 1246 if (result < 0) {
@@ -1346,8 +1345,22 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
1346 * because the driver cannot be handing us frames any 1345 * because the driver cannot be handing us frames any
1347 * more and the tasklet is killed. 1346 * more and the tasklet is killed.
1348 */ 1347 */
1349 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) 1348
1349 /*
1350 * First, we remove all non-master interfaces. Do this because they
1351 * may have bss pointer dependency on the master, and when we free
1352 * the master these would be freed as well, breaking our list
1353 * iteration completely.
1354 */
1355 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
1356 if (sdata->dev == local->mdev)
1357 continue;
1358 list_del(&sdata->list);
1350 __ieee80211_if_del(local, sdata); 1359 __ieee80211_if_del(local, sdata);
1360 }
1361
1362 /* then, finally, remove the master interface */
1363 __ieee80211_if_del(local, IEEE80211_DEV_TO_SUB_IF(local->mdev));
1351 1364
1352 rtnl_unlock(); 1365 rtnl_unlock();
1353 1366