Commit a40a8c17 authored by Bob Copeland's avatar Bob Copeland Committed by Johannes Berg

mac80211: fix mesh_add_rsn_ie IE finding loop

Previously, the code to copy the RSN IE from the mesh config
would increment its pointer by one in the loop instead of by
the element length, so there was the potential for mistaking
another IE's data fields as the RSN IE.

cfg80211_find_ie() exists, so just use that.
Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent aee6499c
...@@ -366,20 +366,15 @@ int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) ...@@ -366,20 +366,15 @@ int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
return 0; return 0;
/* find RSN IE */ /* find RSN IE */
data = ifmsh->ie; data = cfg80211_find_ie(WLAN_EID_RSN, ifmsh->ie, ifmsh->ie_len);
while (data < ifmsh->ie + ifmsh->ie_len) { if (!data)
if (*data == WLAN_EID_RSN) { return 0;
len = data[1] + 2;
break;
}
data++;
}
if (len) { len = data[1] + 2;
if (skb_tailroom(skb) < len)
return -ENOMEM; if (skb_tailroom(skb) < len)
memcpy(skb_put(skb, len), data, len); return -ENOMEM;
} memcpy(skb_put(skb, len), data, len);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment