1 |
commit: c31b1ff3d3e2e4c076dac2c2a63ef9bdcd45af18 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 29 15:27:59 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 29 15:27:59 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=c31b1ff3 |
7 |
|
8 |
Linux patch 4.19.254 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1253_linux-4.19.254.patch | 2601 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2605 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index fc61f80f..373ac001 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1055,6 +1055,10 @@ Patch: 1252_linux-4.19.253.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.253 |
23 |
|
24 |
+Patch: 1253_linux-4.19.254.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.254 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1253_linux-4.19.254.patch b/1253_linux-4.19.254.patch |
33 |
new file mode 100644 |
34 |
index 00000000..f0f6dab6 |
35 |
--- /dev/null |
36 |
+++ b/1253_linux-4.19.254.patch |
37 |
@@ -0,0 +1,2601 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 7ae832b9156ff..c7a0dc943e74c 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 19 |
46 |
+-SUBLEVEL = 253 |
47 |
++SUBLEVEL = 254 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = "People's Front" |
50 |
+ |
51 |
+diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c |
52 |
+index 438b10c44d732..2b7a314b84522 100644 |
53 |
+--- a/arch/alpha/kernel/srmcons.c |
54 |
++++ b/arch/alpha/kernel/srmcons.c |
55 |
+@@ -59,7 +59,7 @@ srmcons_do_receive_chars(struct tty_port *port) |
56 |
+ } while((result.bits.status & 1) && (++loops < 10)); |
57 |
+ |
58 |
+ if (count) |
59 |
+- tty_schedule_flip(port); |
60 |
++ tty_flip_buffer_push(port); |
61 |
+ |
62 |
+ return count; |
63 |
+ } |
64 |
+diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile |
65 |
+index 110be14e61226..b6c972941881b 100644 |
66 |
+--- a/arch/riscv/Makefile |
67 |
++++ b/arch/riscv/Makefile |
68 |
+@@ -66,6 +66,7 @@ ifeq ($(CONFIG_MODULE_SECTIONS),y) |
69 |
+ endif |
70 |
+ |
71 |
+ KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) |
72 |
++KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) |
73 |
+ |
74 |
+ # GCC versions that support the "-mstrict-align" option default to allowing |
75 |
+ # unaligned accesses. While unaligned accesses are explicitly allowed in the |
76 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
77 |
+index bac4dc501dc4d..2be38780a7f71 100644 |
78 |
+--- a/drivers/char/random.c |
79 |
++++ b/drivers/char/random.c |
80 |
+@@ -183,8 +183,8 @@ static void __cold process_random_ready_list(void) |
81 |
+ |
82 |
+ #define warn_unseeded_randomness() \ |
83 |
+ if (IS_ENABLED(CONFIG_WARN_ALL_UNSEEDED_RANDOM) && !crng_ready()) \ |
84 |
+- pr_notice("%s called from %pS with crng_init=%d\n", \ |
85 |
+- __func__, (void *)_RET_IP_, crng_init) |
86 |
++ printk_deferred(KERN_NOTICE "random: %s called from %pS with crng_init=%d\n", \ |
87 |
++ __func__, (void *)_RET_IP_, crng_init) |
88 |
+ |
89 |
+ |
90 |
+ /********************************************************************* |
91 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c |
92 |
+index 1067e702c22c7..31a2d1ecce3e7 100644 |
93 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c |
94 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c |
95 |
+@@ -657,9 +657,6 @@ static bool tilcdc_crtc_mode_fixup(struct drm_crtc *crtc, |
96 |
+ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc, |
97 |
+ struct drm_crtc_state *state) |
98 |
+ { |
99 |
+- struct drm_display_mode *mode = &state->mode; |
100 |
+- int ret; |
101 |
+- |
102 |
+ /* If we are not active we don't care */ |
103 |
+ if (!state->active) |
104 |
+ return 0; |
105 |
+@@ -671,12 +668,6 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc, |
106 |
+ return -EINVAL; |
107 |
+ } |
108 |
+ |
109 |
+- ret = tilcdc_crtc_mode_valid(crtc, mode); |
110 |
+- if (ret) { |
111 |
+- dev_dbg(crtc->dev->dev, "Mode \"%s\" not valid", mode->name); |
112 |
+- return -EINVAL; |
113 |
+- } |
114 |
+- |
115 |
+ return 0; |
116 |
+ } |
117 |
+ |
118 |
+@@ -728,13 +719,6 @@ static const struct drm_crtc_funcs tilcdc_crtc_funcs = { |
119 |
+ .disable_vblank = tilcdc_crtc_disable_vblank, |
120 |
+ }; |
121 |
+ |
122 |
+-static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = { |
123 |
+- .mode_fixup = tilcdc_crtc_mode_fixup, |
124 |
+- .atomic_check = tilcdc_crtc_atomic_check, |
125 |
+- .atomic_enable = tilcdc_crtc_atomic_enable, |
126 |
+- .atomic_disable = tilcdc_crtc_atomic_disable, |
127 |
+-}; |
128 |
+- |
129 |
+ int tilcdc_crtc_max_width(struct drm_crtc *crtc) |
130 |
+ { |
131 |
+ struct drm_device *dev = crtc->dev; |
132 |
+@@ -749,7 +733,9 @@ int tilcdc_crtc_max_width(struct drm_crtc *crtc) |
133 |
+ return max_width; |
134 |
+ } |
135 |
+ |
136 |
+-int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode) |
137 |
++static enum drm_mode_status |
138 |
++tilcdc_crtc_mode_valid(struct drm_crtc *crtc, |
139 |
++ const struct drm_display_mode *mode) |
140 |
+ { |
141 |
+ struct tilcdc_drm_private *priv = crtc->dev->dev_private; |
142 |
+ unsigned int bandwidth; |
143 |
+@@ -837,6 +823,14 @@ int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode) |
144 |
+ return MODE_OK; |
145 |
+ } |
146 |
+ |
147 |
++static const struct drm_crtc_helper_funcs tilcdc_crtc_helper_funcs = { |
148 |
++ .mode_valid = tilcdc_crtc_mode_valid, |
149 |
++ .mode_fixup = tilcdc_crtc_mode_fixup, |
150 |
++ .atomic_check = tilcdc_crtc_atomic_check, |
151 |
++ .atomic_enable = tilcdc_crtc_atomic_enable, |
152 |
++ .atomic_disable = tilcdc_crtc_atomic_disable, |
153 |
++}; |
154 |
++ |
155 |
+ void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc, |
156 |
+ const struct tilcdc_panel_info *info) |
157 |
+ { |
158 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c |
159 |
+index e1868776da252..96457fe2b8d5b 100644 |
160 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c |
161 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c |
162 |
+@@ -202,7 +202,6 @@ static void tilcdc_fini(struct drm_device *dev) |
163 |
+ |
164 |
+ drm_irq_uninstall(dev); |
165 |
+ drm_mode_config_cleanup(dev); |
166 |
+- tilcdc_remove_external_device(dev); |
167 |
+ |
168 |
+ if (priv->clk) |
169 |
+ clk_put(priv->clk); |
170 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.h b/drivers/gpu/drm/tilcdc/tilcdc_drv.h |
171 |
+index ead5122166699..35558bbd5cd88 100644 |
172 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.h |
173 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.h |
174 |
+@@ -89,7 +89,6 @@ struct tilcdc_drm_private { |
175 |
+ |
176 |
+ struct drm_encoder *external_encoder; |
177 |
+ struct drm_connector *external_connector; |
178 |
+- const struct drm_connector_helper_funcs *connector_funcs; |
179 |
+ |
180 |
+ bool is_registered; |
181 |
+ bool is_componentized; |
182 |
+@@ -171,7 +170,6 @@ void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc, |
183 |
+ const struct tilcdc_panel_info *info); |
184 |
+ void tilcdc_crtc_set_simulate_vesa_sync(struct drm_crtc *crtc, |
185 |
+ bool simulate_vesa_sync); |
186 |
+-int tilcdc_crtc_mode_valid(struct drm_crtc *crtc, struct drm_display_mode *mode); |
187 |
+ int tilcdc_crtc_max_width(struct drm_crtc *crtc); |
188 |
+ void tilcdc_crtc_shutdown(struct drm_crtc *crtc); |
189 |
+ int tilcdc_crtc_update_fb(struct drm_crtc *crtc, |
190 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c |
191 |
+index b4eaf9bc87f8e..9c1be0635b538 100644 |
192 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c |
193 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c |
194 |
+@@ -40,64 +40,6 @@ static const struct tilcdc_panel_info panel_info_default = { |
195 |
+ .raster_order = 0, |
196 |
+ }; |
197 |
+ |
198 |
+-static int tilcdc_external_mode_valid(struct drm_connector *connector, |
199 |
+- struct drm_display_mode *mode) |
200 |
+-{ |
201 |
+- struct tilcdc_drm_private *priv = connector->dev->dev_private; |
202 |
+- int ret; |
203 |
+- |
204 |
+- ret = tilcdc_crtc_mode_valid(priv->crtc, mode); |
205 |
+- if (ret != MODE_OK) |
206 |
+- return ret; |
207 |
+- |
208 |
+- BUG_ON(priv->external_connector != connector); |
209 |
+- BUG_ON(!priv->connector_funcs); |
210 |
+- |
211 |
+- /* If the connector has its own mode_valid call it. */ |
212 |
+- if (!IS_ERR(priv->connector_funcs) && |
213 |
+- priv->connector_funcs->mode_valid) |
214 |
+- return priv->connector_funcs->mode_valid(connector, mode); |
215 |
+- |
216 |
+- return MODE_OK; |
217 |
+-} |
218 |
+- |
219 |
+-static int tilcdc_add_external_connector(struct drm_device *dev, |
220 |
+- struct drm_connector *connector) |
221 |
+-{ |
222 |
+- struct tilcdc_drm_private *priv = dev->dev_private; |
223 |
+- struct drm_connector_helper_funcs *connector_funcs; |
224 |
+- |
225 |
+- /* There should never be more than one connector */ |
226 |
+- if (WARN_ON(priv->external_connector)) |
227 |
+- return -EINVAL; |
228 |
+- |
229 |
+- priv->external_connector = connector; |
230 |
+- connector_funcs = devm_kzalloc(dev->dev, sizeof(*connector_funcs), |
231 |
+- GFP_KERNEL); |
232 |
+- if (!connector_funcs) |
233 |
+- return -ENOMEM; |
234 |
+- |
235 |
+- /* connector->helper_private contains always struct |
236 |
+- * connector_helper_funcs pointer. For tilcdc crtc to have a |
237 |
+- * say if a specific mode is Ok, we need to install our own |
238 |
+- * helper functions. In our helper functions we copy |
239 |
+- * everything else but use our own mode_valid() (above). |
240 |
+- */ |
241 |
+- if (connector->helper_private) { |
242 |
+- priv->connector_funcs = connector->helper_private; |
243 |
+- *connector_funcs = *priv->connector_funcs; |
244 |
+- } else { |
245 |
+- priv->connector_funcs = ERR_PTR(-ENOENT); |
246 |
+- } |
247 |
+- connector_funcs->mode_valid = tilcdc_external_mode_valid; |
248 |
+- drm_connector_helper_add(connector, connector_funcs); |
249 |
+- |
250 |
+- dev_dbg(dev->dev, "External connector '%s' connected\n", |
251 |
+- connector->name); |
252 |
+- |
253 |
+- return 0; |
254 |
+-} |
255 |
+- |
256 |
+ static |
257 |
+ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev, |
258 |
+ struct drm_encoder *encoder) |
259 |
+@@ -118,40 +60,30 @@ struct drm_connector *tilcdc_encoder_find_connector(struct drm_device *ddev, |
260 |
+ int tilcdc_add_component_encoder(struct drm_device *ddev) |
261 |
+ { |
262 |
+ struct tilcdc_drm_private *priv = ddev->dev_private; |
263 |
+- struct drm_connector *connector; |
264 |
+- struct drm_encoder *encoder; |
265 |
++ struct drm_encoder *encoder = NULL, *iter; |
266 |
+ |
267 |
+- list_for_each_entry(encoder, &ddev->mode_config.encoder_list, head) |
268 |
+- if (encoder->possible_crtcs & (1 << priv->crtc->index)) |
269 |
++ list_for_each_entry(iter, &ddev->mode_config.encoder_list, head) |
270 |
++ if (iter->possible_crtcs & (1 << priv->crtc->index)) { |
271 |
++ encoder = iter; |
272 |
+ break; |
273 |
++ } |
274 |
+ |
275 |
+ if (!encoder) { |
276 |
+ dev_err(ddev->dev, "%s: No suitable encoder found\n", __func__); |
277 |
+ return -ENODEV; |
278 |
+ } |
279 |
+ |
280 |
+- connector = tilcdc_encoder_find_connector(ddev, encoder); |
281 |
++ priv->external_connector = |
282 |
++ tilcdc_encoder_find_connector(ddev, encoder); |
283 |
+ |
284 |
+- if (!connector) |
285 |
++ if (!priv->external_connector) |
286 |
+ return -ENODEV; |
287 |
+ |
288 |
+ /* Only tda998x is supported at the moment. */ |
289 |
+ tilcdc_crtc_set_simulate_vesa_sync(priv->crtc, true); |
290 |
+ tilcdc_crtc_set_panel_info(priv->crtc, &panel_info_tda998x); |
291 |
+ |
292 |
+- return tilcdc_add_external_connector(ddev, connector); |
293 |
+-} |
294 |
+- |
295 |
+-void tilcdc_remove_external_device(struct drm_device *dev) |
296 |
+-{ |
297 |
+- struct tilcdc_drm_private *priv = dev->dev_private; |
298 |
+- |
299 |
+- /* Restore the original helper functions, if any. */ |
300 |
+- if (IS_ERR(priv->connector_funcs)) |
301 |
+- drm_connector_helper_add(priv->external_connector, NULL); |
302 |
+- else if (priv->connector_funcs) |
303 |
+- drm_connector_helper_add(priv->external_connector, |
304 |
+- priv->connector_funcs); |
305 |
++ return 0; |
306 |
+ } |
307 |
+ |
308 |
+ static const struct drm_encoder_funcs tilcdc_external_encoder_funcs = { |
309 |
+@@ -162,7 +94,6 @@ static |
310 |
+ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge) |
311 |
+ { |
312 |
+ struct tilcdc_drm_private *priv = ddev->dev_private; |
313 |
+- struct drm_connector *connector; |
314 |
+ int ret; |
315 |
+ |
316 |
+ priv->external_encoder->possible_crtcs = BIT(0); |
317 |
+@@ -175,13 +106,12 @@ int tilcdc_attach_bridge(struct drm_device *ddev, struct drm_bridge *bridge) |
318 |
+ |
319 |
+ tilcdc_crtc_set_panel_info(priv->crtc, &panel_info_default); |
320 |
+ |
321 |
+- connector = tilcdc_encoder_find_connector(ddev, priv->external_encoder); |
322 |
+- if (!connector) |
323 |
++ priv->external_connector = |
324 |
++ tilcdc_encoder_find_connector(ddev, priv->external_encoder); |
325 |
++ if (!priv->external_connector) |
326 |
+ return -ENODEV; |
327 |
+ |
328 |
+- ret = tilcdc_add_external_connector(ddev, connector); |
329 |
+- |
330 |
+- return ret; |
331 |
++ return 0; |
332 |
+ } |
333 |
+ |
334 |
+ int tilcdc_attach_external_device(struct drm_device *ddev) |
335 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.h b/drivers/gpu/drm/tilcdc/tilcdc_external.h |
336 |
+index 763d18f006c74..a28b9df68c8fd 100644 |
337 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_external.h |
338 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_external.h |
339 |
+@@ -19,7 +19,6 @@ |
340 |
+ #define __TILCDC_EXTERNAL_H__ |
341 |
+ |
342 |
+ int tilcdc_add_component_encoder(struct drm_device *dev); |
343 |
+-void tilcdc_remove_external_device(struct drm_device *dev); |
344 |
+ int tilcdc_get_external_components(struct device *dev, |
345 |
+ struct component_match **match); |
346 |
+ int tilcdc_attach_external_device(struct drm_device *ddev); |
347 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
348 |
+index 096a33f12c615..253c555e29974 100644 |
349 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
350 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c |
351 |
+@@ -174,14 +174,6 @@ static int panel_connector_get_modes(struct drm_connector *connector) |
352 |
+ return i; |
353 |
+ } |
354 |
+ |
355 |
+-static int panel_connector_mode_valid(struct drm_connector *connector, |
356 |
+- struct drm_display_mode *mode) |
357 |
+-{ |
358 |
+- struct tilcdc_drm_private *priv = connector->dev->dev_private; |
359 |
+- /* our only constraints are what the crtc can generate: */ |
360 |
+- return tilcdc_crtc_mode_valid(priv->crtc, mode); |
361 |
+-} |
362 |
+- |
363 |
+ static struct drm_encoder *panel_connector_best_encoder( |
364 |
+ struct drm_connector *connector) |
365 |
+ { |
366 |
+@@ -199,7 +191,6 @@ static const struct drm_connector_funcs panel_connector_funcs = { |
367 |
+ |
368 |
+ static const struct drm_connector_helper_funcs panel_connector_helper_funcs = { |
369 |
+ .get_modes = panel_connector_get_modes, |
370 |
+- .mode_valid = panel_connector_mode_valid, |
371 |
+ .best_encoder = panel_connector_best_encoder, |
372 |
+ }; |
373 |
+ |
374 |
+diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c |
375 |
+index daebf1aa6b0a8..54c6d825b1a06 100644 |
376 |
+--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c |
377 |
++++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c |
378 |
+@@ -183,14 +183,6 @@ static int tfp410_connector_get_modes(struct drm_connector *connector) |
379 |
+ return ret; |
380 |
+ } |
381 |
+ |
382 |
+-static int tfp410_connector_mode_valid(struct drm_connector *connector, |
383 |
+- struct drm_display_mode *mode) |
384 |
+-{ |
385 |
+- struct tilcdc_drm_private *priv = connector->dev->dev_private; |
386 |
+- /* our only constraints are what the crtc can generate: */ |
387 |
+- return tilcdc_crtc_mode_valid(priv->crtc, mode); |
388 |
+-} |
389 |
+- |
390 |
+ static struct drm_encoder *tfp410_connector_best_encoder( |
391 |
+ struct drm_connector *connector) |
392 |
+ { |
393 |
+@@ -209,7 +201,6 @@ static const struct drm_connector_funcs tfp410_connector_funcs = { |
394 |
+ |
395 |
+ static const struct drm_connector_helper_funcs tfp410_connector_helper_funcs = { |
396 |
+ .get_modes = tfp410_connector_get_modes, |
397 |
+- .mode_valid = tfp410_connector_mode_valid, |
398 |
+ .best_encoder = tfp410_connector_best_encoder, |
399 |
+ }; |
400 |
+ |
401 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
402 |
+index 8d4153c73f5cf..70079d29822b7 100644 |
403 |
+--- a/drivers/hid/hid-ids.h |
404 |
++++ b/drivers/hid/hid-ids.h |
405 |
+@@ -727,6 +727,8 @@ |
406 |
+ #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 |
407 |
+ #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 |
408 |
+ #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 |
409 |
++#define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5 |
410 |
++#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d |
411 |
+ |
412 |
+ #define USB_VENDOR_ID_LG 0x1fd2 |
413 |
+ #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 |
414 |
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c |
415 |
+index e99286258f62f..ce027eda9b178 100644 |
416 |
+--- a/drivers/hid/hid-multitouch.c |
417 |
++++ b/drivers/hid/hid-multitouch.c |
418 |
+@@ -72,6 +72,7 @@ MODULE_LICENSE("GPL"); |
419 |
+ #define MT_QUIRK_STICKY_FINGERS BIT(16) |
420 |
+ #define MT_QUIRK_ASUS_CUSTOM_UP BIT(17) |
421 |
+ #define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18) |
422 |
++#define MT_QUIRK_SEPARATE_APP_REPORT BIT(19) |
423 |
+ |
424 |
+ #define MT_INPUTMODE_TOUCHSCREEN 0x02 |
425 |
+ #define MT_INPUTMODE_TOUCHPAD 0x03 |
426 |
+@@ -107,6 +108,7 @@ struct mt_usages { |
427 |
+ struct mt_application { |
428 |
+ struct list_head list; |
429 |
+ unsigned int application; |
430 |
++ unsigned int report_id; |
431 |
+ struct list_head mt_usages; /* mt usages list */ |
432 |
+ |
433 |
+ __s32 quirks; |
434 |
+@@ -207,6 +209,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app); |
435 |
+ #define MT_CLS_VTL 0x0110 |
436 |
+ #define MT_CLS_GOOGLE 0x0111 |
437 |
+ #define MT_CLS_RAZER_BLADE_STEALTH 0x0112 |
438 |
++#define MT_CLS_SMART_TECH 0x0113 |
439 |
+ |
440 |
+ #define MT_DEFAULT_MAXCONTACT 10 |
441 |
+ #define MT_MAX_MAXCONTACT 250 |
442 |
+@@ -357,6 +360,12 @@ static const struct mt_class mt_classes[] = { |
443 |
+ MT_QUIRK_CONTACT_CNT_ACCURATE | |
444 |
+ MT_QUIRK_WIN8_PTP_BUTTONS, |
445 |
+ }, |
446 |
++ { .name = MT_CLS_SMART_TECH, |
447 |
++ .quirks = MT_QUIRK_ALWAYS_VALID | |
448 |
++ MT_QUIRK_IGNORE_DUPLICATES | |
449 |
++ MT_QUIRK_CONTACT_CNT_ACCURATE | |
450 |
++ MT_QUIRK_SEPARATE_APP_REPORT, |
451 |
++ }, |
452 |
+ { } |
453 |
+ }; |
454 |
+ |
455 |
+@@ -513,8 +522,9 @@ static struct mt_usages *mt_allocate_usage(struct hid_device *hdev, |
456 |
+ } |
457 |
+ |
458 |
+ static struct mt_application *mt_allocate_application(struct mt_device *td, |
459 |
+- unsigned int application) |
460 |
++ struct hid_report *report) |
461 |
+ { |
462 |
++ unsigned int application = report->application; |
463 |
+ struct mt_application *mt_application; |
464 |
+ |
465 |
+ mt_application = devm_kzalloc(&td->hdev->dev, sizeof(*mt_application), |
466 |
+@@ -539,6 +549,7 @@ static struct mt_application *mt_allocate_application(struct mt_device *td, |
467 |
+ mt_application->scantime = DEFAULT_ZERO; |
468 |
+ mt_application->raw_cc = DEFAULT_ZERO; |
469 |
+ mt_application->quirks = td->mtclass.quirks; |
470 |
++ mt_application->report_id = report->id; |
471 |
+ |
472 |
+ list_add_tail(&mt_application->list, &td->applications); |
473 |
+ |
474 |
+@@ -546,19 +557,23 @@ static struct mt_application *mt_allocate_application(struct mt_device *td, |
475 |
+ } |
476 |
+ |
477 |
+ static struct mt_application *mt_find_application(struct mt_device *td, |
478 |
+- unsigned int application) |
479 |
++ struct hid_report *report) |
480 |
+ { |
481 |
++ unsigned int application = report->application; |
482 |
+ struct mt_application *tmp, *mt_application = NULL; |
483 |
+ |
484 |
+ list_for_each_entry(tmp, &td->applications, list) { |
485 |
+ if (application == tmp->application) { |
486 |
+- mt_application = tmp; |
487 |
+- break; |
488 |
++ if (!(td->mtclass.quirks & MT_QUIRK_SEPARATE_APP_REPORT) || |
489 |
++ tmp->report_id == report->id) { |
490 |
++ mt_application = tmp; |
491 |
++ break; |
492 |
++ } |
493 |
+ } |
494 |
+ } |
495 |
+ |
496 |
+ if (!mt_application) |
497 |
+- mt_application = mt_allocate_application(td, application); |
498 |
++ mt_application = mt_allocate_application(td, report); |
499 |
+ |
500 |
+ return mt_application; |
501 |
+ } |
502 |
+@@ -575,7 +590,7 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, |
503 |
+ return NULL; |
504 |
+ |
505 |
+ rdata->report = report; |
506 |
+- rdata->application = mt_find_application(td, report->application); |
507 |
++ rdata->application = mt_find_application(td, report); |
508 |
+ |
509 |
+ if (!rdata->application) { |
510 |
+ devm_kfree(&td->hdev->dev, rdata); |
511 |
+@@ -1332,6 +1347,13 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
512 |
+ return mt_touch_input_mapping(hdev, hi, field, usage, bit, max, |
513 |
+ application); |
514 |
+ |
515 |
++ /* |
516 |
++ * some egalax touchscreens have "application == DG_TOUCHSCREEN" |
517 |
++ * for the stylus. Overwrite the hid_input application |
518 |
++ */ |
519 |
++ if (field->physical == HID_DG_STYLUS) |
520 |
++ hi->application = HID_DG_STYLUS; |
521 |
++ |
522 |
+ /* let hid-core decide for the others */ |
523 |
+ return 0; |
524 |
+ } |
525 |
+@@ -1520,14 +1542,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) |
526 |
+ struct mt_device *td = hid_get_drvdata(hdev); |
527 |
+ char *name; |
528 |
+ const char *suffix = NULL; |
529 |
+- unsigned int application = 0; |
530 |
+ struct mt_report_data *rdata; |
531 |
+ struct mt_application *mt_application = NULL; |
532 |
+ struct hid_report *report; |
533 |
+ int ret; |
534 |
+ |
535 |
+ list_for_each_entry(report, &hi->reports, hidinput_list) { |
536 |
+- application = report->application; |
537 |
+ rdata = mt_find_report_data(td, report); |
538 |
+ if (!rdata) { |
539 |
+ hid_err(hdev, "failed to allocate data for report\n"); |
540 |
+@@ -1542,46 +1562,36 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) |
541 |
+ if (ret) |
542 |
+ return ret; |
543 |
+ } |
544 |
+- |
545 |
+- /* |
546 |
+- * some egalax touchscreens have "application == DG_TOUCHSCREEN" |
547 |
+- * for the stylus. Check this first, and then rely on |
548 |
+- * the application field. |
549 |
+- */ |
550 |
+- if (report->field[0]->physical == HID_DG_STYLUS) { |
551 |
+- suffix = "Pen"; |
552 |
+- /* force BTN_STYLUS to allow tablet matching in udev */ |
553 |
+- __set_bit(BTN_STYLUS, hi->input->keybit); |
554 |
+- } |
555 |
+ } |
556 |
+ |
557 |
+- if (!suffix) { |
558 |
+- switch (application) { |
559 |
+- case HID_GD_KEYBOARD: |
560 |
+- case HID_GD_KEYPAD: |
561 |
+- case HID_GD_MOUSE: |
562 |
+- case HID_DG_TOUCHPAD: |
563 |
+- case HID_GD_SYSTEM_CONTROL: |
564 |
+- case HID_CP_CONSUMER_CONTROL: |
565 |
+- case HID_GD_WIRELESS_RADIO_CTLS: |
566 |
+- case HID_GD_SYSTEM_MULTIAXIS: |
567 |
+- /* already handled by hid core */ |
568 |
+- break; |
569 |
+- case HID_DG_TOUCHSCREEN: |
570 |
+- /* we do not set suffix = "Touchscreen" */ |
571 |
+- hi->input->name = hdev->name; |
572 |
+- break; |
573 |
+- case HID_DG_STYLUS: |
574 |
+- /* force BTN_STYLUS to allow tablet matching in udev */ |
575 |
+- __set_bit(BTN_STYLUS, hi->input->keybit); |
576 |
+- break; |
577 |
+- case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: |
578 |
+- suffix = "Custom Media Keys"; |
579 |
+- break; |
580 |
+- default: |
581 |
+- suffix = "UNKNOWN"; |
582 |
+- break; |
583 |
+- } |
584 |
++ switch (hi->application) { |
585 |
++ case HID_GD_KEYBOARD: |
586 |
++ case HID_GD_KEYPAD: |
587 |
++ case HID_GD_MOUSE: |
588 |
++ case HID_DG_TOUCHPAD: |
589 |
++ case HID_GD_SYSTEM_CONTROL: |
590 |
++ case HID_CP_CONSUMER_CONTROL: |
591 |
++ case HID_GD_WIRELESS_RADIO_CTLS: |
592 |
++ case HID_GD_SYSTEM_MULTIAXIS: |
593 |
++ /* already handled by hid core */ |
594 |
++ break; |
595 |
++ case HID_DG_TOUCHSCREEN: |
596 |
++ /* we do not set suffix = "Touchscreen" */ |
597 |
++ hi->input->name = hdev->name; |
598 |
++ break; |
599 |
++ case HID_DG_STYLUS: |
600 |
++ /* force BTN_STYLUS to allow tablet matching in udev */ |
601 |
++ __set_bit(BTN_STYLUS, hi->input->keybit); |
602 |
++ break; |
603 |
++ case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: |
604 |
++ suffix = "Custom Media Keys"; |
605 |
++ break; |
606 |
++ case HID_DG_PEN: |
607 |
++ suffix = "Stylus"; |
608 |
++ break; |
609 |
++ default: |
610 |
++ suffix = "UNKNOWN"; |
611 |
++ break; |
612 |
+ } |
613 |
+ |
614 |
+ if (suffix) { |
615 |
+@@ -1805,6 +1815,12 @@ static const struct hid_device_id mt_devices[] = { |
616 |
+ USB_VENDOR_ID_LENOVO, |
617 |
+ USB_DEVICE_ID_LENOVO_X1_TAB) }, |
618 |
+ |
619 |
++ /* Lenovo X1 TAB Gen 3 */ |
620 |
++ { .driver_data = MT_CLS_WIN_8_DUAL, |
621 |
++ HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, |
622 |
++ USB_VENDOR_ID_LENOVO, |
623 |
++ USB_DEVICE_ID_LENOVO_X1_TAB3) }, |
624 |
++ |
625 |
+ /* Anton devices */ |
626 |
+ { .driver_data = MT_CLS_EXPORT_ALL_INPUTS, |
627 |
+ MT_USB_DEVICE(USB_VENDOR_ID_ANTON, |
628 |
+@@ -2040,6 +2056,10 @@ static const struct hid_device_id mt_devices[] = { |
629 |
+ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, |
630 |
+ USB_VENDOR_ID_SYNAPTICS, 0x8323) }, |
631 |
+ |
632 |
++ /* Smart Tech panels */ |
633 |
++ { .driver_data = MT_CLS_SMART_TECH, |
634 |
++ MT_USB_DEVICE(0x0b8c, 0x0092)}, |
635 |
++ |
636 |
+ /* Stantum panels */ |
637 |
+ { .driver_data = MT_CLS_CONFIDENCE, |
638 |
+ MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, |
639 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
640 |
+index 48e9761d4ace9..c1b76ba85fb44 100644 |
641 |
+--- a/drivers/hid/hid-quirks.c |
642 |
++++ b/drivers/hid/hid-quirks.c |
643 |
+@@ -111,6 +111,7 @@ static const struct hid_device_id hid_quirks[] = { |
644 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2), HID_QUIRK_MULTI_INPUT }, |
645 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912), HID_QUIRK_MULTI_INPUT }, |
646 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL }, |
647 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL }, |
648 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL }, |
649 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL }, |
650 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET }, |
651 |
+diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c |
652 |
+index 273f57e277b3d..512c61d31fe5c 100644 |
653 |
+--- a/drivers/i2c/busses/i2c-cadence.c |
654 |
++++ b/drivers/i2c/busses/i2c-cadence.c |
655 |
+@@ -203,9 +203,9 @@ static inline bool cdns_is_holdquirk(struct cdns_i2c *id, bool hold_wrkaround) |
656 |
+ */ |
657 |
+ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
658 |
+ { |
659 |
+- unsigned int isr_status, avail_bytes, updatetx; |
660 |
++ unsigned int isr_status, avail_bytes; |
661 |
+ unsigned int bytes_to_send; |
662 |
+- bool hold_quirk; |
663 |
++ bool updatetx; |
664 |
+ struct cdns_i2c *id = ptr; |
665 |
+ /* Signal completion only after everything is updated */ |
666 |
+ int done_flag = 0; |
667 |
+@@ -224,11 +224,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
668 |
+ * Check if transfer size register needs to be updated again for a |
669 |
+ * large data receive operation. |
670 |
+ */ |
671 |
+- updatetx = 0; |
672 |
+- if (id->recv_count > id->curr_recv_count) |
673 |
+- updatetx = 1; |
674 |
+- |
675 |
+- hold_quirk = (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) && updatetx; |
676 |
++ updatetx = id->recv_count > id->curr_recv_count; |
677 |
+ |
678 |
+ /* When receiving, handle data interrupt and completion interrupt */ |
679 |
+ if (id->p_recv_buf && |
680 |
+@@ -251,7 +247,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
681 |
+ id->recv_count--; |
682 |
+ id->curr_recv_count--; |
683 |
+ |
684 |
+- if (cdns_is_holdquirk(id, hold_quirk)) |
685 |
++ if (cdns_is_holdquirk(id, updatetx)) |
686 |
+ break; |
687 |
+ } |
688 |
+ |
689 |
+@@ -262,7 +258,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
690 |
+ * maintain transfer size non-zero while performing a large |
691 |
+ * receive operation. |
692 |
+ */ |
693 |
+- if (cdns_is_holdquirk(id, hold_quirk)) { |
694 |
++ if (cdns_is_holdquirk(id, updatetx)) { |
695 |
+ /* wait while fifo is full */ |
696 |
+ while (cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET) != |
697 |
+ (id->curr_recv_count - CDNS_I2C_FIFO_DEPTH)) |
698 |
+@@ -284,22 +280,6 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr) |
699 |
+ CDNS_I2C_XFER_SIZE_OFFSET); |
700 |
+ id->curr_recv_count = id->recv_count; |
701 |
+ } |
702 |
+- } else if (id->recv_count && !hold_quirk && |
703 |
+- !id->curr_recv_count) { |
704 |
+- |
705 |
+- /* Set the slave address in address register*/ |
706 |
+- cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK, |
707 |
+- CDNS_I2C_ADDR_OFFSET); |
708 |
+- |
709 |
+- if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) { |
710 |
+- cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE, |
711 |
+- CDNS_I2C_XFER_SIZE_OFFSET); |
712 |
+- id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE; |
713 |
+- } else { |
714 |
+- cdns_i2c_writereg(id->recv_count, |
715 |
+- CDNS_I2C_XFER_SIZE_OFFSET); |
716 |
+- id->curr_recv_count = id->recv_count; |
717 |
+- } |
718 |
+ } |
719 |
+ |
720 |
+ /* Clear hold (if not repeated start) and signal completion */ |
721 |
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c |
722 |
+index 1e9d882c04ef1..a4a448d97451d 100644 |
723 |
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.c |
724 |
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c |
725 |
+@@ -2291,7 +2291,7 @@ err: |
726 |
+ |
727 |
+ /* Uses sync mcc */ |
728 |
+ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, |
729 |
+- u8 page_num, u8 *data) |
730 |
++ u8 page_num, u32 off, u32 len, u8 *data) |
731 |
+ { |
732 |
+ struct be_dma_mem cmd; |
733 |
+ struct be_mcc_wrb *wrb; |
734 |
+@@ -2325,10 +2325,10 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, |
735 |
+ req->port = cpu_to_le32(adapter->hba_port_num); |
736 |
+ req->page_num = cpu_to_le32(page_num); |
737 |
+ status = be_mcc_notify_wait(adapter); |
738 |
+- if (!status) { |
739 |
++ if (!status && len > 0) { |
740 |
+ struct be_cmd_resp_port_type *resp = cmd.va; |
741 |
+ |
742 |
+- memcpy(data, resp->page_data, PAGE_DATA_LEN); |
743 |
++ memcpy(data, resp->page_data + off, len); |
744 |
+ } |
745 |
+ err: |
746 |
+ mutex_unlock(&adapter->mcc_lock); |
747 |
+@@ -2419,7 +2419,7 @@ int be_cmd_query_cable_type(struct be_adapter *adapter) |
748 |
+ int status; |
749 |
+ |
750 |
+ status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
751 |
+- page_data); |
752 |
++ 0, PAGE_DATA_LEN, page_data); |
753 |
+ if (!status) { |
754 |
+ switch (adapter->phy.interface_type) { |
755 |
+ case PHY_TYPE_QSFP: |
756 |
+@@ -2444,7 +2444,7 @@ int be_cmd_query_sfp_info(struct be_adapter *adapter) |
757 |
+ int status; |
758 |
+ |
759 |
+ status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
760 |
+- page_data); |
761 |
++ 0, PAGE_DATA_LEN, page_data); |
762 |
+ if (!status) { |
763 |
+ strlcpy(adapter->phy.vendor_name, page_data + |
764 |
+ SFP_VENDOR_NAME_OFFSET, SFP_VENDOR_NAME_LEN - 1); |
765 |
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h |
766 |
+index e8b43cf44b6f0..f6f9c51a7d471 100644 |
767 |
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.h |
768 |
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.h |
769 |
+@@ -2431,7 +2431,7 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon, |
770 |
+ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, |
771 |
+ u32 *state); |
772 |
+ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, |
773 |
+- u8 page_num, u8 *data); |
774 |
++ u8 page_num, u32 off, u32 len, u8 *data); |
775 |
+ int be_cmd_query_cable_type(struct be_adapter *adapter); |
776 |
+ int be_cmd_query_sfp_info(struct be_adapter *adapter); |
777 |
+ int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd, |
778 |
+diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c |
779 |
+index d1905d50c26cb..1c1ac3488da2b 100644 |
780 |
+--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c |
781 |
++++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c |
782 |
+@@ -1342,7 +1342,7 @@ static int be_get_module_info(struct net_device *netdev, |
783 |
+ return -EOPNOTSUPP; |
784 |
+ |
785 |
+ status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
786 |
+- page_data); |
787 |
++ 0, PAGE_DATA_LEN, page_data); |
788 |
+ if (!status) { |
789 |
+ if (!page_data[SFP_PLUS_SFF_8472_COMP]) { |
790 |
+ modinfo->type = ETH_MODULE_SFF_8079; |
791 |
+@@ -1360,25 +1360,32 @@ static int be_get_module_eeprom(struct net_device *netdev, |
792 |
+ { |
793 |
+ struct be_adapter *adapter = netdev_priv(netdev); |
794 |
+ int status; |
795 |
++ u32 begin, end; |
796 |
+ |
797 |
+ if (!check_privilege(adapter, MAX_PRIVILEGES)) |
798 |
+ return -EOPNOTSUPP; |
799 |
+ |
800 |
+- status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, |
801 |
+- data); |
802 |
+- if (status) |
803 |
+- goto err; |
804 |
++ begin = eeprom->offset; |
805 |
++ end = eeprom->offset + eeprom->len; |
806 |
++ |
807 |
++ if (begin < PAGE_DATA_LEN) { |
808 |
++ status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, begin, |
809 |
++ min_t(u32, end, PAGE_DATA_LEN) - begin, |
810 |
++ data); |
811 |
++ if (status) |
812 |
++ goto err; |
813 |
++ |
814 |
++ data += PAGE_DATA_LEN - begin; |
815 |
++ begin = PAGE_DATA_LEN; |
816 |
++ } |
817 |
+ |
818 |
+- if (eeprom->offset + eeprom->len > PAGE_DATA_LEN) { |
819 |
+- status = be_cmd_read_port_transceiver_data(adapter, |
820 |
+- TR_PAGE_A2, |
821 |
+- data + |
822 |
+- PAGE_DATA_LEN); |
823 |
++ if (end > PAGE_DATA_LEN) { |
824 |
++ status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A2, |
825 |
++ begin - PAGE_DATA_LEN, |
826 |
++ end - begin, data); |
827 |
+ if (status) |
828 |
+ goto err; |
829 |
+ } |
830 |
+- if (eeprom->offset) |
831 |
+- memcpy(data, data + eeprom->offset, eeprom->len); |
832 |
+ err: |
833 |
+ return be_cmd_status(status); |
834 |
+ } |
835 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |
836 |
+index bc8871e7351f2..00b6af0b2f3a8 100644 |
837 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |
838 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |
839 |
+@@ -222,6 +222,9 @@ static void dwmac4_map_mtl_dma(struct mac_device_info *hw, u32 queue, u32 chan) |
840 |
+ if (queue == 0 || queue == 4) { |
841 |
+ value &= ~MTL_RXQ_DMA_Q04MDMACH_MASK; |
842 |
+ value |= MTL_RXQ_DMA_Q04MDMACH(chan); |
843 |
++ } else if (queue > 4) { |
844 |
++ value &= ~MTL_RXQ_DMA_QXMDMACH_MASK(queue - 4); |
845 |
++ value |= MTL_RXQ_DMA_QXMDMACH(chan, queue - 4); |
846 |
+ } else { |
847 |
+ value &= ~MTL_RXQ_DMA_QXMDMACH_MASK(queue); |
848 |
+ value |= MTL_RXQ_DMA_QXMDMACH(chan, queue); |
849 |
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c |
850 |
+index cf6ff8732fb2c..efee7bacfd76a 100644 |
851 |
+--- a/drivers/net/usb/ax88179_178a.c |
852 |
++++ b/drivers/net/usb/ax88179_178a.c |
853 |
+@@ -1706,7 +1706,7 @@ static const struct driver_info ax88179_info = { |
854 |
+ .link_reset = ax88179_link_reset, |
855 |
+ .reset = ax88179_reset, |
856 |
+ .stop = ax88179_stop, |
857 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
858 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
859 |
+ .rx_fixup = ax88179_rx_fixup, |
860 |
+ .tx_fixup = ax88179_tx_fixup, |
861 |
+ }; |
862 |
+@@ -1719,7 +1719,7 @@ static const struct driver_info ax88178a_info = { |
863 |
+ .link_reset = ax88179_link_reset, |
864 |
+ .reset = ax88179_reset, |
865 |
+ .stop = ax88179_stop, |
866 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
867 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
868 |
+ .rx_fixup = ax88179_rx_fixup, |
869 |
+ .tx_fixup = ax88179_tx_fixup, |
870 |
+ }; |
871 |
+@@ -1732,7 +1732,7 @@ static const struct driver_info cypress_GX3_info = { |
872 |
+ .link_reset = ax88179_link_reset, |
873 |
+ .reset = ax88179_reset, |
874 |
+ .stop = ax88179_stop, |
875 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
876 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
877 |
+ .rx_fixup = ax88179_rx_fixup, |
878 |
+ .tx_fixup = ax88179_tx_fixup, |
879 |
+ }; |
880 |
+@@ -1745,7 +1745,7 @@ static const struct driver_info dlink_dub1312_info = { |
881 |
+ .link_reset = ax88179_link_reset, |
882 |
+ .reset = ax88179_reset, |
883 |
+ .stop = ax88179_stop, |
884 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
885 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
886 |
+ .rx_fixup = ax88179_rx_fixup, |
887 |
+ .tx_fixup = ax88179_tx_fixup, |
888 |
+ }; |
889 |
+@@ -1758,7 +1758,7 @@ static const struct driver_info sitecom_info = { |
890 |
+ .link_reset = ax88179_link_reset, |
891 |
+ .reset = ax88179_reset, |
892 |
+ .stop = ax88179_stop, |
893 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
894 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
895 |
+ .rx_fixup = ax88179_rx_fixup, |
896 |
+ .tx_fixup = ax88179_tx_fixup, |
897 |
+ }; |
898 |
+@@ -1771,7 +1771,7 @@ static const struct driver_info samsung_info = { |
899 |
+ .link_reset = ax88179_link_reset, |
900 |
+ .reset = ax88179_reset, |
901 |
+ .stop = ax88179_stop, |
902 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
903 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
904 |
+ .rx_fixup = ax88179_rx_fixup, |
905 |
+ .tx_fixup = ax88179_tx_fixup, |
906 |
+ }; |
907 |
+@@ -1784,7 +1784,7 @@ static const struct driver_info lenovo_info = { |
908 |
+ .link_reset = ax88179_link_reset, |
909 |
+ .reset = ax88179_reset, |
910 |
+ .stop = ax88179_stop, |
911 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
912 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
913 |
+ .rx_fixup = ax88179_rx_fixup, |
914 |
+ .tx_fixup = ax88179_tx_fixup, |
915 |
+ }; |
916 |
+@@ -1797,7 +1797,7 @@ static const struct driver_info belkin_info = { |
917 |
+ .link_reset = ax88179_link_reset, |
918 |
+ .reset = ax88179_reset, |
919 |
+ .stop = ax88179_stop, |
920 |
+- .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
921 |
++ .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, |
922 |
+ .rx_fixup = ax88179_rx_fixup, |
923 |
+ .tx_fixup = ax88179_tx_fixup, |
924 |
+ }; |
925 |
+diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c |
926 |
+index 5c28498466415..63c79e140f1a8 100644 |
927 |
+--- a/drivers/pci/controller/pci-hyperv.c |
928 |
++++ b/drivers/pci/controller/pci-hyperv.c |
929 |
+@@ -831,6 +831,10 @@ static void hv_int_desc_free(struct hv_pci_dev *hpdev, |
930 |
+ u8 buffer[sizeof(struct pci_delete_interrupt)]; |
931 |
+ } ctxt; |
932 |
+ |
933 |
++ if (!int_desc->vector_count) { |
934 |
++ kfree(int_desc); |
935 |
++ return; |
936 |
++ } |
937 |
+ memset(&ctxt, 0, sizeof(ctxt)); |
938 |
+ int_pkt = (struct pci_delete_interrupt *)&ctxt.pkt.message; |
939 |
+ int_pkt->message_type.type = |
940 |
+@@ -893,6 +897,28 @@ static void hv_irq_mask(struct irq_data *data) |
941 |
+ pci_msi_mask_irq(data); |
942 |
+ } |
943 |
+ |
944 |
++static unsigned int hv_msi_get_int_vector(struct irq_data *data) |
945 |
++{ |
946 |
++ struct irq_cfg *cfg = irqd_cfg(data); |
947 |
++ |
948 |
++ return cfg->vector; |
949 |
++} |
950 |
++ |
951 |
++static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, |
952 |
++ int nvec, msi_alloc_info_t *info) |
953 |
++{ |
954 |
++ int ret = pci_msi_prepare(domain, dev, nvec, info); |
955 |
++ |
956 |
++ /* |
957 |
++ * By using the interrupt remapper in the hypervisor IOMMU, contiguous |
958 |
++ * CPU vectors is not needed for multi-MSI |
959 |
++ */ |
960 |
++ if (info->type == X86_IRQ_ALLOC_TYPE_MSI) |
961 |
++ info->flags &= ~X86_IRQ_ALLOC_CONTIGUOUS_VECTORS; |
962 |
++ |
963 |
++ return ret; |
964 |
++} |
965 |
++ |
966 |
+ /** |
967 |
+ * hv_irq_unmask() - "Unmask" the IRQ by setting its current |
968 |
+ * affinity. |
969 |
+@@ -908,6 +934,7 @@ static void hv_irq_unmask(struct irq_data *data) |
970 |
+ struct msi_desc *msi_desc = irq_data_get_msi_desc(data); |
971 |
+ struct irq_cfg *cfg = irqd_cfg(data); |
972 |
+ struct retarget_msi_interrupt *params; |
973 |
++ struct tran_int_desc *int_desc; |
974 |
+ struct hv_pcibus_device *hbus; |
975 |
+ struct cpumask *dest; |
976 |
+ struct pci_bus *pbus; |
977 |
+@@ -922,6 +949,7 @@ static void hv_irq_unmask(struct irq_data *data) |
978 |
+ pdev = msi_desc_to_pci_dev(msi_desc); |
979 |
+ pbus = pdev->bus; |
980 |
+ hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); |
981 |
++ int_desc = data->chip_data; |
982 |
+ |
983 |
+ spin_lock_irqsave(&hbus->retarget_msi_interrupt_lock, flags); |
984 |
+ |
985 |
+@@ -929,8 +957,8 @@ static void hv_irq_unmask(struct irq_data *data) |
986 |
+ memset(params, 0, sizeof(*params)); |
987 |
+ params->partition_id = HV_PARTITION_ID_SELF; |
988 |
+ params->int_entry.source = 1; /* MSI(-X) */ |
989 |
+- params->int_entry.address = msi_desc->msg.address_lo; |
990 |
+- params->int_entry.data = msi_desc->msg.data; |
991 |
++ params->int_entry.address = int_desc->address & 0xffffffff; |
992 |
++ params->int_entry.data = int_desc->data; |
993 |
+ params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | |
994 |
+ (hbus->hdev->dev_instance.b[4] << 16) | |
995 |
+ (hbus->hdev->dev_instance.b[7] << 8) | |
996 |
+@@ -1018,12 +1046,12 @@ static void hv_pci_compose_compl(void *context, struct pci_response *resp, |
997 |
+ |
998 |
+ static u32 hv_compose_msi_req_v1( |
999 |
+ struct pci_create_interrupt *int_pkt, struct cpumask *affinity, |
1000 |
+- u32 slot, u8 vector) |
1001 |
++ u32 slot, u8 vector, u8 vector_count) |
1002 |
+ { |
1003 |
+ int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE; |
1004 |
+ int_pkt->wslot.slot = slot; |
1005 |
+ int_pkt->int_desc.vector = vector; |
1006 |
+- int_pkt->int_desc.vector_count = 1; |
1007 |
++ int_pkt->int_desc.vector_count = vector_count; |
1008 |
+ int_pkt->int_desc.delivery_mode = dest_Fixed; |
1009 |
+ |
1010 |
+ /* |
1011 |
+@@ -1037,14 +1065,14 @@ static u32 hv_compose_msi_req_v1( |
1012 |
+ |
1013 |
+ static u32 hv_compose_msi_req_v2( |
1014 |
+ struct pci_create_interrupt2 *int_pkt, struct cpumask *affinity, |
1015 |
+- u32 slot, u8 vector) |
1016 |
++ u32 slot, u8 vector, u8 vector_count) |
1017 |
+ { |
1018 |
+ int cpu; |
1019 |
+ |
1020 |
+ int_pkt->message_type.type = PCI_CREATE_INTERRUPT_MESSAGE2; |
1021 |
+ int_pkt->wslot.slot = slot; |
1022 |
+ int_pkt->int_desc.vector = vector; |
1023 |
+- int_pkt->int_desc.vector_count = 1; |
1024 |
++ int_pkt->int_desc.vector_count = vector_count; |
1025 |
+ int_pkt->int_desc.delivery_mode = dest_Fixed; |
1026 |
+ |
1027 |
+ /* |
1028 |
+@@ -1072,7 +1100,6 @@ static u32 hv_compose_msi_req_v2( |
1029 |
+ */ |
1030 |
+ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) |
1031 |
+ { |
1032 |
+- struct irq_cfg *cfg = irqd_cfg(data); |
1033 |
+ struct hv_pcibus_device *hbus; |
1034 |
+ struct hv_pci_dev *hpdev; |
1035 |
+ struct pci_bus *pbus; |
1036 |
+@@ -1081,6 +1108,8 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) |
1037 |
+ unsigned long flags; |
1038 |
+ struct compose_comp_ctxt comp; |
1039 |
+ struct tran_int_desc *int_desc; |
1040 |
++ struct msi_desc *msi_desc; |
1041 |
++ u8 vector, vector_count; |
1042 |
+ struct { |
1043 |
+ struct pci_packet pci_pkt; |
1044 |
+ union { |
1045 |
+@@ -1092,7 +1121,17 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) |
1046 |
+ u32 size; |
1047 |
+ int ret; |
1048 |
+ |
1049 |
+- pdev = msi_desc_to_pci_dev(irq_data_get_msi_desc(data)); |
1050 |
++ /* Reuse the previous allocation */ |
1051 |
++ if (data->chip_data) { |
1052 |
++ int_desc = data->chip_data; |
1053 |
++ msg->address_hi = int_desc->address >> 32; |
1054 |
++ msg->address_lo = int_desc->address & 0xffffffff; |
1055 |
++ msg->data = int_desc->data; |
1056 |
++ return; |
1057 |
++ } |
1058 |
++ |
1059 |
++ msi_desc = irq_data_get_msi_desc(data); |
1060 |
++ pdev = msi_desc_to_pci_dev(msi_desc); |
1061 |
+ dest = irq_data_get_effective_affinity_mask(data); |
1062 |
+ pbus = pdev->bus; |
1063 |
+ hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); |
1064 |
+@@ -1100,17 +1139,40 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) |
1065 |
+ if (!hpdev) |
1066 |
+ goto return_null_message; |
1067 |
+ |
1068 |
+- /* Free any previous message that might have already been composed. */ |
1069 |
+- if (data->chip_data) { |
1070 |
+- int_desc = data->chip_data; |
1071 |
+- data->chip_data = NULL; |
1072 |
+- hv_int_desc_free(hpdev, int_desc); |
1073 |
+- } |
1074 |
+- |
1075 |
+ int_desc = kzalloc(sizeof(*int_desc), GFP_ATOMIC); |
1076 |
+ if (!int_desc) |
1077 |
+ goto drop_reference; |
1078 |
+ |
1079 |
++ if (!msi_desc->msi_attrib.is_msix && msi_desc->nvec_used > 1) { |
1080 |
++ /* |
1081 |
++ * If this is not the first MSI of Multi MSI, we already have |
1082 |
++ * a mapping. Can exit early. |
1083 |
++ */ |
1084 |
++ if (msi_desc->irq != data->irq) { |
1085 |
++ data->chip_data = int_desc; |
1086 |
++ int_desc->address = msi_desc->msg.address_lo | |
1087 |
++ (u64)msi_desc->msg.address_hi << 32; |
1088 |
++ int_desc->data = msi_desc->msg.data + |
1089 |
++ (data->irq - msi_desc->irq); |
1090 |
++ msg->address_hi = msi_desc->msg.address_hi; |
1091 |
++ msg->address_lo = msi_desc->msg.address_lo; |
1092 |
++ msg->data = int_desc->data; |
1093 |
++ put_pcichild(hpdev); |
1094 |
++ return; |
1095 |
++ } |
1096 |
++ /* |
1097 |
++ * The vector we select here is a dummy value. The correct |
1098 |
++ * value gets sent to the hypervisor in unmask(). This needs |
1099 |
++ * to be aligned with the count, and also not zero. Multi-msi |
1100 |
++ * is powers of 2 up to 32, so 32 will always work here. |
1101 |
++ */ |
1102 |
++ vector = 32; |
1103 |
++ vector_count = msi_desc->nvec_used; |
1104 |
++ } else { |
1105 |
++ vector = hv_msi_get_int_vector(data); |
1106 |
++ vector_count = 1; |
1107 |
++ } |
1108 |
++ |
1109 |
+ memset(&ctxt, 0, sizeof(ctxt)); |
1110 |
+ init_completion(&comp.comp_pkt.host_event); |
1111 |
+ ctxt.pci_pkt.completion_func = hv_pci_compose_compl; |
1112 |
+@@ -1121,14 +1183,16 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) |
1113 |
+ size = hv_compose_msi_req_v1(&ctxt.int_pkts.v1, |
1114 |
+ dest, |
1115 |
+ hpdev->desc.win_slot.slot, |
1116 |
+- cfg->vector); |
1117 |
++ vector, |
1118 |
++ vector_count); |
1119 |
+ break; |
1120 |
+ |
1121 |
+ case PCI_PROTOCOL_VERSION_1_2: |
1122 |
+ size = hv_compose_msi_req_v2(&ctxt.int_pkts.v2, |
1123 |
+ dest, |
1124 |
+ hpdev->desc.win_slot.slot, |
1125 |
+- cfg->vector); |
1126 |
++ vector, |
1127 |
++ vector_count); |
1128 |
+ break; |
1129 |
+ |
1130 |
+ default: |
1131 |
+@@ -1240,7 +1304,7 @@ static irq_hw_number_t hv_msi_domain_ops_get_hwirq(struct msi_domain_info *info, |
1132 |
+ |
1133 |
+ static struct msi_domain_ops hv_msi_ops = { |
1134 |
+ .get_hwirq = hv_msi_domain_ops_get_hwirq, |
1135 |
+- .msi_prepare = pci_msi_prepare, |
1136 |
++ .msi_prepare = hv_msi_prepare, |
1137 |
+ .set_desc = pci_msi_set_desc, |
1138 |
+ .msi_free = hv_msi_free, |
1139 |
+ }; |
1140 |
+diff --git a/drivers/power/reset/arm-versatile-reboot.c b/drivers/power/reset/arm-versatile-reboot.c |
1141 |
+index 06d34ab47df53..8022c782f6ff3 100644 |
1142 |
+--- a/drivers/power/reset/arm-versatile-reboot.c |
1143 |
++++ b/drivers/power/reset/arm-versatile-reboot.c |
1144 |
+@@ -150,6 +150,7 @@ static int __init versatile_reboot_probe(void) |
1145 |
+ versatile_reboot_type = (enum versatile_reboot)reboot_id->data; |
1146 |
+ |
1147 |
+ syscon_regmap = syscon_node_to_regmap(np); |
1148 |
++ of_node_put(np); |
1149 |
+ if (IS_ERR(syscon_regmap)) |
1150 |
+ return PTR_ERR(syscon_regmap); |
1151 |
+ |
1152 |
+diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h |
1153 |
+index c467589c7f452..c06d399b9b1f1 100644 |
1154 |
+--- a/drivers/s390/char/keyboard.h |
1155 |
++++ b/drivers/s390/char/keyboard.h |
1156 |
+@@ -56,7 +56,7 @@ static inline void |
1157 |
+ kbd_put_queue(struct tty_port *port, int ch) |
1158 |
+ { |
1159 |
+ tty_insert_flip_char(port, ch, 0); |
1160 |
+- tty_schedule_flip(port); |
1161 |
++ tty_flip_buffer_push(port); |
1162 |
+ } |
1163 |
+ |
1164 |
+ static inline void |
1165 |
+@@ -64,5 +64,5 @@ kbd_puts_queue(struct tty_port *port, char *cp) |
1166 |
+ { |
1167 |
+ while (*cp) |
1168 |
+ tty_insert_flip_char(port, *cp++, 0); |
1169 |
+- tty_schedule_flip(port); |
1170 |
++ tty_flip_buffer_push(port); |
1171 |
+ } |
1172 |
+diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |
1173 |
+index ad811c0438cc7..031526cb1b214 100644 |
1174 |
+--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |
1175 |
++++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |
1176 |
+@@ -267,6 +267,8 @@ static int rt2880_pinmux_pins(struct rt2880_priv *p) |
1177 |
+ p->func[i]->pin_count, |
1178 |
+ sizeof(int), |
1179 |
+ GFP_KERNEL); |
1180 |
++ if (!p->func[i]->pins) |
1181 |
++ return -ENOMEM; |
1182 |
+ for (j = 0; j < p->func[i]->pin_count; j++) |
1183 |
+ p->func[i]->pins[j] = p->func[i]->pin_first + j; |
1184 |
+ |
1185 |
+diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c |
1186 |
+index 5c282e8522fb3..8a44da5b05652 100644 |
1187 |
+--- a/drivers/staging/speakup/spk_ttyio.c |
1188 |
++++ b/drivers/staging/speakup/spk_ttyio.c |
1189 |
+@@ -88,7 +88,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty, |
1190 |
+ } |
1191 |
+ |
1192 |
+ if (!ldisc_data->buf_free) |
1193 |
+- /* ttyio_in will tty_schedule_flip */ |
1194 |
++ /* ttyio_in will tty_flip_buffer_push */ |
1195 |
+ return 0; |
1196 |
+ |
1197 |
+ /* Make sure the consumer has read buf before we have seen |
1198 |
+@@ -321,7 +321,7 @@ static unsigned char ttyio_in(int timeout) |
1199 |
+ mb(); |
1200 |
+ ldisc_data->buf_free = true; |
1201 |
+ /* Let TTY push more characters */ |
1202 |
+- tty_schedule_flip(speakup_tty->port); |
1203 |
++ tty_flip_buffer_push(speakup_tty->port); |
1204 |
+ |
1205 |
+ return rv; |
1206 |
+ } |
1207 |
+diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c |
1208 |
+index 6d3c58051ce33..db048dbe9f785 100644 |
1209 |
+--- a/drivers/tty/cyclades.c |
1210 |
++++ b/drivers/tty/cyclades.c |
1211 |
+@@ -556,7 +556,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, |
1212 |
+ } |
1213 |
+ info->idle_stats.recv_idle = jiffies; |
1214 |
+ } |
1215 |
+- tty_schedule_flip(port); |
1216 |
++ tty_flip_buffer_push(port); |
1217 |
+ |
1218 |
+ /* end of service */ |
1219 |
+ cyy_writeb(info, CyRIR, save_xir & 0x3f); |
1220 |
+@@ -996,7 +996,7 @@ static void cyz_handle_rx(struct cyclades_port *info) |
1221 |
+ mod_timer(&info->rx_full_timer, jiffies + 1); |
1222 |
+ #endif |
1223 |
+ info->idle_stats.recv_idle = jiffies; |
1224 |
+- tty_schedule_flip(&info->port); |
1225 |
++ tty_flip_buffer_push(&info->port); |
1226 |
+ |
1227 |
+ /* Update rx_get */ |
1228 |
+ cy_writel(&buf_ctrl->rx_get, new_rx_get); |
1229 |
+@@ -1172,7 +1172,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo) |
1230 |
+ if (delta_count) |
1231 |
+ wake_up_interruptible(&info->port.delta_msr_wait); |
1232 |
+ if (special_count) |
1233 |
+- tty_schedule_flip(&info->port); |
1234 |
++ tty_flip_buffer_push(&info->port); |
1235 |
+ } |
1236 |
+ } |
1237 |
+ |
1238 |
+diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c |
1239 |
+index 9180ca5e4dcd4..d6e82eb61fc2d 100644 |
1240 |
+--- a/drivers/tty/goldfish.c |
1241 |
++++ b/drivers/tty/goldfish.c |
1242 |
+@@ -151,7 +151,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) |
1243 |
+ address = (unsigned long)(void *)buf; |
1244 |
+ goldfish_tty_rw(qtty, address, count, 0); |
1245 |
+ |
1246 |
+- tty_schedule_flip(&qtty->port); |
1247 |
++ tty_flip_buffer_push(&qtty->port); |
1248 |
+ return IRQ_HANDLED; |
1249 |
+ } |
1250 |
+ |
1251 |
+diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c |
1252 |
+index 250a19f042d74..181381fa5126c 100644 |
1253 |
+--- a/drivers/tty/moxa.c |
1254 |
++++ b/drivers/tty/moxa.c |
1255 |
+@@ -1393,7 +1393,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, |
1256 |
+ if (inited && !tty_throttled(tty) && |
1257 |
+ MoxaPortRxQueue(p) > 0) { /* RX */ |
1258 |
+ MoxaPortReadData(p); |
1259 |
+- tty_schedule_flip(&p->port); |
1260 |
++ tty_flip_buffer_push(&p->port); |
1261 |
+ } |
1262 |
+ } else { |
1263 |
+ clear_bit(EMPTYWAIT, &p->statusflags); |
1264 |
+@@ -1418,7 +1418,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, |
1265 |
+ |
1266 |
+ if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */ |
1267 |
+ tty_insert_flip_char(&p->port, 0, TTY_BREAK); |
1268 |
+- tty_schedule_flip(&p->port); |
1269 |
++ tty_flip_buffer_push(&p->port); |
1270 |
+ } |
1271 |
+ |
1272 |
+ if (intr & IntrLine) |
1273 |
+diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
1274 |
+index c6a1d8c4e6894..73226e482e919 100644 |
1275 |
+--- a/drivers/tty/pty.c |
1276 |
++++ b/drivers/tty/pty.c |
1277 |
+@@ -111,21 +111,11 @@ static void pty_unthrottle(struct tty_struct *tty) |
1278 |
+ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
1279 |
+ { |
1280 |
+ struct tty_struct *to = tty->link; |
1281 |
+- unsigned long flags; |
1282 |
+ |
1283 |
+- if (tty->stopped) |
1284 |
++ if (tty->stopped || !c) |
1285 |
+ return 0; |
1286 |
+ |
1287 |
+- if (c > 0) { |
1288 |
+- spin_lock_irqsave(&to->port->lock, flags); |
1289 |
+- /* Stuff the data into the input queue of the other end */ |
1290 |
+- c = tty_insert_flip_string(to->port, buf, c); |
1291 |
+- spin_unlock_irqrestore(&to->port->lock, flags); |
1292 |
+- /* And shovel */ |
1293 |
+- if (c) |
1294 |
+- tty_flip_buffer_push(to->port); |
1295 |
+- } |
1296 |
+- return c; |
1297 |
++ return tty_insert_flip_string_and_push_buffer(to->port, buf, c); |
1298 |
+ } |
1299 |
+ |
1300 |
+ /** |
1301 |
+diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c |
1302 |
+index d1d73261575b2..9c145ed0dcf70 100644 |
1303 |
+--- a/drivers/tty/serial/lpc32xx_hs.c |
1304 |
++++ b/drivers/tty/serial/lpc32xx_hs.c |
1305 |
+@@ -341,7 +341,7 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) |
1306 |
+ LPC32XX_HSUART_IIR(port->membase)); |
1307 |
+ port->icount.overrun++; |
1308 |
+ tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
1309 |
+- tty_schedule_flip(tport); |
1310 |
++ tty_flip_buffer_push(tport); |
1311 |
+ } |
1312 |
+ |
1313 |
+ /* Data received? */ |
1314 |
+diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c |
1315 |
+index 77f3f3728a79e..6449c156c4d67 100644 |
1316 |
+--- a/drivers/tty/serial/mvebu-uart.c |
1317 |
++++ b/drivers/tty/serial/mvebu-uart.c |
1318 |
+@@ -442,14 +442,14 @@ static void mvebu_uart_shutdown(struct uart_port *port) |
1319 |
+ } |
1320 |
+ } |
1321 |
+ |
1322 |
+-static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) |
1323 |
++static unsigned int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) |
1324 |
+ { |
1325 |
+ struct mvebu_uart *mvuart = to_mvuart(port); |
1326 |
+ unsigned int d_divisor, m_divisor; |
1327 |
+ u32 brdv; |
1328 |
+ |
1329 |
+ if (IS_ERR(mvuart->clk)) |
1330 |
+- return -PTR_ERR(mvuart->clk); |
1331 |
++ return 0; |
1332 |
+ |
1333 |
+ /* |
1334 |
+ * The baudrate is derived from the UART clock thanks to two divisors: |
1335 |
+@@ -469,7 +469,7 @@ static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) |
1336 |
+ brdv |= d_divisor; |
1337 |
+ writel(brdv, port->membase + UART_BRDV); |
1338 |
+ |
1339 |
+- return 0; |
1340 |
++ return DIV_ROUND_CLOSEST(port->uartclk, d_divisor * m_divisor); |
1341 |
+ } |
1342 |
+ |
1343 |
+ static void mvebu_uart_set_termios(struct uart_port *port, |
1344 |
+@@ -506,15 +506,11 @@ static void mvebu_uart_set_termios(struct uart_port *port, |
1345 |
+ max_baud = 230400; |
1346 |
+ |
1347 |
+ baud = uart_get_baud_rate(port, termios, old, min_baud, max_baud); |
1348 |
+- if (mvebu_uart_baud_rate_set(port, baud)) { |
1349 |
+- /* No clock available, baudrate cannot be changed */ |
1350 |
+- if (old) |
1351 |
+- baud = uart_get_baud_rate(port, old, NULL, |
1352 |
+- min_baud, max_baud); |
1353 |
+- } else { |
1354 |
+- tty_termios_encode_baud_rate(termios, baud, baud); |
1355 |
+- uart_update_timeout(port, termios->c_cflag, baud); |
1356 |
+- } |
1357 |
++ baud = mvebu_uart_baud_rate_set(port, baud); |
1358 |
++ |
1359 |
++ /* In case baudrate cannot be changed, report previous old value */ |
1360 |
++ if (baud == 0 && old) |
1361 |
++ baud = tty_termios_baud_rate(old); |
1362 |
+ |
1363 |
+ /* Only the following flag changes are supported */ |
1364 |
+ if (old) { |
1365 |
+@@ -525,6 +521,11 @@ static void mvebu_uart_set_termios(struct uart_port *port, |
1366 |
+ termios->c_cflag |= CS8; |
1367 |
+ } |
1368 |
+ |
1369 |
++ if (baud != 0) { |
1370 |
++ tty_termios_encode_baud_rate(termios, baud, baud); |
1371 |
++ uart_update_timeout(port, termios->c_cflag, baud); |
1372 |
++ } |
1373 |
++ |
1374 |
+ spin_unlock_irqrestore(&port->lock, flags); |
1375 |
+ } |
1376 |
+ |
1377 |
+diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c |
1378 |
+index dfe0c8c22cd37..3ef4899c8f6a2 100644 |
1379 |
+--- a/drivers/tty/tty_buffer.c |
1380 |
++++ b/drivers/tty/tty_buffer.c |
1381 |
+@@ -389,27 +389,6 @@ int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag) |
1382 |
+ } |
1383 |
+ EXPORT_SYMBOL(__tty_insert_flip_char); |
1384 |
+ |
1385 |
+-/** |
1386 |
+- * tty_schedule_flip - push characters to ldisc |
1387 |
+- * @port: tty port to push from |
1388 |
+- * |
1389 |
+- * Takes any pending buffers and transfers their ownership to the |
1390 |
+- * ldisc side of the queue. It then schedules those characters for |
1391 |
+- * processing by the line discipline. |
1392 |
+- */ |
1393 |
+- |
1394 |
+-void tty_schedule_flip(struct tty_port *port) |
1395 |
+-{ |
1396 |
+- struct tty_bufhead *buf = &port->buf; |
1397 |
+- |
1398 |
+- /* paired w/ acquire in flush_to_ldisc(); ensures |
1399 |
+- * flush_to_ldisc() sees buffer data. |
1400 |
+- */ |
1401 |
+- smp_store_release(&buf->tail->commit, buf->tail->used); |
1402 |
+- queue_work(system_unbound_wq, &buf->work); |
1403 |
+-} |
1404 |
+-EXPORT_SYMBOL(tty_schedule_flip); |
1405 |
+- |
1406 |
+ /** |
1407 |
+ * tty_prepare_flip_string - make room for characters |
1408 |
+ * @port: tty port |
1409 |
+@@ -539,6 +518,15 @@ static void flush_to_ldisc(struct work_struct *work) |
1410 |
+ |
1411 |
+ } |
1412 |
+ |
1413 |
++static inline void tty_flip_buffer_commit(struct tty_buffer *tail) |
1414 |
++{ |
1415 |
++ /* |
1416 |
++ * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees |
1417 |
++ * buffer data. |
1418 |
++ */ |
1419 |
++ smp_store_release(&tail->commit, tail->used); |
1420 |
++} |
1421 |
++ |
1422 |
+ /** |
1423 |
+ * tty_flip_buffer_push - terminal |
1424 |
+ * @port: tty port to push |
1425 |
+@@ -552,10 +540,44 @@ static void flush_to_ldisc(struct work_struct *work) |
1426 |
+ |
1427 |
+ void tty_flip_buffer_push(struct tty_port *port) |
1428 |
+ { |
1429 |
+- tty_schedule_flip(port); |
1430 |
++ struct tty_bufhead *buf = &port->buf; |
1431 |
++ |
1432 |
++ tty_flip_buffer_commit(buf->tail); |
1433 |
++ queue_work(system_unbound_wq, &buf->work); |
1434 |
+ } |
1435 |
+ EXPORT_SYMBOL(tty_flip_buffer_push); |
1436 |
+ |
1437 |
++/** |
1438 |
++ * tty_insert_flip_string_and_push_buffer - add characters to the tty buffer and |
1439 |
++ * push |
1440 |
++ * @port: tty port |
1441 |
++ * @chars: characters |
1442 |
++ * @size: size |
1443 |
++ * |
1444 |
++ * The function combines tty_insert_flip_string() and tty_flip_buffer_push() |
1445 |
++ * with the exception of properly holding the @port->lock. |
1446 |
++ * |
1447 |
++ * To be used only internally (by pty currently). |
1448 |
++ * |
1449 |
++ * Returns: the number added. |
1450 |
++ */ |
1451 |
++int tty_insert_flip_string_and_push_buffer(struct tty_port *port, |
1452 |
++ const unsigned char *chars, size_t size) |
1453 |
++{ |
1454 |
++ struct tty_bufhead *buf = &port->buf; |
1455 |
++ unsigned long flags; |
1456 |
++ |
1457 |
++ spin_lock_irqsave(&port->lock, flags); |
1458 |
++ size = tty_insert_flip_string(port, chars, size); |
1459 |
++ if (size) |
1460 |
++ tty_flip_buffer_commit(buf->tail); |
1461 |
++ spin_unlock_irqrestore(&port->lock, flags); |
1462 |
++ |
1463 |
++ queue_work(system_unbound_wq, &buf->work); |
1464 |
++ |
1465 |
++ return size; |
1466 |
++} |
1467 |
++ |
1468 |
+ /** |
1469 |
+ * tty_buffer_init - prepare a tty buffer structure |
1470 |
+ * @tty: tty to initialise |
1471 |
+diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c |
1472 |
+index 94cad9f86ff98..e3aac11d770fe 100644 |
1473 |
+--- a/drivers/tty/vt/keyboard.c |
1474 |
++++ b/drivers/tty/vt/keyboard.c |
1475 |
+@@ -310,7 +310,7 @@ int kbd_rate(struct kbd_repeat *rpt) |
1476 |
+ static void put_queue(struct vc_data *vc, int ch) |
1477 |
+ { |
1478 |
+ tty_insert_flip_char(&vc->port, ch, 0); |
1479 |
+- tty_schedule_flip(&vc->port); |
1480 |
++ tty_flip_buffer_push(&vc->port); |
1481 |
+ } |
1482 |
+ |
1483 |
+ static void puts_queue(struct vc_data *vc, char *cp) |
1484 |
+@@ -319,7 +319,7 @@ static void puts_queue(struct vc_data *vc, char *cp) |
1485 |
+ tty_insert_flip_char(&vc->port, *cp, 0); |
1486 |
+ cp++; |
1487 |
+ } |
1488 |
+- tty_schedule_flip(&vc->port); |
1489 |
++ tty_flip_buffer_push(&vc->port); |
1490 |
+ } |
1491 |
+ |
1492 |
+ static void applkey(struct vc_data *vc, int key, char mode) |
1493 |
+@@ -564,7 +564,7 @@ static void fn_inc_console(struct vc_data *vc) |
1494 |
+ static void fn_send_intr(struct vc_data *vc) |
1495 |
+ { |
1496 |
+ tty_insert_flip_char(&vc->port, 0, TTY_BREAK); |
1497 |
+- tty_schedule_flip(&vc->port); |
1498 |
++ tty_flip_buffer_push(&vc->port); |
1499 |
+ } |
1500 |
+ |
1501 |
+ static void fn_scroll_forw(struct vc_data *vc) |
1502 |
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
1503 |
+index dca627ccece57..20565603a3658 100644 |
1504 |
+--- a/drivers/tty/vt/vt.c |
1505 |
++++ b/drivers/tty/vt/vt.c |
1506 |
+@@ -1838,7 +1838,7 @@ static void respond_string(const char *p, struct tty_port *port) |
1507 |
+ tty_insert_flip_char(port, *p, 0); |
1508 |
+ p++; |
1509 |
+ } |
1510 |
+- tty_schedule_flip(port); |
1511 |
++ tty_flip_buffer_push(port); |
1512 |
+ } |
1513 |
+ |
1514 |
+ static void cursor_report(struct vc_data *vc, struct tty_struct *tty) |
1515 |
+diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c |
1516 |
+index 492084814f55d..27d955c5d9f90 100644 |
1517 |
+--- a/drivers/xen/gntdev.c |
1518 |
++++ b/drivers/xen/gntdev.c |
1519 |
+@@ -416,7 +416,8 @@ static void __unmap_grant_pages_done(int result, |
1520 |
+ unsigned int offset = data->unmap_ops - map->unmap_ops; |
1521 |
+ |
1522 |
+ for (i = 0; i < data->count; i++) { |
1523 |
+- WARN_ON(map->unmap_ops[offset+i].status); |
1524 |
++ WARN_ON(map->unmap_ops[offset+i].status && |
1525 |
++ map->unmap_ops[offset+i].handle != -1); |
1526 |
+ pr_debug("unmap handle=%d st=%d\n", |
1527 |
+ map->unmap_ops[offset+i].handle, |
1528 |
+ map->unmap_ops[offset+i].status); |
1529 |
+diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c |
1530 |
+index ac53403e9edb5..35bfb681bf133 100644 |
1531 |
+--- a/fs/dlm/lock.c |
1532 |
++++ b/fs/dlm/lock.c |
1533 |
+@@ -4069,13 +4069,14 @@ static void send_repeat_remove(struct dlm_ls *ls, char *ms_name, int len) |
1534 |
+ rv = _create_message(ls, sizeof(struct dlm_message) + len, |
1535 |
+ dir_nodeid, DLM_MSG_REMOVE, &ms, &mh); |
1536 |
+ if (rv) |
1537 |
+- return; |
1538 |
++ goto out; |
1539 |
+ |
1540 |
+ memcpy(ms->m_extra, name, len); |
1541 |
+ ms->m_hash = hash; |
1542 |
+ |
1543 |
+ send_message(mh, ms); |
1544 |
+ |
1545 |
++out: |
1546 |
+ spin_lock(&ls->ls_remove_spin); |
1547 |
+ ls->ls_remove_len = 0; |
1548 |
+ memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN); |
1549 |
+diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h |
1550 |
+index 767f62086bd9b..c326bfdb5ec2c 100644 |
1551 |
+--- a/include/linux/tty_flip.h |
1552 |
++++ b/include/linux/tty_flip.h |
1553 |
+@@ -12,7 +12,6 @@ extern int tty_insert_flip_string_fixed_flag(struct tty_port *port, |
1554 |
+ extern int tty_prepare_flip_string(struct tty_port *port, |
1555 |
+ unsigned char **chars, size_t size); |
1556 |
+ extern void tty_flip_buffer_push(struct tty_port *port); |
1557 |
+-void tty_schedule_flip(struct tty_port *port); |
1558 |
+ int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag); |
1559 |
+ |
1560 |
+ static inline int tty_insert_flip_char(struct tty_port *port, |
1561 |
+@@ -40,4 +39,7 @@ static inline int tty_insert_flip_string(struct tty_port *port, |
1562 |
+ extern void tty_buffer_lock_exclusive(struct tty_port *port); |
1563 |
+ extern void tty_buffer_unlock_exclusive(struct tty_port *port); |
1564 |
+ |
1565 |
++int tty_insert_flip_string_and_push_buffer(struct tty_port *port, |
1566 |
++ const unsigned char *chars, size_t cnt); |
1567 |
++ |
1568 |
+ #endif /* _LINUX_TTY_FLIP_H */ |
1569 |
+diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h |
1570 |
+index fabee6db0abb7..421d41ef4e9ca 100644 |
1571 |
+--- a/include/net/bluetooth/bluetooth.h |
1572 |
++++ b/include/net/bluetooth/bluetooth.h |
1573 |
+@@ -370,6 +370,71 @@ out: |
1574 |
+ return NULL; |
1575 |
+ } |
1576 |
+ |
1577 |
++/* Shall not be called with lock_sock held */ |
1578 |
++static inline struct sk_buff *bt_skb_sendmsg(struct sock *sk, |
1579 |
++ struct msghdr *msg, |
1580 |
++ size_t len, size_t mtu, |
1581 |
++ size_t headroom, size_t tailroom) |
1582 |
++{ |
1583 |
++ struct sk_buff *skb; |
1584 |
++ size_t size = min_t(size_t, len, mtu); |
1585 |
++ int err; |
1586 |
++ |
1587 |
++ skb = bt_skb_send_alloc(sk, size + headroom + tailroom, |
1588 |
++ msg->msg_flags & MSG_DONTWAIT, &err); |
1589 |
++ if (!skb) |
1590 |
++ return ERR_PTR(err); |
1591 |
++ |
1592 |
++ skb_reserve(skb, headroom); |
1593 |
++ skb_tailroom_reserve(skb, mtu, tailroom); |
1594 |
++ |
1595 |
++ if (!copy_from_iter_full(skb_put(skb, size), size, &msg->msg_iter)) { |
1596 |
++ kfree_skb(skb); |
1597 |
++ return ERR_PTR(-EFAULT); |
1598 |
++ } |
1599 |
++ |
1600 |
++ skb->priority = sk->sk_priority; |
1601 |
++ |
1602 |
++ return skb; |
1603 |
++} |
1604 |
++ |
1605 |
++/* Similar to bt_skb_sendmsg but can split the msg into multiple fragments |
1606 |
++ * accourding to the MTU. |
1607 |
++ */ |
1608 |
++static inline struct sk_buff *bt_skb_sendmmsg(struct sock *sk, |
1609 |
++ struct msghdr *msg, |
1610 |
++ size_t len, size_t mtu, |
1611 |
++ size_t headroom, size_t tailroom) |
1612 |
++{ |
1613 |
++ struct sk_buff *skb, **frag; |
1614 |
++ |
1615 |
++ skb = bt_skb_sendmsg(sk, msg, len, mtu, headroom, tailroom); |
1616 |
++ if (IS_ERR_OR_NULL(skb)) |
1617 |
++ return skb; |
1618 |
++ |
1619 |
++ len -= skb->len; |
1620 |
++ if (!len) |
1621 |
++ return skb; |
1622 |
++ |
1623 |
++ /* Add remaining data over MTU as continuation fragments */ |
1624 |
++ frag = &skb_shinfo(skb)->frag_list; |
1625 |
++ while (len) { |
1626 |
++ struct sk_buff *tmp; |
1627 |
++ |
1628 |
++ tmp = bt_skb_sendmsg(sk, msg, len, mtu, headroom, tailroom); |
1629 |
++ if (IS_ERR(tmp)) { |
1630 |
++ return skb; |
1631 |
++ } |
1632 |
++ |
1633 |
++ len -= tmp->len; |
1634 |
++ |
1635 |
++ *frag = tmp; |
1636 |
++ frag = &(*frag)->next; |
1637 |
++ } |
1638 |
++ |
1639 |
++ return skb; |
1640 |
++} |
1641 |
++ |
1642 |
+ int bt_to_errno(u16 code); |
1643 |
+ |
1644 |
+ void hci_sock_set_flag(struct sock *sk, int nr); |
1645 |
+diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h |
1646 |
+index a80fd0ac45632..d5552ff1d361e 100644 |
1647 |
+--- a/include/net/inet_sock.h |
1648 |
++++ b/include/net/inet_sock.h |
1649 |
+@@ -111,7 +111,8 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) |
1650 |
+ |
1651 |
+ static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb) |
1652 |
+ { |
1653 |
+- if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) |
1654 |
++ if (!sk->sk_mark && |
1655 |
++ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept)) |
1656 |
+ return skb->mark; |
1657 |
+ |
1658 |
+ return sk->sk_mark; |
1659 |
+@@ -357,7 +358,7 @@ static inline bool inet_get_convert_csum(struct sock *sk) |
1660 |
+ static inline bool inet_can_nonlocal_bind(struct net *net, |
1661 |
+ struct inet_sock *inet) |
1662 |
+ { |
1663 |
+- return net->ipv4.sysctl_ip_nonlocal_bind || |
1664 |
++ return READ_ONCE(net->ipv4.sysctl_ip_nonlocal_bind) || |
1665 |
+ inet->freebind || inet->transparent; |
1666 |
+ } |
1667 |
+ |
1668 |
+diff --git a/include/net/ip.h b/include/net/ip.h |
1669 |
+index d1a4efedbc039..0f820e68bd8fc 100644 |
1670 |
+--- a/include/net/ip.h |
1671 |
++++ b/include/net/ip.h |
1672 |
+@@ -341,7 +341,7 @@ void ipfrag_init(void); |
1673 |
+ void ip_static_sysctl_init(void); |
1674 |
+ |
1675 |
+ #define IP4_REPLY_MARK(net, mark) \ |
1676 |
+- ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) |
1677 |
++ (READ_ONCE((net)->ipv4.sysctl_fwmark_reflect) ? (mark) : 0) |
1678 |
+ |
1679 |
+ static inline bool ip_is_fragment(const struct iphdr *iph) |
1680 |
+ { |
1681 |
+@@ -402,7 +402,7 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, |
1682 |
+ struct net *net = dev_net(dst->dev); |
1683 |
+ unsigned int mtu; |
1684 |
+ |
1685 |
+- if (net->ipv4.sysctl_ip_fwd_use_pmtu || |
1686 |
++ if (READ_ONCE(net->ipv4.sysctl_ip_fwd_use_pmtu) || |
1687 |
+ ip_mtu_locked(dst) || |
1688 |
+ !forwarding) |
1689 |
+ return dst_mtu(dst); |
1690 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
1691 |
+index 5c5807ed66eef..d28fa78dedb54 100644 |
1692 |
+--- a/include/net/tcp.h |
1693 |
++++ b/include/net/tcp.h |
1694 |
+@@ -1339,8 +1339,8 @@ static inline void tcp_slow_start_after_idle_check(struct sock *sk) |
1695 |
+ struct tcp_sock *tp = tcp_sk(sk); |
1696 |
+ s32 delta; |
1697 |
+ |
1698 |
+- if (!sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle || tp->packets_out || |
1699 |
+- ca_ops->cong_control) |
1700 |
++ if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle) || |
1701 |
++ tp->packets_out || ca_ops->cong_control) |
1702 |
+ return; |
1703 |
+ delta = tcp_jiffies32 - tp->lsndtime; |
1704 |
+ if (delta > inet_csk(sk)->icsk_rto) |
1705 |
+@@ -1430,7 +1430,8 @@ static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp) |
1706 |
+ |
1707 |
+ static inline int tcp_fin_time(const struct sock *sk) |
1708 |
+ { |
1709 |
+- int fin_timeout = tcp_sk(sk)->linger2 ? : sock_net(sk)->ipv4.sysctl_tcp_fin_timeout; |
1710 |
++ int fin_timeout = tcp_sk(sk)->linger2 ? : |
1711 |
++ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fin_timeout); |
1712 |
+ const int rto = inet_csk(sk)->icsk_rto; |
1713 |
+ |
1714 |
+ if (fin_timeout < (rto << 2) - (rto >> 1)) |
1715 |
+@@ -1875,7 +1876,7 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr); |
1716 |
+ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) |
1717 |
+ { |
1718 |
+ struct net *net = sock_net((struct sock *)tp); |
1719 |
+- return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat; |
1720 |
++ return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); |
1721 |
+ } |
1722 |
+ |
1723 |
+ static inline bool tcp_stream_memory_free(const struct sock *sk) |
1724 |
+diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c |
1725 |
+index 4e5b5ae05406e..cbbd0168f50c5 100644 |
1726 |
+--- a/kernel/bpf/core.c |
1727 |
++++ b/kernel/bpf/core.c |
1728 |
+@@ -66,11 +66,13 @@ void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, uns |
1729 |
+ { |
1730 |
+ u8 *ptr = NULL; |
1731 |
+ |
1732 |
+- if (k >= SKF_NET_OFF) |
1733 |
++ if (k >= SKF_NET_OFF) { |
1734 |
+ ptr = skb_network_header(skb) + k - SKF_NET_OFF; |
1735 |
+- else if (k >= SKF_LL_OFF) |
1736 |
++ } else if (k >= SKF_LL_OFF) { |
1737 |
++ if (unlikely(!skb_mac_header_was_set(skb))) |
1738 |
++ return NULL; |
1739 |
+ ptr = skb_mac_header(skb) + k - SKF_LL_OFF; |
1740 |
+- |
1741 |
++ } |
1742 |
+ if (ptr >= skb->head && ptr + size <= skb_tail_pointer(skb)) |
1743 |
+ return ptr; |
1744 |
+ |
1745 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
1746 |
+index 88dd1398ae889..ba66ea3ca7056 100644 |
1747 |
+--- a/kernel/events/core.c |
1748 |
++++ b/kernel/events/core.c |
1749 |
+@@ -5719,10 +5719,10 @@ again: |
1750 |
+ |
1751 |
+ if (!atomic_inc_not_zero(&event->rb->mmap_count)) { |
1752 |
+ /* |
1753 |
+- * Raced against perf_mmap_close() through |
1754 |
+- * perf_event_set_output(). Try again, hope for better |
1755 |
+- * luck. |
1756 |
++ * Raced against perf_mmap_close(); remove the |
1757 |
++ * event and try again. |
1758 |
+ */ |
1759 |
++ ring_buffer_attach(event, NULL); |
1760 |
+ mutex_unlock(&event->mmap_mutex); |
1761 |
+ goto again; |
1762 |
+ } |
1763 |
+@@ -10396,14 +10396,25 @@ err_size: |
1764 |
+ goto out; |
1765 |
+ } |
1766 |
+ |
1767 |
++static void mutex_lock_double(struct mutex *a, struct mutex *b) |
1768 |
++{ |
1769 |
++ if (b < a) |
1770 |
++ swap(a, b); |
1771 |
++ |
1772 |
++ mutex_lock(a); |
1773 |
++ mutex_lock_nested(b, SINGLE_DEPTH_NESTING); |
1774 |
++} |
1775 |
++ |
1776 |
+ static int |
1777 |
+ perf_event_set_output(struct perf_event *event, struct perf_event *output_event) |
1778 |
+ { |
1779 |
+ struct ring_buffer *rb = NULL; |
1780 |
+ int ret = -EINVAL; |
1781 |
+ |
1782 |
+- if (!output_event) |
1783 |
++ if (!output_event) { |
1784 |
++ mutex_lock(&event->mmap_mutex); |
1785 |
+ goto set; |
1786 |
++ } |
1787 |
+ |
1788 |
+ /* don't allow circular references */ |
1789 |
+ if (event == output_event) |
1790 |
+@@ -10441,8 +10452,15 @@ perf_event_set_output(struct perf_event *event, struct perf_event *output_event) |
1791 |
+ event->pmu != output_event->pmu) |
1792 |
+ goto out; |
1793 |
+ |
1794 |
++ /* |
1795 |
++ * Hold both mmap_mutex to serialize against perf_mmap_close(). Since |
1796 |
++ * output_event is already on rb->event_list, and the list iteration |
1797 |
++ * restarts after every removal, it is guaranteed this new event is |
1798 |
++ * observed *OR* if output_event is already removed, it's guaranteed we |
1799 |
++ * observe !rb->mmap_count. |
1800 |
++ */ |
1801 |
++ mutex_lock_double(&event->mmap_mutex, &output_event->mmap_mutex); |
1802 |
+ set: |
1803 |
+- mutex_lock(&event->mmap_mutex); |
1804 |
+ /* Can't redirect output if we've got an active mmap() */ |
1805 |
+ if (atomic_read(&event->mmap_count)) |
1806 |
+ goto unlock; |
1807 |
+@@ -10452,6 +10470,12 @@ set: |
1808 |
+ rb = ring_buffer_get(output_event); |
1809 |
+ if (!rb) |
1810 |
+ goto unlock; |
1811 |
++ |
1812 |
++ /* did we race against perf_mmap_close() */ |
1813 |
++ if (!atomic_read(&rb->mmap_count)) { |
1814 |
++ ring_buffer_put(rb); |
1815 |
++ goto unlock; |
1816 |
++ } |
1817 |
+ } |
1818 |
+ |
1819 |
+ ring_buffer_attach(event, rb); |
1820 |
+@@ -10459,20 +10483,13 @@ set: |
1821 |
+ ret = 0; |
1822 |
+ unlock: |
1823 |
+ mutex_unlock(&event->mmap_mutex); |
1824 |
++ if (output_event) |
1825 |
++ mutex_unlock(&output_event->mmap_mutex); |
1826 |
+ |
1827 |
+ out: |
1828 |
+ return ret; |
1829 |
+ } |
1830 |
+ |
1831 |
+-static void mutex_lock_double(struct mutex *a, struct mutex *b) |
1832 |
+-{ |
1833 |
+- if (b < a) |
1834 |
+- swap(a, b); |
1835 |
+- |
1836 |
+- mutex_lock(a); |
1837 |
+- mutex_lock_nested(b, SINGLE_DEPTH_NESTING); |
1838 |
+-} |
1839 |
+- |
1840 |
+ static int perf_event_set_clock(struct perf_event *event, clockid_t clk_id) |
1841 |
+ { |
1842 |
+ bool nmi_safe = false; |
1843 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
1844 |
+index 5ada8897ef0ef..e44e737e90a35 100644 |
1845 |
+--- a/mm/mempolicy.c |
1846 |
++++ b/mm/mempolicy.c |
1847 |
+@@ -348,7 +348,7 @@ static void mpol_rebind_preferred(struct mempolicy *pol, |
1848 |
+ */ |
1849 |
+ static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *newmask) |
1850 |
+ { |
1851 |
+- if (!pol) |
1852 |
++ if (!pol || pol->mode == MPOL_LOCAL) |
1853 |
+ return; |
1854 |
+ if (!mpol_store_user_nodemask(pol) && !(pol->flags & MPOL_F_LOCAL) && |
1855 |
+ nodes_equal(pol->w.cpuset_mems_allowed, *newmask)) |
1856 |
+diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c |
1857 |
+index b98225d65e87a..e4eaf5d2acbd8 100644 |
1858 |
+--- a/net/bluetooth/rfcomm/core.c |
1859 |
++++ b/net/bluetooth/rfcomm/core.c |
1860 |
+@@ -552,22 +552,58 @@ struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel) |
1861 |
+ return dlc; |
1862 |
+ } |
1863 |
+ |
1864 |
++static int rfcomm_dlc_send_frag(struct rfcomm_dlc *d, struct sk_buff *frag) |
1865 |
++{ |
1866 |
++ int len = frag->len; |
1867 |
++ |
1868 |
++ BT_DBG("dlc %p mtu %d len %d", d, d->mtu, len); |
1869 |
++ |
1870 |
++ if (len > d->mtu) |
1871 |
++ return -EINVAL; |
1872 |
++ |
1873 |
++ rfcomm_make_uih(frag, d->addr); |
1874 |
++ __skb_queue_tail(&d->tx_queue, frag); |
1875 |
++ |
1876 |
++ return len; |
1877 |
++} |
1878 |
++ |
1879 |
+ int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb) |
1880 |
+ { |
1881 |
+- int len = skb->len; |
1882 |
++ unsigned long flags; |
1883 |
++ struct sk_buff *frag, *next; |
1884 |
++ int len; |
1885 |
+ |
1886 |
+ if (d->state != BT_CONNECTED) |
1887 |
+ return -ENOTCONN; |
1888 |
+ |
1889 |
+- BT_DBG("dlc %p mtu %d len %d", d, d->mtu, len); |
1890 |
++ frag = skb_shinfo(skb)->frag_list; |
1891 |
++ skb_shinfo(skb)->frag_list = NULL; |
1892 |
+ |
1893 |
+- if (len > d->mtu) |
1894 |
+- return -EINVAL; |
1895 |
++ /* Queue all fragments atomically. */ |
1896 |
++ spin_lock_irqsave(&d->tx_queue.lock, flags); |
1897 |
+ |
1898 |
+- rfcomm_make_uih(skb, d->addr); |
1899 |
+- skb_queue_tail(&d->tx_queue, skb); |
1900 |
++ len = rfcomm_dlc_send_frag(d, skb); |
1901 |
++ if (len < 0 || !frag) |
1902 |
++ goto unlock; |
1903 |
++ |
1904 |
++ for (; frag; frag = next) { |
1905 |
++ int ret; |
1906 |
++ |
1907 |
++ next = frag->next; |
1908 |
++ |
1909 |
++ ret = rfcomm_dlc_send_frag(d, frag); |
1910 |
++ if (ret < 0) { |
1911 |
++ kfree_skb(frag); |
1912 |
++ goto unlock; |
1913 |
++ } |
1914 |
++ |
1915 |
++ len += ret; |
1916 |
++ } |
1917 |
++ |
1918 |
++unlock: |
1919 |
++ spin_unlock_irqrestore(&d->tx_queue.lock, flags); |
1920 |
+ |
1921 |
+- if (!test_bit(RFCOMM_TX_THROTTLED, &d->flags)) |
1922 |
++ if (len > 0 && !test_bit(RFCOMM_TX_THROTTLED, &d->flags)) |
1923 |
+ rfcomm_schedule(); |
1924 |
+ return len; |
1925 |
+ } |
1926 |
+diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c |
1927 |
+index c044ff2f73e6c..78830efe89d73 100644 |
1928 |
+--- a/net/bluetooth/rfcomm/sock.c |
1929 |
++++ b/net/bluetooth/rfcomm/sock.c |
1930 |
+@@ -578,46 +578,20 @@ static int rfcomm_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
1931 |
+ lock_sock(sk); |
1932 |
+ |
1933 |
+ sent = bt_sock_wait_ready(sk, msg->msg_flags); |
1934 |
+- if (sent) |
1935 |
+- goto done; |
1936 |
+- |
1937 |
+- while (len) { |
1938 |
+- size_t size = min_t(size_t, len, d->mtu); |
1939 |
+- int err; |
1940 |
+- |
1941 |
+- skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE, |
1942 |
+- msg->msg_flags & MSG_DONTWAIT, &err); |
1943 |
+- if (!skb) { |
1944 |
+- if (sent == 0) |
1945 |
+- sent = err; |
1946 |
+- break; |
1947 |
+- } |
1948 |
+- skb_reserve(skb, RFCOMM_SKB_HEAD_RESERVE); |
1949 |
+- |
1950 |
+- err = memcpy_from_msg(skb_put(skb, size), msg, size); |
1951 |
+- if (err) { |
1952 |
+- kfree_skb(skb); |
1953 |
+- if (sent == 0) |
1954 |
+- sent = err; |
1955 |
+- break; |
1956 |
+- } |
1957 |
+ |
1958 |
+- skb->priority = sk->sk_priority; |
1959 |
++ release_sock(sk); |
1960 |
+ |
1961 |
+- err = rfcomm_dlc_send(d, skb); |
1962 |
+- if (err < 0) { |
1963 |
+- kfree_skb(skb); |
1964 |
+- if (sent == 0) |
1965 |
+- sent = err; |
1966 |
+- break; |
1967 |
+- } |
1968 |
++ if (sent) |
1969 |
++ return sent; |
1970 |
+ |
1971 |
+- sent += size; |
1972 |
+- len -= size; |
1973 |
+- } |
1974 |
++ skb = bt_skb_sendmmsg(sk, msg, len, d->mtu, RFCOMM_SKB_HEAD_RESERVE, |
1975 |
++ RFCOMM_SKB_TAIL_RESERVE); |
1976 |
++ if (IS_ERR(skb)) |
1977 |
++ return PTR_ERR(skb); |
1978 |
+ |
1979 |
+-done: |
1980 |
+- release_sock(sk); |
1981 |
++ sent = rfcomm_dlc_send(d, skb); |
1982 |
++ if (sent < 0) |
1983 |
++ kfree_skb(skb); |
1984 |
+ |
1985 |
+ return sent; |
1986 |
+ } |
1987 |
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c |
1988 |
+index 14b5288d1432b..ee321d62b7d6e 100644 |
1989 |
+--- a/net/bluetooth/sco.c |
1990 |
++++ b/net/bluetooth/sco.c |
1991 |
+@@ -279,12 +279,10 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk) |
1992 |
+ return err; |
1993 |
+ } |
1994 |
+ |
1995 |
+-static int sco_send_frame(struct sock *sk, void *buf, int len, |
1996 |
+- unsigned int msg_flags) |
1997 |
++static int sco_send_frame(struct sock *sk, struct sk_buff *skb) |
1998 |
+ { |
1999 |
+ struct sco_conn *conn = sco_pi(sk)->conn; |
2000 |
+- struct sk_buff *skb; |
2001 |
+- int err; |
2002 |
++ int len = skb->len; |
2003 |
+ |
2004 |
+ /* Check outgoing MTU */ |
2005 |
+ if (len > conn->mtu) |
2006 |
+@@ -292,11 +290,6 @@ static int sco_send_frame(struct sock *sk, void *buf, int len, |
2007 |
+ |
2008 |
+ BT_DBG("sk %p len %d", sk, len); |
2009 |
+ |
2010 |
+- skb = bt_skb_send_alloc(sk, len, msg_flags & MSG_DONTWAIT, &err); |
2011 |
+- if (!skb) |
2012 |
+- return err; |
2013 |
+- |
2014 |
+- memcpy(skb_put(skb, len), buf, len); |
2015 |
+ hci_send_sco(conn->hcon, skb); |
2016 |
+ |
2017 |
+ return len; |
2018 |
+@@ -715,7 +708,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
2019 |
+ size_t len) |
2020 |
+ { |
2021 |
+ struct sock *sk = sock->sk; |
2022 |
+- void *buf; |
2023 |
++ struct sk_buff *skb; |
2024 |
+ int err; |
2025 |
+ |
2026 |
+ BT_DBG("sock %p, sk %p", sock, sk); |
2027 |
+@@ -727,24 +720,21 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, |
2028 |
+ if (msg->msg_flags & MSG_OOB) |
2029 |
+ return -EOPNOTSUPP; |
2030 |
+ |
2031 |
+- buf = kmalloc(len, GFP_KERNEL); |
2032 |
+- if (!buf) |
2033 |
+- return -ENOMEM; |
2034 |
+- |
2035 |
+- if (memcpy_from_msg(buf, msg, len)) { |
2036 |
+- kfree(buf); |
2037 |
+- return -EFAULT; |
2038 |
+- } |
2039 |
++ skb = bt_skb_sendmsg(sk, msg, len, len, 0, 0); |
2040 |
++ if (IS_ERR(skb)) |
2041 |
++ return PTR_ERR(skb); |
2042 |
+ |
2043 |
+ lock_sock(sk); |
2044 |
+ |
2045 |
+ if (sk->sk_state == BT_CONNECTED) |
2046 |
+- err = sco_send_frame(sk, buf, len, msg->msg_flags); |
2047 |
++ err = sco_send_frame(sk, skb); |
2048 |
+ else |
2049 |
+ err = -ENOTCONN; |
2050 |
+ |
2051 |
+ release_sock(sk); |
2052 |
+- kfree(buf); |
2053 |
++ |
2054 |
++ if (err < 0) |
2055 |
++ kfree_skb(skb); |
2056 |
+ return err; |
2057 |
+ } |
2058 |
+ |
2059 |
+diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c |
2060 |
+index dadd42a07c071..229519001cc31 100644 |
2061 |
+--- a/net/ipv4/af_inet.c |
2062 |
++++ b/net/ipv4/af_inet.c |
2063 |
+@@ -218,7 +218,7 @@ int inet_listen(struct socket *sock, int backlog) |
2064 |
+ * because the socket was in TCP_LISTEN state previously but |
2065 |
+ * was shutdown() rather than close(). |
2066 |
+ */ |
2067 |
+- tcp_fastopen = sock_net(sk)->ipv4.sysctl_tcp_fastopen; |
2068 |
++ tcp_fastopen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen); |
2069 |
+ if ((tcp_fastopen & TFO_SERVER_WO_SOCKOPT1) && |
2070 |
+ (tcp_fastopen & TFO_SERVER_ENABLE) && |
2071 |
+ !inet_csk(sk)->icsk_accept_queue.fastopenq.max_qlen) { |
2072 |
+diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
2073 |
+index ee179e08dd20c..b831825f234f6 100644 |
2074 |
+--- a/net/ipv4/igmp.c |
2075 |
++++ b/net/ipv4/igmp.c |
2076 |
+@@ -471,7 +471,8 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, |
2077 |
+ |
2078 |
+ if (pmc->multiaddr == IGMP_ALL_HOSTS) |
2079 |
+ return skb; |
2080 |
+- if (ipv4_is_local_multicast(pmc->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
2081 |
++ if (ipv4_is_local_multicast(pmc->multiaddr) && |
2082 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2083 |
+ return skb; |
2084 |
+ |
2085 |
+ mtu = READ_ONCE(dev->mtu); |
2086 |
+@@ -597,7 +598,7 @@ static int igmpv3_send_report(struct in_device *in_dev, struct ip_mc_list *pmc) |
2087 |
+ if (pmc->multiaddr == IGMP_ALL_HOSTS) |
2088 |
+ continue; |
2089 |
+ if (ipv4_is_local_multicast(pmc->multiaddr) && |
2090 |
+- !net->ipv4.sysctl_igmp_llm_reports) |
2091 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2092 |
+ continue; |
2093 |
+ spin_lock_bh(&pmc->lock); |
2094 |
+ if (pmc->sfcount[MCAST_EXCLUDE]) |
2095 |
+@@ -740,7 +741,8 @@ static int igmp_send_report(struct in_device *in_dev, struct ip_mc_list *pmc, |
2096 |
+ if (type == IGMPV3_HOST_MEMBERSHIP_REPORT) |
2097 |
+ return igmpv3_send_report(in_dev, pmc); |
2098 |
+ |
2099 |
+- if (ipv4_is_local_multicast(group) && !net->ipv4.sysctl_igmp_llm_reports) |
2100 |
++ if (ipv4_is_local_multicast(group) && |
2101 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2102 |
+ return 0; |
2103 |
+ |
2104 |
+ if (type == IGMP_HOST_LEAVE_MESSAGE) |
2105 |
+@@ -924,7 +926,8 @@ static bool igmp_heard_report(struct in_device *in_dev, __be32 group) |
2106 |
+ |
2107 |
+ if (group == IGMP_ALL_HOSTS) |
2108 |
+ return false; |
2109 |
+- if (ipv4_is_local_multicast(group) && !net->ipv4.sysctl_igmp_llm_reports) |
2110 |
++ if (ipv4_is_local_multicast(group) && |
2111 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2112 |
+ return false; |
2113 |
+ |
2114 |
+ rcu_read_lock(); |
2115 |
+@@ -1049,7 +1052,7 @@ static bool igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, |
2116 |
+ if (im->multiaddr == IGMP_ALL_HOSTS) |
2117 |
+ continue; |
2118 |
+ if (ipv4_is_local_multicast(im->multiaddr) && |
2119 |
+- !net->ipv4.sysctl_igmp_llm_reports) |
2120 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2121 |
+ continue; |
2122 |
+ spin_lock_bh(&im->lock); |
2123 |
+ if (im->tm_running) |
2124 |
+@@ -1299,7 +1302,8 @@ static void igmp_group_dropped(struct ip_mc_list *im) |
2125 |
+ #ifdef CONFIG_IP_MULTICAST |
2126 |
+ if (im->multiaddr == IGMP_ALL_HOSTS) |
2127 |
+ return; |
2128 |
+- if (ipv4_is_local_multicast(im->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
2129 |
++ if (ipv4_is_local_multicast(im->multiaddr) && |
2130 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2131 |
+ return; |
2132 |
+ |
2133 |
+ reporter = im->reporter; |
2134 |
+@@ -1336,7 +1340,8 @@ static void igmp_group_added(struct ip_mc_list *im) |
2135 |
+ #ifdef CONFIG_IP_MULTICAST |
2136 |
+ if (im->multiaddr == IGMP_ALL_HOSTS) |
2137 |
+ return; |
2138 |
+- if (ipv4_is_local_multicast(im->multiaddr) && !net->ipv4.sysctl_igmp_llm_reports) |
2139 |
++ if (ipv4_is_local_multicast(im->multiaddr) && |
2140 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2141 |
+ return; |
2142 |
+ |
2143 |
+ if (in_dev->dead) |
2144 |
+@@ -1657,7 +1662,7 @@ static void ip_mc_rejoin_groups(struct in_device *in_dev) |
2145 |
+ if (im->multiaddr == IGMP_ALL_HOSTS) |
2146 |
+ continue; |
2147 |
+ if (ipv4_is_local_multicast(im->multiaddr) && |
2148 |
+- !net->ipv4.sysctl_igmp_llm_reports) |
2149 |
++ !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports)) |
2150 |
+ continue; |
2151 |
+ |
2152 |
+ /* a failover is happening and switches |
2153 |
+@@ -2207,7 +2212,7 @@ static int __ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr, |
2154 |
+ count++; |
2155 |
+ } |
2156 |
+ err = -ENOBUFS; |
2157 |
+- if (count >= net->ipv4.sysctl_igmp_max_memberships) |
2158 |
++ if (count >= READ_ONCE(net->ipv4.sysctl_igmp_max_memberships)) |
2159 |
+ goto done; |
2160 |
+ iml = sock_kmalloc(sk, sizeof(*iml), GFP_KERNEL); |
2161 |
+ if (!iml) |
2162 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
2163 |
+index d7f17581df7da..57e2316529d00 100644 |
2164 |
+--- a/net/ipv4/route.c |
2165 |
++++ b/net/ipv4/route.c |
2166 |
+@@ -1419,7 +1419,7 @@ u32 ip_mtu_from_fib_result(struct fib_result *res, __be32 daddr) |
2167 |
+ struct net_device *dev = nh->nh_dev; |
2168 |
+ u32 mtu = 0; |
2169 |
+ |
2170 |
+- if (dev_net(dev)->ipv4.sysctl_ip_fwd_use_pmtu || |
2171 |
++ if (READ_ONCE(dev_net(dev)->ipv4.sysctl_ip_fwd_use_pmtu) || |
2172 |
+ fi->fib_metrics->metrics[RTAX_LOCK - 1] & (1 << RTAX_MTU)) |
2173 |
+ mtu = fi->fib_mtu; |
2174 |
+ |
2175 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
2176 |
+index f7795488b0adf..7acc0d07f1486 100644 |
2177 |
+--- a/net/ipv4/tcp.c |
2178 |
++++ b/net/ipv4/tcp.c |
2179 |
+@@ -436,7 +436,7 @@ void tcp_init_sock(struct sock *sk) |
2180 |
+ tp->snd_cwnd_clamp = ~0; |
2181 |
+ tp->mss_cache = TCP_MSS_DEFAULT; |
2182 |
+ |
2183 |
+- tp->reordering = sock_net(sk)->ipv4.sysctl_tcp_reordering; |
2184 |
++ tp->reordering = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reordering); |
2185 |
+ tcp_assign_congestion_control(sk); |
2186 |
+ |
2187 |
+ tp->tsoffset = 0; |
2188 |
+@@ -1160,7 +1160,8 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, |
2189 |
+ struct sockaddr *uaddr = msg->msg_name; |
2190 |
+ int err, flags; |
2191 |
+ |
2192 |
+- if (!(sock_net(sk)->ipv4.sysctl_tcp_fastopen & TFO_CLIENT_ENABLE) || |
2193 |
++ if (!(READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen) & |
2194 |
++ TFO_CLIENT_ENABLE) || |
2195 |
+ (uaddr && msg->msg_namelen >= sizeof(uaddr->sa_family) && |
2196 |
+ uaddr->sa_family == AF_UNSPEC)) |
2197 |
+ return -EOPNOTSUPP; |
2198 |
+@@ -3056,7 +3057,8 @@ static int do_tcp_setsockopt(struct sock *sk, int level, |
2199 |
+ case TCP_FASTOPEN_CONNECT: |
2200 |
+ if (val > 1 || val < 0) { |
2201 |
+ err = -EINVAL; |
2202 |
+- } else if (net->ipv4.sysctl_tcp_fastopen & TFO_CLIENT_ENABLE) { |
2203 |
++ } else if (READ_ONCE(net->ipv4.sysctl_tcp_fastopen) & |
2204 |
++ TFO_CLIENT_ENABLE) { |
2205 |
+ if (sk->sk_state == TCP_CLOSE) |
2206 |
+ tp->fastopen_connect = val; |
2207 |
+ else |
2208 |
+@@ -3386,7 +3388,7 @@ static int do_tcp_getsockopt(struct sock *sk, int level, |
2209 |
+ case TCP_LINGER2: |
2210 |
+ val = tp->linger2; |
2211 |
+ if (val >= 0) |
2212 |
+- val = (val ? : net->ipv4.sysctl_tcp_fin_timeout) / HZ; |
2213 |
++ val = (val ? : READ_ONCE(net->ipv4.sysctl_tcp_fin_timeout)) / HZ; |
2214 |
+ break; |
2215 |
+ case TCP_DEFER_ACCEPT: |
2216 |
+ val = retrans_to_secs(icsk->icsk_accept_queue.rskq_defer_accept, |
2217 |
+diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c |
2218 |
+index 119d2c2f3b047..f726591de7c7a 100644 |
2219 |
+--- a/net/ipv4/tcp_fastopen.c |
2220 |
++++ b/net/ipv4/tcp_fastopen.c |
2221 |
+@@ -313,7 +313,7 @@ static bool tcp_fastopen_no_cookie(const struct sock *sk, |
2222 |
+ const struct dst_entry *dst, |
2223 |
+ int flag) |
2224 |
+ { |
2225 |
+- return (sock_net(sk)->ipv4.sysctl_tcp_fastopen & flag) || |
2226 |
++ return (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen) & flag) || |
2227 |
+ tcp_sk(sk)->fastopen_no_cookie || |
2228 |
+ (dst && dst_metric(dst, RTAX_FASTOPEN_NO_COOKIE)); |
2229 |
+ } |
2230 |
+@@ -328,7 +328,7 @@ struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, |
2231 |
+ const struct dst_entry *dst) |
2232 |
+ { |
2233 |
+ bool syn_data = TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq + 1; |
2234 |
+- int tcp_fastopen = sock_net(sk)->ipv4.sysctl_tcp_fastopen; |
2235 |
++ int tcp_fastopen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fastopen); |
2236 |
+ struct tcp_fastopen_cookie valid_foc = { .len = -1 }; |
2237 |
+ struct sock *child; |
2238 |
+ |
2239 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
2240 |
+index 92f5068c76807..26f0994da31bf 100644 |
2241 |
+--- a/net/ipv4/tcp_input.c |
2242 |
++++ b/net/ipv4/tcp_input.c |
2243 |
+@@ -893,7 +893,7 @@ static void tcp_check_sack_reordering(struct sock *sk, const u32 low_seq, |
2244 |
+ tp->undo_marker ? tp->undo_retrans : 0); |
2245 |
+ #endif |
2246 |
+ tp->reordering = min_t(u32, (metric + mss - 1) / mss, |
2247 |
+- sock_net(sk)->ipv4.sysctl_tcp_max_reordering); |
2248 |
++ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_max_reordering)); |
2249 |
+ } |
2250 |
+ |
2251 |
+ /* This exciting event is worth to be remembered. 8) */ |
2252 |
+@@ -1878,7 +1878,7 @@ static void tcp_check_reno_reordering(struct sock *sk, const int addend) |
2253 |
+ return; |
2254 |
+ |
2255 |
+ tp->reordering = min_t(u32, tp->packets_out + addend, |
2256 |
+- sock_net(sk)->ipv4.sysctl_tcp_max_reordering); |
2257 |
++ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_max_reordering)); |
2258 |
+ tp->reord_seen++; |
2259 |
+ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRENOREORDER); |
2260 |
+ } |
2261 |
+@@ -1938,7 +1938,8 @@ static inline void tcp_init_undo(struct tcp_sock *tp) |
2262 |
+ |
2263 |
+ static bool tcp_is_rack(const struct sock *sk) |
2264 |
+ { |
2265 |
+- return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION; |
2266 |
++ return READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_recovery) & |
2267 |
++ TCP_RACK_LOSS_DETECTION; |
2268 |
+ } |
2269 |
+ |
2270 |
+ /* If we detect SACK reneging, forget all SACK information |
2271 |
+@@ -1982,6 +1983,7 @@ void tcp_enter_loss(struct sock *sk) |
2272 |
+ struct tcp_sock *tp = tcp_sk(sk); |
2273 |
+ struct net *net = sock_net(sk); |
2274 |
+ bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery; |
2275 |
++ u8 reordering; |
2276 |
+ |
2277 |
+ tcp_timeout_mark_lost(sk); |
2278 |
+ |
2279 |
+@@ -2002,10 +2004,12 @@ void tcp_enter_loss(struct sock *sk) |
2280 |
+ /* Timeout in disordered state after receiving substantial DUPACKs |
2281 |
+ * suggests that the degree of reordering is over-estimated. |
2282 |
+ */ |
2283 |
++ reordering = READ_ONCE(net->ipv4.sysctl_tcp_reordering); |
2284 |
+ if (icsk->icsk_ca_state <= TCP_CA_Disorder && |
2285 |
+- tp->sacked_out >= net->ipv4.sysctl_tcp_reordering) |
2286 |
++ tp->sacked_out >= reordering) |
2287 |
+ tp->reordering = min_t(unsigned int, tp->reordering, |
2288 |
+- net->ipv4.sysctl_tcp_reordering); |
2289 |
++ reordering); |
2290 |
++ |
2291 |
+ tcp_set_ca_state(sk, TCP_CA_Loss); |
2292 |
+ tp->high_seq = tp->snd_nxt; |
2293 |
+ tcp_ecn_queue_cwr(tp); |
2294 |
+@@ -3303,7 +3307,8 @@ static inline bool tcp_may_raise_cwnd(const struct sock *sk, const int flag) |
2295 |
+ * new SACK or ECE mark may first advance cwnd here and later reduce |
2296 |
+ * cwnd in tcp_fastretrans_alert() based on more states. |
2297 |
+ */ |
2298 |
+- if (tcp_sk(sk)->reordering > sock_net(sk)->ipv4.sysctl_tcp_reordering) |
2299 |
++ if (tcp_sk(sk)->reordering > |
2300 |
++ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reordering)) |
2301 |
+ return flag & FLAG_FORWARD_PROGRESS; |
2302 |
+ |
2303 |
+ return flag & FLAG_DATA_ACKED; |
2304 |
+@@ -5287,7 +5292,7 @@ static void tcp_check_urg(struct sock *sk, const struct tcphdr *th) |
2305 |
+ struct tcp_sock *tp = tcp_sk(sk); |
2306 |
+ u32 ptr = ntohs(th->urg_ptr); |
2307 |
+ |
2308 |
+- if (ptr && !sock_net(sk)->ipv4.sysctl_tcp_stdurg) |
2309 |
++ if (ptr && !READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_stdurg)) |
2310 |
+ ptr--; |
2311 |
+ ptr += ntohl(th->seq); |
2312 |
+ |
2313 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
2314 |
+index 2719c60f285b0..ddc1af8731e39 100644 |
2315 |
+--- a/net/ipv4/tcp_ipv4.c |
2316 |
++++ b/net/ipv4/tcp_ipv4.c |
2317 |
+@@ -110,10 +110,10 @@ static u32 tcp_v4_init_ts_off(const struct net *net, const struct sk_buff *skb) |
2318 |
+ |
2319 |
+ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) |
2320 |
+ { |
2321 |
++ int reuse = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_tw_reuse); |
2322 |
+ const struct inet_timewait_sock *tw = inet_twsk(sktw); |
2323 |
+ const struct tcp_timewait_sock *tcptw = tcp_twsk(sktw); |
2324 |
+ struct tcp_sock *tp = tcp_sk(sk); |
2325 |
+- int reuse = sock_net(sk)->ipv4.sysctl_tcp_tw_reuse; |
2326 |
+ |
2327 |
+ if (reuse == 2) { |
2328 |
+ /* Still does not detect *everything* that goes through |
2329 |
+diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c |
2330 |
+index 03b51cdcc731f..61843c6d7a476 100644 |
2331 |
+--- a/net/ipv4/tcp_metrics.c |
2332 |
++++ b/net/ipv4/tcp_metrics.c |
2333 |
+@@ -425,7 +425,8 @@ void tcp_update_metrics(struct sock *sk) |
2334 |
+ if (!tcp_metric_locked(tm, TCP_METRIC_REORDERING)) { |
2335 |
+ val = tcp_metric_get(tm, TCP_METRIC_REORDERING); |
2336 |
+ if (val < tp->reordering && |
2337 |
+- tp->reordering != net->ipv4.sysctl_tcp_reordering) |
2338 |
++ tp->reordering != |
2339 |
++ READ_ONCE(net->ipv4.sysctl_tcp_reordering)) |
2340 |
+ tcp_metric_set(tm, TCP_METRIC_REORDERING, |
2341 |
+ tp->reordering); |
2342 |
+ } |
2343 |
+diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c |
2344 |
+index c79cb949da66b..0fc238d79b03a 100644 |
2345 |
+--- a/net/ipv4/tcp_minisocks.c |
2346 |
++++ b/net/ipv4/tcp_minisocks.c |
2347 |
+@@ -179,7 +179,7 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb, |
2348 |
+ * Oh well... nobody has a sufficient solution to this |
2349 |
+ * protocol bug yet. |
2350 |
+ */ |
2351 |
+- if (twsk_net(tw)->ipv4.sysctl_tcp_rfc1337 == 0) { |
2352 |
++ if (!READ_ONCE(twsk_net(tw)->ipv4.sysctl_tcp_rfc1337)) { |
2353 |
+ kill: |
2354 |
+ inet_twsk_deschedule_put(tw); |
2355 |
+ return TCP_TW_SUCCESS; |
2356 |
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
2357 |
+index 25dbdb27a571d..13d9e8570ce57 100644 |
2358 |
+--- a/net/ipv4/tcp_output.c |
2359 |
++++ b/net/ipv4/tcp_output.c |
2360 |
+@@ -1523,7 +1523,7 @@ void tcp_mtup_init(struct sock *sk) |
2361 |
+ struct inet_connection_sock *icsk = inet_csk(sk); |
2362 |
+ struct net *net = sock_net(sk); |
2363 |
+ |
2364 |
+- icsk->icsk_mtup.enabled = net->ipv4.sysctl_tcp_mtu_probing > 1; |
2365 |
++ icsk->icsk_mtup.enabled = READ_ONCE(net->ipv4.sysctl_tcp_mtu_probing) > 1; |
2366 |
+ icsk->icsk_mtup.search_high = tp->rx_opt.mss_clamp + sizeof(struct tcphdr) + |
2367 |
+ icsk->icsk_af_ops->net_header_len; |
2368 |
+ icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, net->ipv4.sysctl_tcp_base_mss); |
2369 |
+@@ -1658,7 +1658,7 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) |
2370 |
+ if (tp->packets_out > tp->snd_cwnd_used) |
2371 |
+ tp->snd_cwnd_used = tp->packets_out; |
2372 |
+ |
2373 |
+- if (sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle && |
2374 |
++ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_slow_start_after_idle) && |
2375 |
+ (s32)(tcp_jiffies32 - tp->snd_cwnd_stamp) >= inet_csk(sk)->icsk_rto && |
2376 |
+ !ca_ops->cong_control) |
2377 |
+ tcp_cwnd_application_limited(sk); |
2378 |
+@@ -2030,7 +2030,7 @@ static inline void tcp_mtu_check_reprobe(struct sock *sk) |
2379 |
+ u32 interval; |
2380 |
+ s32 delta; |
2381 |
+ |
2382 |
+- interval = net->ipv4.sysctl_tcp_probe_interval; |
2383 |
++ interval = READ_ONCE(net->ipv4.sysctl_tcp_probe_interval); |
2384 |
+ delta = tcp_jiffies32 - icsk->icsk_mtup.probe_timestamp; |
2385 |
+ if (unlikely(delta >= interval * HZ)) { |
2386 |
+ int mss = tcp_current_mss(sk); |
2387 |
+@@ -2112,7 +2112,7 @@ static int tcp_mtu_probe(struct sock *sk) |
2388 |
+ * probing process by not resetting search range to its orignal. |
2389 |
+ */ |
2390 |
+ if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high) || |
2391 |
+- interval < net->ipv4.sysctl_tcp_probe_threshold) { |
2392 |
++ interval < READ_ONCE(net->ipv4.sysctl_tcp_probe_threshold)) { |
2393 |
+ /* Check whether enough time has elaplased for |
2394 |
+ * another round of probing. |
2395 |
+ */ |
2396 |
+@@ -2454,7 +2454,7 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto) |
2397 |
+ if (tp->fastopen_rsk) |
2398 |
+ return false; |
2399 |
+ |
2400 |
+- early_retrans = sock_net(sk)->ipv4.sysctl_tcp_early_retrans; |
2401 |
++ early_retrans = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_early_retrans); |
2402 |
+ /* Schedule a loss probe in 2*RTT for SACK capable connections |
2403 |
+ * not in loss recovery, that are either limited by cwnd or application. |
2404 |
+ */ |
2405 |
+@@ -2816,7 +2816,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to, |
2406 |
+ struct sk_buff *skb = to, *tmp; |
2407 |
+ bool first = true; |
2408 |
+ |
2409 |
+- if (!sock_net(sk)->ipv4.sysctl_tcp_retrans_collapse) |
2410 |
++ if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_retrans_collapse)) |
2411 |
+ return; |
2412 |
+ if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN) |
2413 |
+ return; |
2414 |
+@@ -3776,7 +3776,7 @@ void tcp_send_probe0(struct sock *sk) |
2415 |
+ } |
2416 |
+ |
2417 |
+ if (err <= 0) { |
2418 |
+- if (icsk->icsk_backoff < net->ipv4.sysctl_tcp_retries2) |
2419 |
++ if (icsk->icsk_backoff < READ_ONCE(net->ipv4.sysctl_tcp_retries2)) |
2420 |
+ icsk->icsk_backoff++; |
2421 |
+ icsk->icsk_probes_out++; |
2422 |
+ probe_max = TCP_RTO_MAX; |
2423 |
+diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c |
2424 |
+index 0d96decba13df..61969bb9395c7 100644 |
2425 |
+--- a/net/ipv4/tcp_recovery.c |
2426 |
++++ b/net/ipv4/tcp_recovery.c |
2427 |
+@@ -33,7 +33,8 @@ static u32 tcp_rack_reo_wnd(const struct sock *sk) |
2428 |
+ return 0; |
2429 |
+ |
2430 |
+ if (tp->sacked_out >= tp->reordering && |
2431 |
+- !(sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_NO_DUPTHRESH)) |
2432 |
++ !(READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_recovery) & |
2433 |
++ TCP_RACK_NO_DUPTHRESH)) |
2434 |
+ return 0; |
2435 |
+ } |
2436 |
+ |
2437 |
+@@ -203,7 +204,8 @@ void tcp_rack_update_reo_wnd(struct sock *sk, struct rate_sample *rs) |
2438 |
+ { |
2439 |
+ struct tcp_sock *tp = tcp_sk(sk); |
2440 |
+ |
2441 |
+- if (sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_STATIC_REO_WND || |
2442 |
++ if ((READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_recovery) & |
2443 |
++ TCP_RACK_STATIC_REO_WND) || |
2444 |
+ !rs->prior_delivered) |
2445 |
+ return; |
2446 |
+ |
2447 |
+diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c |
2448 |
+index d071ed6b8b9a0..84069db0423a2 100644 |
2449 |
+--- a/net/ipv4/tcp_timer.c |
2450 |
++++ b/net/ipv4/tcp_timer.c |
2451 |
+@@ -124,7 +124,7 @@ static int tcp_out_of_resources(struct sock *sk, bool do_reset) |
2452 |
+ */ |
2453 |
+ static int tcp_orphan_retries(struct sock *sk, bool alive) |
2454 |
+ { |
2455 |
+- int retries = sock_net(sk)->ipv4.sysctl_tcp_orphan_retries; /* May be zero. */ |
2456 |
++ int retries = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_orphan_retries); /* May be zero. */ |
2457 |
+ |
2458 |
+ /* We know from an ICMP that something is wrong. */ |
2459 |
+ if (sk->sk_err_soft && !alive) |
2460 |
+@@ -144,7 +144,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) |
2461 |
+ int mss; |
2462 |
+ |
2463 |
+ /* Black hole detection */ |
2464 |
+- if (!net->ipv4.sysctl_tcp_mtu_probing) |
2465 |
++ if (!READ_ONCE(net->ipv4.sysctl_tcp_mtu_probing)) |
2466 |
+ return; |
2467 |
+ |
2468 |
+ if (!icsk->icsk_mtup.enabled) { |
2469 |
+@@ -226,7 +226,7 @@ static int tcp_write_timeout(struct sock *sk) |
2470 |
+ retry_until = icsk->icsk_syn_retries ? : net->ipv4.sysctl_tcp_syn_retries; |
2471 |
+ expired = icsk->icsk_retransmits >= retry_until; |
2472 |
+ } else { |
2473 |
+- if (retransmits_timed_out(sk, net->ipv4.sysctl_tcp_retries1, 0)) { |
2474 |
++ if (retransmits_timed_out(sk, READ_ONCE(net->ipv4.sysctl_tcp_retries1), 0)) { |
2475 |
+ /* Black hole detection */ |
2476 |
+ tcp_mtu_probing(icsk, sk); |
2477 |
+ |
2478 |
+@@ -235,7 +235,7 @@ static int tcp_write_timeout(struct sock *sk) |
2479 |
+ sk_rethink_txhash(sk); |
2480 |
+ } |
2481 |
+ |
2482 |
+- retry_until = net->ipv4.sysctl_tcp_retries2; |
2483 |
++ retry_until = READ_ONCE(net->ipv4.sysctl_tcp_retries2); |
2484 |
+ if (sock_flag(sk, SOCK_DEAD)) { |
2485 |
+ const bool alive = icsk->icsk_rto < TCP_RTO_MAX; |
2486 |
+ |
2487 |
+@@ -362,7 +362,7 @@ static void tcp_probe_timer(struct sock *sk) |
2488 |
+ (s32)(tcp_time_stamp(tp) - start_ts) > icsk->icsk_user_timeout) |
2489 |
+ goto abort; |
2490 |
+ |
2491 |
+- max_probes = sock_net(sk)->ipv4.sysctl_tcp_retries2; |
2492 |
++ max_probes = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_retries2); |
2493 |
+ if (sock_flag(sk, SOCK_DEAD)) { |
2494 |
+ const bool alive = inet_csk_rto_backoff(icsk, TCP_RTO_MAX) < TCP_RTO_MAX; |
2495 |
+ |
2496 |
+@@ -545,7 +545,7 @@ out_reset_timer: |
2497 |
+ * linear-timeout retransmissions into a black hole |
2498 |
+ */ |
2499 |
+ if (sk->sk_state == TCP_ESTABLISHED && |
2500 |
+- (tp->thin_lto || net->ipv4.sysctl_tcp_thin_linear_timeouts) && |
2501 |
++ (tp->thin_lto || READ_ONCE(net->ipv4.sysctl_tcp_thin_linear_timeouts)) && |
2502 |
+ tcp_stream_is_thin(tp) && |
2503 |
+ icsk->icsk_retransmits <= TCP_THIN_LINEAR_RETRIES) { |
2504 |
+ icsk->icsk_backoff = 0; |
2505 |
+@@ -556,7 +556,7 @@ out_reset_timer: |
2506 |
+ } |
2507 |
+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, |
2508 |
+ tcp_clamp_rto_to_user_timeout(sk), TCP_RTO_MAX); |
2509 |
+- if (retransmits_timed_out(sk, net->ipv4.sysctl_tcp_retries1 + 1, 0)) |
2510 |
++ if (retransmits_timed_out(sk, READ_ONCE(net->ipv4.sysctl_tcp_retries1) + 1, 0)) |
2511 |
+ __sk_dst_reset(sk); |
2512 |
+ |
2513 |
+ out:; |
2514 |
+diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c |
2515 |
+index 7207a9769f1a9..8db8209c5b617 100644 |
2516 |
+--- a/net/sctp/protocol.c |
2517 |
++++ b/net/sctp/protocol.c |
2518 |
+@@ -373,7 +373,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) |
2519 |
+ if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) && |
2520 |
+ ret != RTN_LOCAL && |
2521 |
+ !sp->inet.freebind && |
2522 |
+- !net->ipv4.sysctl_ip_nonlocal_bind) |
2523 |
++ !READ_ONCE(net->ipv4.sysctl_ip_nonlocal_bind)) |
2524 |
+ return 0; |
2525 |
+ |
2526 |
+ if (ipv6_only_sock(sctp_opt2sk(sp))) |
2527 |
+diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c |
2528 |
+index 228e3ce48d437..b290eb3ae155a 100644 |
2529 |
+--- a/net/tls/tls_device.c |
2530 |
++++ b/net/tls/tls_device.c |
2531 |
+@@ -110,13 +110,16 @@ static void tls_device_queue_ctx_destruction(struct tls_context *ctx) |
2532 |
+ unsigned long flags; |
2533 |
+ |
2534 |
+ spin_lock_irqsave(&tls_device_lock, flags); |
2535 |
++ if (unlikely(!refcount_dec_and_test(&ctx->refcount))) |
2536 |
++ goto unlock; |
2537 |
++ |
2538 |
+ list_move_tail(&ctx->list, &tls_device_gc_list); |
2539 |
+ |
2540 |
+ /* schedule_work inside the spinlock |
2541 |
+ * to make sure tls_device_down waits for that work. |
2542 |
+ */ |
2543 |
+ schedule_work(&tls_device_gc_work); |
2544 |
+- |
2545 |
++unlock: |
2546 |
+ spin_unlock_irqrestore(&tls_device_lock, flags); |
2547 |
+ } |
2548 |
+ |
2549 |
+@@ -214,8 +217,7 @@ void tls_device_sk_destruct(struct sock *sk) |
2550 |
+ clean_acked_data_disable(inet_csk(sk)); |
2551 |
+ } |
2552 |
+ |
2553 |
+- if (refcount_dec_and_test(&tls_ctx->refcount)) |
2554 |
+- tls_device_queue_ctx_destruction(tls_ctx); |
2555 |
++ tls_device_queue_ctx_destruction(tls_ctx); |
2556 |
+ } |
2557 |
+ EXPORT_SYMBOL(tls_device_sk_destruct); |
2558 |
+ |
2559 |
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
2560 |
+index bb1c94e20e820..3582f77bab6a8 100644 |
2561 |
+--- a/net/xfrm/xfrm_policy.c |
2562 |
++++ b/net/xfrm/xfrm_policy.c |
2563 |
+@@ -1697,8 +1697,10 @@ static int xfrm_expand_policies(const struct flowi *fl, u16 family, |
2564 |
+ *num_xfrms = 0; |
2565 |
+ return 0; |
2566 |
+ } |
2567 |
+- if (IS_ERR(pols[0])) |
2568 |
++ if (IS_ERR(pols[0])) { |
2569 |
++ *num_pols = 0; |
2570 |
+ return PTR_ERR(pols[0]); |
2571 |
++ } |
2572 |
+ |
2573 |
+ *num_xfrms = pols[0]->xfrm_nr; |
2574 |
+ |
2575 |
+@@ -1713,6 +1715,7 @@ static int xfrm_expand_policies(const struct flowi *fl, u16 family, |
2576 |
+ if (pols[1]) { |
2577 |
+ if (IS_ERR(pols[1])) { |
2578 |
+ xfrm_pols_put(pols, *num_pols); |
2579 |
++ *num_pols = 0; |
2580 |
+ return PTR_ERR(pols[1]); |
2581 |
+ } |
2582 |
+ (*num_pols)++; |
2583 |
+diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig |
2584 |
+index 5095b2e8fceeb..3ec45028a8c54 100644 |
2585 |
+--- a/security/integrity/ima/Kconfig |
2586 |
++++ b/security/integrity/ima/Kconfig |
2587 |
+@@ -68,10 +68,9 @@ choice |
2588 |
+ hash, defined as 20 bytes, and a null terminated pathname, |
2589 |
+ limited to 255 characters. The 'ima-ng' measurement list |
2590 |
+ template permits both larger hash digests and longer |
2591 |
+- pathnames. |
2592 |
++ pathnames. The configured default template can be replaced |
2593 |
++ by specifying "ima_template=" on the boot command line. |
2594 |
+ |
2595 |
+- config IMA_TEMPLATE |
2596 |
+- bool "ima" |
2597 |
+ config IMA_NG_TEMPLATE |
2598 |
+ bool "ima-ng (default)" |
2599 |
+ config IMA_SIG_TEMPLATE |
2600 |
+@@ -81,7 +80,6 @@ endchoice |
2601 |
+ config IMA_DEFAULT_TEMPLATE |
2602 |
+ string |
2603 |
+ depends on IMA |
2604 |
+- default "ima" if IMA_TEMPLATE |
2605 |
+ default "ima-ng" if IMA_NG_TEMPLATE |
2606 |
+ default "ima-sig" if IMA_SIG_TEMPLATE |
2607 |
+ |
2608 |
+@@ -101,15 +99,15 @@ choice |
2609 |
+ |
2610 |
+ config IMA_DEFAULT_HASH_SHA256 |
2611 |
+ bool "SHA256" |
2612 |
+- depends on CRYPTO_SHA256=y && !IMA_TEMPLATE |
2613 |
++ depends on CRYPTO_SHA256=y |
2614 |
+ |
2615 |
+ config IMA_DEFAULT_HASH_SHA512 |
2616 |
+ bool "SHA512" |
2617 |
+- depends on CRYPTO_SHA512=y && !IMA_TEMPLATE |
2618 |
++ depends on CRYPTO_SHA512=y |
2619 |
+ |
2620 |
+ config IMA_DEFAULT_HASH_WP512 |
2621 |
+ bool "WP512" |
2622 |
+- depends on CRYPTO_WP512=y && !IMA_TEMPLATE |
2623 |
++ depends on CRYPTO_WP512=y |
2624 |
+ endchoice |
2625 |
+ |
2626 |
+ config IMA_DEFAULT_HASH |
2627 |
+diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c |
2628 |
+index 753d5fc4b284f..81a171668f420 100644 |
2629 |
+--- a/sound/core/memalloc.c |
2630 |
++++ b/sound/core/memalloc.c |
2631 |
+@@ -179,6 +179,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, |
2632 |
+ if (WARN_ON(!dmab)) |
2633 |
+ return -ENXIO; |
2634 |
+ |
2635 |
++ size = PAGE_ALIGN(size); |
2636 |
+ dmab->dev.type = type; |
2637 |
+ dmab->dev.dev = device; |
2638 |
+ dmab->bytes = 0; |