aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiad Kaufman <liad.kaufman@intel.com>2019-02-06 06:17:13 -0500
committerJohannes Berg <johannes.berg@intel.com>2019-02-22 07:45:38 -0500
commitc15353be91902fa6cde08d4bf325d089895d65e8 (patch)
treebed5c41ca8e88bf898f4565e2995413dbf68cd87
parent2ff5e52e7836f1851f25304e0b2ee09cd9e7962e (diff)
mac80211: fix position of vendor_data read
The ieee80211_vendor_radiotap was read from the beginning of the skb->data regardless of the existence of other elements in radiotap that would cause it to move to another position. Fix this by taking into account where it really should be. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/rx.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bb4d71efb6fb..c97018dd17fe 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5,7 +5,7 @@
5 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 5 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright 2013-2014 Intel Mobile Communications GmbH
7 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 7 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
8 * Copyright (C) 2018 Intel Corporation 8 * Copyright (C) 2018-2019 Intel Corporation
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -208,7 +208,24 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
208 } 208 }
209 209
210 if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) { 210 if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) {
211 struct ieee80211_vendor_radiotap *rtap = (void *)skb->data; 211 struct ieee80211_vendor_radiotap *rtap;
212 int vendor_data_offset = 0;
213
214 /*
215 * The position to look at depends on the existence (or non-
216 * existence) of other elements, so take that into account...
217 */
218 if (status->flag & RX_FLAG_RADIOTAP_HE)
219 vendor_data_offset +=
220 sizeof(struct ieee80211_radiotap_he);
221 if (status->flag & RX_FLAG_RADIOTAP_HE_MU)
222 vendor_data_offset +=
223 sizeof(struct ieee80211_radiotap_he_mu);
224 if (status->flag & RX_FLAG_RADIOTAP_LSIG)
225 vendor_data_offset +=
226 sizeof(struct ieee80211_radiotap_lsig);
227
228 rtap = (void *)&skb->data[vendor_data_offset];
212 229
213 /* alignment for fixed 6-byte vendor data header */ 230 /* alignment for fixed 6-byte vendor data header */
214 len = ALIGN(len, 2); 231 len = ALIGN(len, 2);