aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/status.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-06-01 23:14:59 +0200
committerJohannes Berg <johannes.berg@intel.com>2015-06-02 13:07:59 +0200
commit3b79af973cf42de059d0e90e20fd145d7ed8c5c1 (patch)
tree2b3bd6e6e0f9f579c92cc96e794cfd45bd217524 /net/mac80211/status.c
parentmac80211: copy nl80211 mgmt TX SKB for status (diff)
downloadlinux-dev-3b79af973cf42de059d0e90e20fd145d7ed8c5c1.tar.xz
linux-dev-3b79af973cf42de059d0e90e20fd145d7ed8c5c1.zip
mac80211: stop using pointers as userspace cookies
Even if the pointers are really only accessible to root and used pretty much only by wpa_supplicant, this is still not great; even for debugging it'd be easier to have something that's easier to read and guaranteed to never get reused. With the recent change to make mac80211 create an ack_skb for the mgmt-tx path this becomes possible, only the client probe method needs to also allocate an ack_skb, and we can store the cookie in that skb. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/status.c')
-rw-r--r--net/mac80211/status.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 56b73e012757..67c428735a51 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -471,15 +471,23 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local,
}
if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
+ u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie;
struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_hdr *hdr = (void *)skb->data;
rcu_read_lock();
sdata = ieee80211_sdata_from_skb(local, skb);
- if (sdata)
- cfg80211_mgmt_tx_status(&sdata->wdev,
- (unsigned long)skb,
- skb->data, skb->len,
- acked, GFP_ATOMIC);
+ if (sdata) {
+ if (ieee80211_is_nullfunc(hdr->frame_control) ||
+ ieee80211_is_qos_nullfunc(hdr->frame_control))
+ cfg80211_probe_status(sdata->dev, hdr->addr1,
+ cookie, acked,
+ GFP_ATOMIC);
+ else
+ cfg80211_mgmt_tx_status(&sdata->wdev, cookie,
+ skb->data, skb->len,
+ acked, GFP_ATOMIC);
+ }
rcu_read_unlock();
dev_kfree_skb_any(skb);
@@ -499,11 +507,8 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local,
if (dropped)
acked = false;
- if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
- IEEE80211_TX_INTFL_MLME_CONN_TX) &&
- !info->ack_frame_id) {
+ if (info->flags & IEEE80211_TX_INTFL_MLME_CONN_TX) {
struct ieee80211_sub_if_data *sdata;
- u64 cookie = (unsigned long)skb;
rcu_read_lock();
@@ -525,10 +530,6 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local,
ieee80211_mgd_conn_tx_status(sdata,
hdr->frame_control,
acked);
- } else if (ieee80211_is_nullfunc(hdr->frame_control) ||
- ieee80211_is_qos_nullfunc(hdr->frame_control)) {
- cfg80211_probe_status(sdata->dev, hdr->addr1,
- cookie, acked, GFP_ATOMIC);
} else {
/* we assign ack frame ID for the others */
WARN_ON(1);