diff options
author | Liu Haitao <haitao.liu@windriver.com> | 2019-01-03 13:48:38 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-07 10:54:13 +0000 |
commit | 9dfbb877c7801afa126bb50f6556401a2d4782d1 (patch) | |
tree | 1f8067486fcba9315b06c17e341f99e67c5578e7 /meta | |
parent | fb2e4b191376825eb43ce0b086aed3e7acb217f1 (diff) | |
download | poky-9dfbb877c7801afa126bb50f6556401a2d4782d1.tar.gz |
iw: fix parsing of WEP keys
The current iw4.14 has a fatal bug that could casue a Segmentation fault
when parsing WEP keys. The issue has been fixed by upstream.
[https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=0e39f109c4b8155697a12ef090b59cdb304c8c44]
(From OE-Core rev: 6de9eb72f679dd8d8e4de972b1da978522cff8b4)
Signed-off-by: Liu Haitao <haitao.liu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-connectivity/iw/iw/0001-connect-fix-parsing-of-WEP-keys.patch | 194 | ||||
-rw-r--r-- | meta/recipes-connectivity/iw/iw_4.14.bb | 1 |
2 files changed, 195 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/iw/iw/0001-connect-fix-parsing-of-WEP-keys.patch b/meta/recipes-connectivity/iw/iw/0001-connect-fix-parsing-of-WEP-keys.patch new file mode 100644 index 0000000000..8cf8f7ab38 --- /dev/null +++ b/meta/recipes-connectivity/iw/iw/0001-connect-fix-parsing-of-WEP-keys.patch | |||
@@ -0,0 +1,194 @@ | |||
1 | From 2a6be4166fd718be0694fe8a6e3f1013c125dee2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Emmanuel Grumbach <emmanuel.grumbach@intel.com> | ||
3 | Date: Tue, 12 Jun 2018 09:01:56 +0300 | ||
4 | Subject: [PATCH] connect: fix parsing of WEP keys | ||
5 | |||
6 | The introduction of MFP options added a bug that causes a | ||
7 | segmentation fault when parsing WEP keys. | ||
8 | Fix that. | ||
9 | |||
10 | Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> | ||
11 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> | ||
12 | |||
13 | Upstream-Status: Backport | ||
14 | [https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=0e39f109c4b8155697a12ef090b59cdb304c8c44] | ||
15 | Signed-off-by: Liu Haitao <haitao.liu@windriver.com> | ||
16 | --- | ||
17 | ap.c | 2 +- | ||
18 | connect.c | 7 ++----- | ||
19 | ibss.c | 2 +- | ||
20 | iw.h | 3 ++- | ||
21 | util.c | 36 ++++++++++++++++++------------------ | ||
22 | 5 files changed, 24 insertions(+), 26 deletions(-) | ||
23 | |||
24 | diff --git a/ap.c b/ap.c | ||
25 | index 4bab5b9..dcce402 100644 | ||
26 | --- a/ap.c | ||
27 | +++ b/ap.c | ||
28 | @@ -116,7 +116,7 @@ static int handle_start_ap(struct nl80211_state *state, | ||
29 | argv++; | ||
30 | argc--; | ||
31 | |||
32 | - return parse_keys(msg, argv, argc); | ||
33 | + return parse_keys(msg, &argv, &argc); | ||
34 | nla_put_failure: | ||
35 | return -ENOSPC; | ||
36 | } | ||
37 | diff --git a/connect.c b/connect.c | ||
38 | index 339fc73..4a847a1 100644 | ||
39 | --- a/connect.c | ||
40 | +++ b/connect.c | ||
41 | @@ -54,13 +54,10 @@ static int iw_conn(struct nl80211_state *state, | ||
42 | argv++; | ||
43 | argc--; | ||
44 | |||
45 | - ret = parse_keys(msg, argv, argc); | ||
46 | + ret = parse_keys(msg, &argv, &argc); | ||
47 | if (ret) | ||
48 | return ret; | ||
49 | |||
50 | - argc -= 4; | ||
51 | - argv += 4; | ||
52 | - | ||
53 | if (!argc) | ||
54 | return 0; | ||
55 | |||
56 | @@ -228,7 +225,7 @@ static int iw_auth(struct nl80211_state *state, | ||
57 | argv++; | ||
58 | argc--; | ||
59 | |||
60 | - return parse_keys(msg, argv, argc); | ||
61 | + return parse_keys(msg, &argv, &argc); | ||
62 | nla_put_failure: | ||
63 | return -ENOSPC; | ||
64 | } | ||
65 | diff --git a/ibss.c b/ibss.c | ||
66 | index 84f1e95..d77fc92 100644 | ||
67 | --- a/ibss.c | ||
68 | +++ b/ibss.c | ||
69 | @@ -115,7 +115,7 @@ static int join_ibss(struct nl80211_state *state, | ||
70 | argv++; | ||
71 | argc--; | ||
72 | |||
73 | - return parse_keys(msg, argv, argc); | ||
74 | + return parse_keys(msg, &argv, &argc); | ||
75 | nla_put_failure: | ||
76 | return -ENOSPC; | ||
77 | } | ||
78 | diff --git a/iw.h b/iw.h | ||
79 | index ee7ca20..8767ed3 100644 | ||
80 | --- a/iw.h | ||
81 | +++ b/iw.h | ||
82 | @@ -180,7 +180,8 @@ int parse_hex_mask(char *hexmask, unsigned char **result, size_t *result_len, | ||
83 | unsigned char **mask); | ||
84 | unsigned char *parse_hex(char *hex, size_t *outlen); | ||
85 | |||
86 | -int parse_keys(struct nl_msg *msg, char **argv, int argc); | ||
87 | + | ||
88 | +int parse_keys(struct nl_msg *msg, char **argv[], int *argc); | ||
89 | int parse_freqchan(struct chandef *chandef, bool chan, int argc, char **argv, int *parsed); | ||
90 | enum nl80211_chan_width str_to_bw(const char *str); | ||
91 | int put_chandef(struct nl_msg *msg, struct chandef *chandef); | ||
92 | diff --git a/util.c b/util.c | ||
93 | index 6e0ddff..122c019 100644 | ||
94 | --- a/util.c | ||
95 | +++ b/util.c | ||
96 | @@ -417,23 +417,23 @@ static int parse_cipher_suite(const char *cipher_str) | ||
97 | return -EINVAL; | ||
98 | } | ||
99 | |||
100 | -int parse_keys(struct nl_msg *msg, char **argv, int argc) | ||
101 | +int parse_keys(struct nl_msg *msg, char **argv[], int *argc) | ||
102 | { | ||
103 | struct nlattr *keys; | ||
104 | int i = 0; | ||
105 | bool have_default = false; | ||
106 | - char *arg = *argv; | ||
107 | + char *arg = **argv; | ||
108 | char keybuf[13]; | ||
109 | int pos = 0; | ||
110 | |||
111 | - if (!argc) | ||
112 | + if (!*argc) | ||
113 | return 1; | ||
114 | |||
115 | if (!memcmp(&arg[pos], "psk", 3)) { | ||
116 | char psk_keybuf[32]; | ||
117 | int cipher_suite, akm_suite; | ||
118 | |||
119 | - if (argc < 4) | ||
120 | + if (*argc < 4) | ||
121 | goto explain; | ||
122 | |||
123 | pos+=3; | ||
124 | @@ -451,9 +451,9 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc) | ||
125 | NLA_PUT(msg, NL80211_ATTR_PMK, 32, psk_keybuf); | ||
126 | NLA_PUT_U32(msg, NL80211_ATTR_AUTH_TYPE, NL80211_AUTHTYPE_OPEN_SYSTEM); | ||
127 | |||
128 | - argv++; | ||
129 | - argc--; | ||
130 | - arg = *argv; | ||
131 | + *argv += 1; | ||
132 | + *argc -= 1; | ||
133 | + arg = **argv; | ||
134 | |||
135 | akm_suite = parse_akm_suite(arg); | ||
136 | if (akm_suite < 0) | ||
137 | @@ -461,9 +461,9 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc) | ||
138 | |||
139 | NLA_PUT_U32(msg, NL80211_ATTR_AKM_SUITES, akm_suite); | ||
140 | |||
141 | - argv++; | ||
142 | - argc--; | ||
143 | - arg = *argv; | ||
144 | + *argv += 1; | ||
145 | + *argc -= 1; | ||
146 | + arg = **argv; | ||
147 | |||
148 | cipher_suite = parse_cipher_suite(arg); | ||
149 | if (cipher_suite < 0) | ||
150 | @@ -471,9 +471,9 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc) | ||
151 | |||
152 | NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, cipher_suite); | ||
153 | |||
154 | - argv++; | ||
155 | - argc--; | ||
156 | - arg = *argv; | ||
157 | + *argv += 1; | ||
158 | + *argc -= 1; | ||
159 | + arg = **argv; | ||
160 | |||
161 | cipher_suite = parse_cipher_suite(arg); | ||
162 | if (cipher_suite < 0) | ||
163 | @@ -495,7 +495,7 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc) | ||
164 | struct nlattr *key = nla_nest_start(msg, ++i); | ||
165 | char *keydata; | ||
166 | |||
167 | - arg = *argv; | ||
168 | + arg = **argv; | ||
169 | pos = 0; | ||
170 | |||
171 | if (!key) | ||
172 | @@ -537,15 +537,15 @@ int parse_keys(struct nl_msg *msg, char **argv, int argc) | ||
173 | |||
174 | NLA_PUT(msg, NL80211_KEY_DATA, keylen, keydata); | ||
175 | |||
176 | - argv++; | ||
177 | - argc--; | ||
178 | + *argv += 1; | ||
179 | + *argc -= 1; | ||
180 | |||
181 | /* one key should be TX key */ | ||
182 | - if (!have_default && !argc) | ||
183 | + if (!have_default && !*argc) | ||
184 | NLA_PUT_FLAG(msg, NL80211_KEY_DEFAULT); | ||
185 | |||
186 | nla_nest_end(msg, key); | ||
187 | - } while (argc); | ||
188 | + } while (*argc); | ||
189 | |||
190 | nla_nest_end(msg, keys); | ||
191 | |||
192 | -- | ||
193 | 2.17.1 | ||
194 | |||
diff --git a/meta/recipes-connectivity/iw/iw_4.14.bb b/meta/recipes-connectivity/iw/iw_4.14.bb index e1b17de4c3..f414a4b1dc 100644 --- a/meta/recipes-connectivity/iw/iw_4.14.bb +++ b/meta/recipes-connectivity/iw/iw_4.14.bb | |||
@@ -12,6 +12,7 @@ DEPENDS = "libnl" | |||
12 | SRC_URI = "http://www.kernel.org/pub/software/network/iw/${BP}.tar.gz \ | 12 | SRC_URI = "http://www.kernel.org/pub/software/network/iw/${BP}.tar.gz \ |
13 | file://0001-iw-version.sh-don-t-use-git-describe-for-versioning.patch \ | 13 | file://0001-iw-version.sh-don-t-use-git-describe-for-versioning.patch \ |
14 | file://separate-objdir.patch \ | 14 | file://separate-objdir.patch \ |
15 | file://0001-connect-fix-parsing-of-WEP-keys.patch \ | ||
15 | " | 16 | " |
16 | 17 | ||
17 | SRC_URI[md5sum] = "2067516ca9940fdb8c091ee3250da374" | 18 | SRC_URI[md5sum] = "2067516ca9940fdb8c091ee3250da374" |