Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362038
b: refs/heads/master
c: 8b30578
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg committed Mar 20, 2013
1 parent 9ca5eef commit 67f3d76
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ce1eadda6badef9e4e3460097ede674fca47383d
refs/heads/master: 8b305780ed0c49a49c6bd58a4372fd6b22a5a71e
35 changes: 19 additions & 16 deletions trunk/net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,19 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata)
static int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
{
struct ieee80211_sub_if_data *sdata;
int ret = 0;
int ret;

if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))
return 0;

mutex_lock(&local->iflist_mtx);
ASSERT_RTNL();

if (local->monitor_sdata)
goto out_unlock;
return 0;

sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, GFP_KERNEL);
if (!sdata) {
ret = -ENOMEM;
goto out_unlock;
}
if (!sdata)
return -ENOMEM;

/* set up data */
sdata->local = local;
Expand All @@ -377,27 +375,28 @@ static int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
if (WARN_ON(ret)) {
/* ok .. stupid driver, it asked for this! */
kfree(sdata);
goto out_unlock;
return ret;
}

ret = ieee80211_check_queues(sdata);
if (ret) {
kfree(sdata);
goto out_unlock;
return ret;
}

ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef,
IEEE80211_CHANCTX_EXCLUSIVE);
if (ret) {
drv_remove_interface(local, sdata);
kfree(sdata);
goto out_unlock;
return ret;
}

mutex_lock(&local->iflist_mtx);
rcu_assign_pointer(local->monitor_sdata, sdata);
out_unlock:
mutex_unlock(&local->iflist_mtx);
return ret;

return 0;
}

static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
Expand All @@ -407,23 +406,27 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))
return;

ASSERT_RTNL();

mutex_lock(&local->iflist_mtx);

sdata = rcu_dereference_protected(local->monitor_sdata,
lockdep_is_held(&local->iflist_mtx));
if (!sdata)
goto out_unlock;
if (!sdata) {
mutex_unlock(&local->iflist_mtx);
return;
}

rcu_assign_pointer(local->monitor_sdata, NULL);
mutex_unlock(&local->iflist_mtx);

synchronize_net();

ieee80211_vif_release_channel(sdata);

drv_remove_interface(local, sdata);

kfree(sdata);
out_unlock:
mutex_unlock(&local->iflist_mtx);
}

/*
Expand Down

0 comments on commit 67f3d76

Please sign in to comment.