aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/cfg80211.h4
-rw-r--r--net/wireless/scan.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1e008cddd41d..5f6e98ad21a2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3893,7 +3893,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
3893 * cfg80211_find_vendor_ie - find vendor specific information element in data 3893 * cfg80211_find_vendor_ie - find vendor specific information element in data
3894 * 3894 *
3895 * @oui: vendor OUI 3895 * @oui: vendor OUI
3896 * @oui_type: vendor-specific OUI type 3896 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
3897 * @ies: data consisting of IEs 3897 * @ies: data consisting of IEs
3898 * @len: length of data 3898 * @len: length of data
3899 * 3899 *
@@ -3905,7 +3905,7 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
3905 * Note: There are no checks on the element length other than having to fit into 3905 * Note: There are no checks on the element length other than having to fit into
3906 * the given data. 3906 * the given data.
3907 */ 3907 */
3908const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 3908const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
3909 const u8 *ies, int len); 3909 const u8 *ies, int len);
3910 3910
3911/** 3911/**
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index abdf651a70d9..ef2955c89a00 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -364,13 +364,16 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
364} 364}
365EXPORT_SYMBOL(cfg80211_find_ie); 365EXPORT_SYMBOL(cfg80211_find_ie);
366 366
367const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 367const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
368 const u8 *ies, int len) 368 const u8 *ies, int len)
369{ 369{
370 struct ieee80211_vendor_ie *ie; 370 struct ieee80211_vendor_ie *ie;
371 const u8 *pos = ies, *end = ies + len; 371 const u8 *pos = ies, *end = ies + len;
372 int ie_oui; 372 int ie_oui;
373 373
374 if (WARN_ON(oui_type > 0xff))
375 return NULL;
376
374 while (pos < end) { 377 while (pos < end) {
375 pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos, 378 pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos,
376 end - pos); 379 end - pos);
@@ -386,7 +389,8 @@ const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
386 goto cont; 389 goto cont;
387 390
388 ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2]; 391 ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2];
389 if (ie_oui == oui && ie->oui_type == oui_type) 392 if (ie_oui == oui &&
393 (oui_type < 0 || ie->oui_type == oui_type))
390 return pos; 394 return pos;
391cont: 395cont:
392 pos += 2 + ie->len; 396 pos += 2 + ie->len;