aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/scan.c')
-rw-r--r--net/wireless/scan.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 0798c62e6085..620a4b40d466 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -884,6 +884,7 @@ struct cfg80211_bss*
884cfg80211_inform_bss_width(struct wiphy *wiphy, 884cfg80211_inform_bss_width(struct wiphy *wiphy,
885 struct ieee80211_channel *rx_channel, 885 struct ieee80211_channel *rx_channel,
886 enum nl80211_bss_scan_width scan_width, 886 enum nl80211_bss_scan_width scan_width,
887 enum cfg80211_bss_frame_type ftype,
887 const u8 *bssid, u64 tsf, u16 capability, 888 const u8 *bssid, u64 tsf, u16 capability,
888 u16 beacon_interval, const u8 *ie, size_t ielen, 889 u16 beacon_interval, const u8 *ie, size_t ielen,
889 s32 signal, gfp_t gfp) 890 s32 signal, gfp_t gfp)
@@ -911,21 +912,32 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
911 tmp.pub.beacon_interval = beacon_interval; 912 tmp.pub.beacon_interval = beacon_interval;
912 tmp.pub.capability = capability; 913 tmp.pub.capability = capability;
913 /* 914 /*
914 * Since we do not know here whether the IEs are from a Beacon or Probe 915 * If we do not know here whether the IEs are from a Beacon or Probe
915 * Response frame, we need to pick one of the options and only use it 916 * Response frame, we need to pick one of the options and only use it
916 * with the driver that does not provide the full Beacon/Probe Response 917 * with the driver that does not provide the full Beacon/Probe Response
917 * frame. Use Beacon frame pointer to avoid indicating that this should 918 * frame. Use Beacon frame pointer to avoid indicating that this should
918 * override the IEs pointer should we have received an earlier 919 * override the IEs pointer should we have received an earlier
919 * indication of Probe Response data. 920 * indication of Probe Response data.
920 */ 921 */
921 ies = kmalloc(sizeof(*ies) + ielen, gfp); 922 ies = kzalloc(sizeof(*ies) + ielen, gfp);
922 if (!ies) 923 if (!ies)
923 return NULL; 924 return NULL;
924 ies->len = ielen; 925 ies->len = ielen;
925 ies->tsf = tsf; 926 ies->tsf = tsf;
927 ies->from_beacon = false;
926 memcpy(ies->data, ie, ielen); 928 memcpy(ies->data, ie, ielen);
927 929
928 rcu_assign_pointer(tmp.pub.beacon_ies, ies); 930 switch (ftype) {
931 case CFG80211_BSS_FTYPE_BEACON:
932 ies->from_beacon = true;
933 /* fall through to assign */
934 case CFG80211_BSS_FTYPE_UNKNOWN:
935 rcu_assign_pointer(tmp.pub.beacon_ies, ies);
936 break;
937 case CFG80211_BSS_FTYPE_PRESP:
938 rcu_assign_pointer(tmp.pub.proberesp_ies, ies);
939 break;
940 }
929 rcu_assign_pointer(tmp.pub.ies, ies); 941 rcu_assign_pointer(tmp.pub.ies, ies);
930 942
931 signal_valid = abs(rx_channel->center_freq - channel->center_freq) <= 943 signal_valid = abs(rx_channel->center_freq - channel->center_freq) <=
@@ -982,11 +994,12 @@ cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
982 if (!channel) 994 if (!channel)
983 return NULL; 995 return NULL;
984 996
985 ies = kmalloc(sizeof(*ies) + ielen, gfp); 997 ies = kzalloc(sizeof(*ies) + ielen, gfp);
986 if (!ies) 998 if (!ies)
987 return NULL; 999 return NULL;
988 ies->len = ielen; 1000 ies->len = ielen;
989 ies->tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp); 1001 ies->tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp);
1002 ies->from_beacon = ieee80211_is_beacon(mgmt->frame_control);
990 memcpy(ies->data, mgmt->u.probe_resp.variable, ielen); 1003 memcpy(ies->data, mgmt->u.probe_resp.variable, ielen);
991 1004
992 if (ieee80211_is_probe_resp(mgmt->frame_control)) 1005 if (ieee80211_is_probe_resp(mgmt->frame_control))