Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247635
b: refs/heads/master
c: 5c0c364
h: refs/heads/master
i:
  247633: ae414b2
  247631: 0613791
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed May 12, 2011
1 parent e2fefb2 commit 7ca2726
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 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: dea4096bc41a9642039840ced91e585d04883a16
refs/heads/master: 5c0c36412b2dc6b1e243c7e9115306fe286583b7
38 changes: 15 additions & 23 deletions trunk/net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,14 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
u8 key_idx, bool pairwise, const u8 *mac_addr)
{
struct ieee80211_sub_if_data *sdata;
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
struct ieee80211_key *key = NULL;
int ret;

sdata = IEEE80211_DEV_TO_SUB_IF(dev);

mutex_lock(&sdata->local->sta_mtx);
mutex_lock(&local->sta_mtx);
mutex_lock(&local->key_mtx);

if (mac_addr) {
ret = -ENOENT;
Expand All @@ -175,33 +176,24 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
if (!sta)
goto out_unlock;

if (pairwise) {
if (sta->ptk) {
ieee80211_key_free(sdata->local, sta->ptk);
ret = 0;
}
} else {
if (sta->gtk[key_idx]) {
ieee80211_key_free(sdata->local,
sta->gtk[key_idx]);
ret = 0;
}
}

goto out_unlock;
}
if (pairwise)
key = sta->ptk;
else
key = sta->gtk[key_idx];
} else
key = sdata->keys[key_idx];

if (!sdata->keys[key_idx]) {
if (!key) {
ret = -ENOENT;
goto out_unlock;
}

ieee80211_key_free(sdata->local, sdata->keys[key_idx]);
WARN_ON(sdata->keys[key_idx]);
__ieee80211_key_free(key);

ret = 0;
out_unlock:
mutex_unlock(&sdata->local->sta_mtx);
mutex_unlock(&local->key_mtx);
mutex_unlock(&local->sta_mtx);

return ret;
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/net/mac80211/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,11 @@ int ieee80211_key_link(struct ieee80211_key *key,
return ret;
}

static void __ieee80211_key_free(struct ieee80211_key *key)
void __ieee80211_key_free(struct ieee80211_key *key)
{
if (!key)
return;

/*
* Replace key with nothingness if it was ever used.
*/
Expand All @@ -486,9 +489,6 @@ static void __ieee80211_key_free(struct ieee80211_key *key)
void ieee80211_key_free(struct ieee80211_local *local,
struct ieee80211_key *key)
{
if (!key)
return;

mutex_lock(&local->key_mtx);
__ieee80211_key_free(key);
mutex_unlock(&local->key_mtx);
Expand Down
1 change: 1 addition & 0 deletions trunk/net/mac80211/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
int __must_check ieee80211_key_link(struct ieee80211_key *key,
struct ieee80211_sub_if_data *sdata,
struct sta_info *sta);
void __ieee80211_key_free(struct ieee80211_key *key);
void ieee80211_key_free(struct ieee80211_local *local,
struct ieee80211_key *key);
void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
Expand Down

0 comments on commit 7ca2726

Please sign in to comment.