cb922ba1e2577e21e8fc7a9be83272eb5b385aa0
[openwrt/staging/lynxis.git] / package / network / services / hostapd / patches / 033-mesh-fix-parsing-of-max_oper_chwidth.patch
1 From 444adf78eeb129e415d53fcb2fa2f05b6a69abdc Mon Sep 17 00:00:00 2001
2 From: Sven Eckelmann <sven.eckelmann@openmesh.com>
3 Date: Mon, 7 May 2018 15:24:29 +0200
4 Subject: wpa_supplicant: Fix parsing of max_oper_chwidth
5
6 The max_oper_chwidth is parsed in wpa_config_set as INT_RANGE (see
7 ssid_fields). The actual parsing for INT_RANGE is done by
8 wpa_config_parse_int which can only store the result as full integer.
9
10 max_oper_chwidth is stored as u8 (a single byte) in wpa_ssid. This means
11 that on little endian systems, the least significant byte of the parsed
12 value are really stored in the max_oper_chwidth. But on big endian system,
13 the only most significant byte is stored as max_oper_chwidth. This means
14 that 0 is always stored because the provided range doesn't allow any other
15 value for systems with multi-byte-wide integers.
16
17 This also means that for common systems with 4-byte-wide integers, the
18 remaining 3 bytes were written after the actual member of the struct. This
19 should not have influenced the behavior of succeeding members because these
20 bytes would have been part of the padding between the members on most
21 systems.
22
23 Increasing its size to a full int fixes the write operations outside of the
24 member and allows to use the max_oper_chwidth setting on big endian
25 systems.
26
27 Fixes: 0f29bc68d18e ("IBSS/mesh: Add support for VHT80P80 configuration")
28 Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
29
30 Forwarded: https://patchwork.ozlabs.org/patch/909751/
31 ---
32 wpa_supplicant/config_ssid.h | 2 +-
33 1 file changed, 1 insertion(+), 1 deletion(-)
34
35 --- a/wpa_supplicant/config_ssid.h
36 +++ b/wpa_supplicant/config_ssid.h
37 @@ -511,7 +511,7 @@ struct wpa_ssid {
38
39 int vht;
40
41 - u8 max_oper_chwidth;
42 + int max_oper_chwidth;
43
44 unsigned int vht_center_freq1;
45 unsigned int vht_center_freq2;