1 |
commit: e9e29af500ac424719c257708c498b9bff676738 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 5 12:54:19 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 5 12:54:19 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e9e29af5 |
7 |
|
8 |
Linux patch 5.4.170 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1169_linux-5.4.170.patch | 1469 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1473 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index d8d56e36..75707cd8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -719,6 +719,10 @@ Patch: 1168_linux-5.4.169.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.169 |
23 |
|
24 |
+Patch: 1169_linux-5.4.170.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.170 |
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/1169_linux-5.4.170.patch b/1169_linux-5.4.170.patch |
33 |
new file mode 100644 |
34 |
index 00000000..e78f6fa0 |
35 |
--- /dev/null |
36 |
+++ b/1169_linux-5.4.170.patch |
37 |
@@ -0,0 +1,1469 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index e7f71df9daf1c..165abcb656c5b 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -1487,6 +1487,8 @@ |
43 |
+ architectures force reset to be always executed |
44 |
+ i8042.unlock [HW] Unlock (ignore) the keylock |
45 |
+ i8042.kbdreset [HW] Reset device connected to KBD port |
46 |
++ i8042.probe_defer |
47 |
++ [HW] Allow deferred probing upon i8042 probe errors |
48 |
+ |
49 |
+ i810= [HW,DRM] |
50 |
+ |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index 151fd24540125..7380354e49513 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,7 +1,7 @@ |
56 |
+ # SPDX-License-Identifier: GPL-2.0 |
57 |
+ VERSION = 5 |
58 |
+ PATCHLEVEL = 4 |
59 |
+-SUBLEVEL = 169 |
60 |
++SUBLEVEL = 170 |
61 |
+ EXTRAVERSION = |
62 |
+ NAME = Kleptomaniac Octopus |
63 |
+ |
64 |
+diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c |
65 |
+index 3526bb1488e5e..b5022a7f6bae1 100644 |
66 |
+--- a/drivers/android/binder_alloc.c |
67 |
++++ b/drivers/android/binder_alloc.c |
68 |
+@@ -613,7 +613,7 @@ static void binder_free_buf_locked(struct binder_alloc *alloc, |
69 |
+ BUG_ON(buffer->user_data > alloc->buffer + alloc->buffer_size); |
70 |
+ |
71 |
+ if (buffer->async_transaction) { |
72 |
+- alloc->free_async_space += size + sizeof(struct binder_buffer); |
73 |
++ alloc->free_async_space += buffer_size + sizeof(struct binder_buffer); |
74 |
+ |
75 |
+ binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC, |
76 |
+ "%d: binder_free_buf size %zd async free %zd\n", |
77 |
+diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig |
78 |
+index 0cfcfb116a03d..5169a38ee47a9 100644 |
79 |
+--- a/drivers/hid/Kconfig |
80 |
++++ b/drivers/hid/Kconfig |
81 |
+@@ -149,6 +149,7 @@ config HID_APPLEIR |
82 |
+ |
83 |
+ config HID_ASUS |
84 |
+ tristate "Asus" |
85 |
++ depends on USB_HID |
86 |
+ depends on LEDS_CLASS |
87 |
+ depends on ASUS_WMI || ASUS_WMI=n |
88 |
+ select POWER_SUPPLY |
89 |
+diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c |
90 |
+index c9ae1895cd48a..7da6ca26a5f56 100644 |
91 |
+--- a/drivers/i2c/i2c-dev.c |
92 |
++++ b/drivers/i2c/i2c-dev.c |
93 |
+@@ -536,6 +536,9 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo |
94 |
+ sizeof(rdwr_arg))) |
95 |
+ return -EFAULT; |
96 |
+ |
97 |
++ if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0) |
98 |
++ return -EINVAL; |
99 |
++ |
100 |
+ if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS) |
101 |
+ return -EINVAL; |
102 |
+ |
103 |
+diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c |
104 |
+index cf7cbcd0c29df..6971412990695 100644 |
105 |
+--- a/drivers/input/joystick/spaceball.c |
106 |
++++ b/drivers/input/joystick/spaceball.c |
107 |
+@@ -19,6 +19,7 @@ |
108 |
+ #include <linux/module.h> |
109 |
+ #include <linux/input.h> |
110 |
+ #include <linux/serio.h> |
111 |
++#include <asm/unaligned.h> |
112 |
+ |
113 |
+ #define DRIVER_DESC "SpaceTec SpaceBall 2003/3003/4000 FLX driver" |
114 |
+ |
115 |
+@@ -75,9 +76,15 @@ static void spaceball_process_packet(struct spaceball* spaceball) |
116 |
+ |
117 |
+ case 'D': /* Ball data */ |
118 |
+ if (spaceball->idx != 15) return; |
119 |
+- for (i = 0; i < 6; i++) |
120 |
++ /* |
121 |
++ * Skip first three bytes; read six axes worth of data. |
122 |
++ * Axis values are signed 16-bit big-endian. |
123 |
++ */ |
124 |
++ data += 3; |
125 |
++ for (i = 0; i < ARRAY_SIZE(spaceball_axes); i++) { |
126 |
+ input_report_abs(dev, spaceball_axes[i], |
127 |
+- (__s16)((data[2 * i + 3] << 8) | data[2 * i + 2])); |
128 |
++ (__s16)get_unaligned_be16(&data[i * 2])); |
129 |
++ } |
130 |
+ break; |
131 |
+ |
132 |
+ case 'K': /* Button data */ |
133 |
+diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c |
134 |
+index 3f06e8a495d80..ff94388416645 100644 |
135 |
+--- a/drivers/input/mouse/appletouch.c |
136 |
++++ b/drivers/input/mouse/appletouch.c |
137 |
+@@ -916,6 +916,8 @@ static int atp_probe(struct usb_interface *iface, |
138 |
+ set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
139 |
+ set_bit(BTN_LEFT, input_dev->keybit); |
140 |
+ |
141 |
++ INIT_WORK(&dev->work, atp_reinit); |
142 |
++ |
143 |
+ error = input_register_device(dev->input); |
144 |
+ if (error) |
145 |
+ goto err_free_buffer; |
146 |
+@@ -923,8 +925,6 @@ static int atp_probe(struct usb_interface *iface, |
147 |
+ /* save our data pointer in this interface device */ |
148 |
+ usb_set_intfdata(iface, dev); |
149 |
+ |
150 |
+- INIT_WORK(&dev->work, atp_reinit); |
151 |
+- |
152 |
+ return 0; |
153 |
+ |
154 |
+ err_free_buffer: |
155 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
156 |
+index 202e43a6ffae2..0282c4c55e9da 100644 |
157 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
158 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
159 |
+@@ -995,6 +995,24 @@ static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = { |
160 |
+ { } |
161 |
+ }; |
162 |
+ |
163 |
++static const struct dmi_system_id i8042_dmi_probe_defer_table[] __initconst = { |
164 |
++ { |
165 |
++ /* ASUS ZenBook UX425UA */ |
166 |
++ .matches = { |
167 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
168 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"), |
169 |
++ }, |
170 |
++ }, |
171 |
++ { |
172 |
++ /* ASUS ZenBook UM325UA */ |
173 |
++ .matches = { |
174 |
++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
175 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"), |
176 |
++ }, |
177 |
++ }, |
178 |
++ { } |
179 |
++}; |
180 |
++ |
181 |
+ #endif /* CONFIG_X86 */ |
182 |
+ |
183 |
+ #ifdef CONFIG_PNP |
184 |
+@@ -1314,6 +1332,9 @@ static int __init i8042_platform_init(void) |
185 |
+ if (dmi_check_system(i8042_dmi_kbdreset_table)) |
186 |
+ i8042_kbdreset = true; |
187 |
+ |
188 |
++ if (dmi_check_system(i8042_dmi_probe_defer_table)) |
189 |
++ i8042_probe_defer = true; |
190 |
++ |
191 |
+ /* |
192 |
+ * A20 was already enabled during early kernel init. But some buggy |
193 |
+ * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to |
194 |
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
195 |
+index 6ff6b5710dd4e..bb76ff2f6b1d8 100644 |
196 |
+--- a/drivers/input/serio/i8042.c |
197 |
++++ b/drivers/input/serio/i8042.c |
198 |
+@@ -44,6 +44,10 @@ static bool i8042_unlock; |
199 |
+ module_param_named(unlock, i8042_unlock, bool, 0); |
200 |
+ MODULE_PARM_DESC(unlock, "Ignore keyboard lock."); |
201 |
+ |
202 |
++static bool i8042_probe_defer; |
203 |
++module_param_named(probe_defer, i8042_probe_defer, bool, 0); |
204 |
++MODULE_PARM_DESC(probe_defer, "Allow deferred probing."); |
205 |
++ |
206 |
+ enum i8042_controller_reset_mode { |
207 |
+ I8042_RESET_NEVER, |
208 |
+ I8042_RESET_ALWAYS, |
209 |
+@@ -709,7 +713,7 @@ static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version) |
210 |
+ * LCS/Telegraphics. |
211 |
+ */ |
212 |
+ |
213 |
+-static int __init i8042_check_mux(void) |
214 |
++static int i8042_check_mux(void) |
215 |
+ { |
216 |
+ unsigned char mux_version; |
217 |
+ |
218 |
+@@ -738,10 +742,10 @@ static int __init i8042_check_mux(void) |
219 |
+ /* |
220 |
+ * The following is used to test AUX IRQ delivery. |
221 |
+ */ |
222 |
+-static struct completion i8042_aux_irq_delivered __initdata; |
223 |
+-static bool i8042_irq_being_tested __initdata; |
224 |
++static struct completion i8042_aux_irq_delivered; |
225 |
++static bool i8042_irq_being_tested; |
226 |
+ |
227 |
+-static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) |
228 |
++static irqreturn_t i8042_aux_test_irq(int irq, void *dev_id) |
229 |
+ { |
230 |
+ unsigned long flags; |
231 |
+ unsigned char str, data; |
232 |
+@@ -768,7 +772,7 @@ static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id) |
233 |
+ * verifies success by readinng CTR. Used when testing for presence of AUX |
234 |
+ * port. |
235 |
+ */ |
236 |
+-static int __init i8042_toggle_aux(bool on) |
237 |
++static int i8042_toggle_aux(bool on) |
238 |
+ { |
239 |
+ unsigned char param; |
240 |
+ int i; |
241 |
+@@ -796,7 +800,7 @@ static int __init i8042_toggle_aux(bool on) |
242 |
+ * the presence of an AUX interface. |
243 |
+ */ |
244 |
+ |
245 |
+-static int __init i8042_check_aux(void) |
246 |
++static int i8042_check_aux(void) |
247 |
+ { |
248 |
+ int retval = -1; |
249 |
+ bool irq_registered = false; |
250 |
+@@ -1003,7 +1007,7 @@ static int i8042_controller_init(void) |
251 |
+ |
252 |
+ if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) { |
253 |
+ pr_err("Can't read CTR while initializing i8042\n"); |
254 |
+- return -EIO; |
255 |
++ return i8042_probe_defer ? -EPROBE_DEFER : -EIO; |
256 |
+ } |
257 |
+ |
258 |
+ } while (n < 2 || ctr[0] != ctr[1]); |
259 |
+@@ -1318,7 +1322,7 @@ static void i8042_shutdown(struct platform_device *dev) |
260 |
+ i8042_controller_reset(false); |
261 |
+ } |
262 |
+ |
263 |
+-static int __init i8042_create_kbd_port(void) |
264 |
++static int i8042_create_kbd_port(void) |
265 |
+ { |
266 |
+ struct serio *serio; |
267 |
+ struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO]; |
268 |
+@@ -1346,7 +1350,7 @@ static int __init i8042_create_kbd_port(void) |
269 |
+ return 0; |
270 |
+ } |
271 |
+ |
272 |
+-static int __init i8042_create_aux_port(int idx) |
273 |
++static int i8042_create_aux_port(int idx) |
274 |
+ { |
275 |
+ struct serio *serio; |
276 |
+ int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx; |
277 |
+@@ -1383,13 +1387,13 @@ static int __init i8042_create_aux_port(int idx) |
278 |
+ return 0; |
279 |
+ } |
280 |
+ |
281 |
+-static void __init i8042_free_kbd_port(void) |
282 |
++static void i8042_free_kbd_port(void) |
283 |
+ { |
284 |
+ kfree(i8042_ports[I8042_KBD_PORT_NO].serio); |
285 |
+ i8042_ports[I8042_KBD_PORT_NO].serio = NULL; |
286 |
+ } |
287 |
+ |
288 |
+-static void __init i8042_free_aux_ports(void) |
289 |
++static void i8042_free_aux_ports(void) |
290 |
+ { |
291 |
+ int i; |
292 |
+ |
293 |
+@@ -1399,7 +1403,7 @@ static void __init i8042_free_aux_ports(void) |
294 |
+ } |
295 |
+ } |
296 |
+ |
297 |
+-static void __init i8042_register_ports(void) |
298 |
++static void i8042_register_ports(void) |
299 |
+ { |
300 |
+ int i; |
301 |
+ |
302 |
+@@ -1440,7 +1444,7 @@ static void i8042_free_irqs(void) |
303 |
+ i8042_aux_irq_registered = i8042_kbd_irq_registered = false; |
304 |
+ } |
305 |
+ |
306 |
+-static int __init i8042_setup_aux(void) |
307 |
++static int i8042_setup_aux(void) |
308 |
+ { |
309 |
+ int (*aux_enable)(void); |
310 |
+ int error; |
311 |
+@@ -1482,7 +1486,7 @@ static int __init i8042_setup_aux(void) |
312 |
+ return error; |
313 |
+ } |
314 |
+ |
315 |
+-static int __init i8042_setup_kbd(void) |
316 |
++static int i8042_setup_kbd(void) |
317 |
+ { |
318 |
+ int error; |
319 |
+ |
320 |
+@@ -1532,7 +1536,7 @@ static int i8042_kbd_bind_notifier(struct notifier_block *nb, |
321 |
+ return 0; |
322 |
+ } |
323 |
+ |
324 |
+-static int __init i8042_probe(struct platform_device *dev) |
325 |
++static int i8042_probe(struct platform_device *dev) |
326 |
+ { |
327 |
+ int error; |
328 |
+ |
329 |
+@@ -1597,6 +1601,7 @@ static struct platform_driver i8042_driver = { |
330 |
+ .pm = &i8042_pm_ops, |
331 |
+ #endif |
332 |
+ }, |
333 |
++ .probe = i8042_probe, |
334 |
+ .remove = i8042_remove, |
335 |
+ .shutdown = i8042_shutdown, |
336 |
+ }; |
337 |
+@@ -1607,7 +1612,6 @@ static struct notifier_block i8042_kbd_bind_notifier_block = { |
338 |
+ |
339 |
+ static int __init i8042_init(void) |
340 |
+ { |
341 |
+- struct platform_device *pdev; |
342 |
+ int err; |
343 |
+ |
344 |
+ dbg_init(); |
345 |
+@@ -1623,17 +1627,29 @@ static int __init i8042_init(void) |
346 |
+ /* Set this before creating the dev to allow i8042_command to work right away */ |
347 |
+ i8042_present = true; |
348 |
+ |
349 |
+- pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0); |
350 |
+- if (IS_ERR(pdev)) { |
351 |
+- err = PTR_ERR(pdev); |
352 |
++ err = platform_driver_register(&i8042_driver); |
353 |
++ if (err) |
354 |
+ goto err_platform_exit; |
355 |
++ |
356 |
++ i8042_platform_device = platform_device_alloc("i8042", -1); |
357 |
++ if (!i8042_platform_device) { |
358 |
++ err = -ENOMEM; |
359 |
++ goto err_unregister_driver; |
360 |
+ } |
361 |
+ |
362 |
++ err = platform_device_add(i8042_platform_device); |
363 |
++ if (err) |
364 |
++ goto err_free_device; |
365 |
++ |
366 |
+ bus_register_notifier(&serio_bus, &i8042_kbd_bind_notifier_block); |
367 |
+ panic_blink = i8042_panic_blink; |
368 |
+ |
369 |
+ return 0; |
370 |
+ |
371 |
++err_free_device: |
372 |
++ platform_device_put(i8042_platform_device); |
373 |
++err_unregister_driver: |
374 |
++ platform_driver_unregister(&i8042_driver); |
375 |
+ err_platform_exit: |
376 |
+ i8042_platform_exit(); |
377 |
+ return err; |
378 |
+diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c |
379 |
+index 47f6fee1f3964..1812434cda847 100644 |
380 |
+--- a/drivers/net/ethernet/freescale/fman/fman_port.c |
381 |
++++ b/drivers/net/ethernet/freescale/fman/fman_port.c |
382 |
+@@ -1791,7 +1791,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
383 |
+ fman = dev_get_drvdata(&fm_pdev->dev); |
384 |
+ if (!fman) { |
385 |
+ err = -EINVAL; |
386 |
+- goto return_err; |
387 |
++ goto put_device; |
388 |
+ } |
389 |
+ |
390 |
+ err = of_property_read_u32(port_node, "cell-index", &val); |
391 |
+@@ -1799,7 +1799,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
392 |
+ dev_err(port->dev, "%s: reading cell-index for %pOF failed\n", |
393 |
+ __func__, port_node); |
394 |
+ err = -EINVAL; |
395 |
+- goto return_err; |
396 |
++ goto put_device; |
397 |
+ } |
398 |
+ port_id = (u8)val; |
399 |
+ port->dts_params.id = port_id; |
400 |
+@@ -1833,7 +1833,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
401 |
+ } else { |
402 |
+ dev_err(port->dev, "%s: Illegal port type\n", __func__); |
403 |
+ err = -EINVAL; |
404 |
+- goto return_err; |
405 |
++ goto put_device; |
406 |
+ } |
407 |
+ |
408 |
+ port->dts_params.type = port_type; |
409 |
+@@ -1847,7 +1847,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
410 |
+ dev_err(port->dev, "%s: incorrect qman-channel-id\n", |
411 |
+ __func__); |
412 |
+ err = -EINVAL; |
413 |
+- goto return_err; |
414 |
++ goto put_device; |
415 |
+ } |
416 |
+ port->dts_params.qman_channel_id = qman_channel_id; |
417 |
+ } |
418 |
+@@ -1857,7 +1857,7 @@ static int fman_port_probe(struct platform_device *of_dev) |
419 |
+ dev_err(port->dev, "%s: of_address_to_resource() failed\n", |
420 |
+ __func__); |
421 |
+ err = -ENOMEM; |
422 |
+- goto return_err; |
423 |
++ goto put_device; |
424 |
+ } |
425 |
+ |
426 |
+ port->dts_params.fman = fman; |
427 |
+@@ -1882,6 +1882,8 @@ static int fman_port_probe(struct platform_device *of_dev) |
428 |
+ |
429 |
+ return 0; |
430 |
+ |
431 |
++put_device: |
432 |
++ put_device(&fm_pdev->dev); |
433 |
+ return_err: |
434 |
+ of_node_put(port_node); |
435 |
+ free_port: |
436 |
+diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c |
437 |
+index 6e504854571cf..94541bf889a23 100644 |
438 |
+--- a/drivers/net/ethernet/lantiq_xrx200.c |
439 |
++++ b/drivers/net/ethernet/lantiq_xrx200.c |
440 |
+@@ -209,7 +209,7 @@ static int xrx200_hw_receive(struct xrx200_chan *ch) |
441 |
+ skb->protocol = eth_type_trans(skb, net_dev); |
442 |
+ netif_receive_skb(skb); |
443 |
+ net_dev->stats.rx_packets++; |
444 |
+- net_dev->stats.rx_bytes += len - ETH_FCS_LEN; |
445 |
++ net_dev->stats.rx_bytes += len; |
446 |
+ |
447 |
+ return 0; |
448 |
+ } |
449 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
450 |
+index 5f4f0f61c83c8..dea884c94568c 100644 |
451 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
452 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c |
453 |
+@@ -3907,12 +3907,11 @@ static int set_feature_arfs(struct net_device *netdev, bool enable) |
454 |
+ |
455 |
+ static int mlx5e_handle_feature(struct net_device *netdev, |
456 |
+ netdev_features_t *features, |
457 |
+- netdev_features_t wanted_features, |
458 |
+ netdev_features_t feature, |
459 |
+ mlx5e_feature_handler feature_handler) |
460 |
+ { |
461 |
+- netdev_features_t changes = wanted_features ^ netdev->features; |
462 |
+- bool enable = !!(wanted_features & feature); |
463 |
++ netdev_features_t changes = *features ^ netdev->features; |
464 |
++ bool enable = !!(*features & feature); |
465 |
+ int err; |
466 |
+ |
467 |
+ if (!(changes & feature)) |
468 |
+@@ -3920,22 +3919,22 @@ static int mlx5e_handle_feature(struct net_device *netdev, |
469 |
+ |
470 |
+ err = feature_handler(netdev, enable); |
471 |
+ if (err) { |
472 |
++ MLX5E_SET_FEATURE(features, feature, !enable); |
473 |
+ netdev_err(netdev, "%s feature %pNF failed, err %d\n", |
474 |
+ enable ? "Enable" : "Disable", &feature, err); |
475 |
+ return err; |
476 |
+ } |
477 |
+ |
478 |
+- MLX5E_SET_FEATURE(features, feature, enable); |
479 |
+ return 0; |
480 |
+ } |
481 |
+ |
482 |
+ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) |
483 |
+ { |
484 |
+- netdev_features_t oper_features = netdev->features; |
485 |
++ netdev_features_t oper_features = features; |
486 |
+ int err = 0; |
487 |
+ |
488 |
+ #define MLX5E_HANDLE_FEATURE(feature, handler) \ |
489 |
+- mlx5e_handle_feature(netdev, &oper_features, features, feature, handler) |
490 |
++ mlx5e_handle_feature(netdev, &oper_features, feature, handler) |
491 |
+ |
492 |
+ err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro); |
493 |
+ err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER, |
494 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c |
495 |
+index 56bf900eb753f..dbdb6a9592f09 100644 |
496 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c |
497 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c |
498 |
+@@ -2,6 +2,7 @@ |
499 |
+ /* Copyright (c) 2019 Mellanox Technologies. */ |
500 |
+ |
501 |
+ #include <linux/mlx5/eswitch.h> |
502 |
++#include <linux/err.h> |
503 |
+ #include "dr_types.h" |
504 |
+ |
505 |
+ static int dr_domain_init_cache(struct mlx5dr_domain *dmn) |
506 |
+@@ -64,9 +65,9 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn) |
507 |
+ } |
508 |
+ |
509 |
+ dmn->uar = mlx5_get_uars_page(dmn->mdev); |
510 |
+- if (!dmn->uar) { |
511 |
++ if (IS_ERR(dmn->uar)) { |
512 |
+ mlx5dr_err(dmn, "Couldn't allocate UAR\n"); |
513 |
+- ret = -ENOMEM; |
514 |
++ ret = PTR_ERR(dmn->uar); |
515 |
+ goto clean_pd; |
516 |
+ } |
517 |
+ |
518 |
+diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
519 |
+index 99ba3551458fc..f9c303d76658a 100644 |
520 |
+--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
521 |
++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c |
522 |
+@@ -1995,7 +1995,7 @@ static int ionic_lif_init(struct ionic_lif *lif) |
523 |
+ return -EINVAL; |
524 |
+ } |
525 |
+ |
526 |
+- lif->dbid_inuse = bitmap_alloc(lif->dbid_count, GFP_KERNEL); |
527 |
++ lif->dbid_inuse = bitmap_zalloc(lif->dbid_count, GFP_KERNEL); |
528 |
+ if (!lif->dbid_inuse) { |
529 |
+ dev_err(dev, "Failed alloc doorbell id bitmap, aborting\n"); |
530 |
+ return -ENOMEM; |
531 |
+diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c |
532 |
+index b744c09346a7c..dda051c94fb4d 100644 |
533 |
+--- a/drivers/net/usb/pegasus.c |
534 |
++++ b/drivers/net/usb/pegasus.c |
535 |
+@@ -495,11 +495,11 @@ static void read_bulk_callback(struct urb *urb) |
536 |
+ goto goon; |
537 |
+ |
538 |
+ rx_status = buf[count - 2]; |
539 |
+- if (rx_status & 0x1e) { |
540 |
++ if (rx_status & 0x1c) { |
541 |
+ netif_dbg(pegasus, rx_err, net, |
542 |
+ "RX packet error %x\n", rx_status); |
543 |
+ net->stats.rx_errors++; |
544 |
+- if (rx_status & 0x06) /* long or runt */ |
545 |
++ if (rx_status & 0x04) /* runt */ |
546 |
+ net->stats.rx_length_errors++; |
547 |
+ if (rx_status & 0x08) |
548 |
+ net->stats.rx_crc_errors++; |
549 |
+diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c |
550 |
+index 23ed11f91213d..6ea59426ab0bf 100644 |
551 |
+--- a/drivers/nfc/st21nfca/i2c.c |
552 |
++++ b/drivers/nfc/st21nfca/i2c.c |
553 |
+@@ -533,7 +533,8 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client, |
554 |
+ phy->gpiod_ena = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); |
555 |
+ if (IS_ERR(phy->gpiod_ena)) { |
556 |
+ nfc_err(dev, "Unable to get ENABLE GPIO\n"); |
557 |
+- return PTR_ERR(phy->gpiod_ena); |
558 |
++ r = PTR_ERR(phy->gpiod_ena); |
559 |
++ goto out_free; |
560 |
+ } |
561 |
+ |
562 |
+ phy->se_status.is_ese_present = |
563 |
+@@ -544,7 +545,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client, |
564 |
+ r = st21nfca_hci_platform_init(phy); |
565 |
+ if (r < 0) { |
566 |
+ nfc_err(&client->dev, "Unable to reboot st21nfca\n"); |
567 |
+- return r; |
568 |
++ goto out_free; |
569 |
+ } |
570 |
+ |
571 |
+ r = devm_request_threaded_irq(&client->dev, client->irq, NULL, |
572 |
+@@ -553,15 +554,23 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client, |
573 |
+ ST21NFCA_HCI_DRIVER_NAME, phy); |
574 |
+ if (r < 0) { |
575 |
+ nfc_err(&client->dev, "Unable to register IRQ handler\n"); |
576 |
+- return r; |
577 |
++ goto out_free; |
578 |
+ } |
579 |
+ |
580 |
+- return st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, |
581 |
+- ST21NFCA_FRAME_HEADROOM, |
582 |
+- ST21NFCA_FRAME_TAILROOM, |
583 |
+- ST21NFCA_HCI_LLC_MAX_PAYLOAD, |
584 |
+- &phy->hdev, |
585 |
+- &phy->se_status); |
586 |
++ r = st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, |
587 |
++ ST21NFCA_FRAME_HEADROOM, |
588 |
++ ST21NFCA_FRAME_TAILROOM, |
589 |
++ ST21NFCA_HCI_LLC_MAX_PAYLOAD, |
590 |
++ &phy->hdev, |
591 |
++ &phy->se_status); |
592 |
++ if (r) |
593 |
++ goto out_free; |
594 |
++ |
595 |
++ return 0; |
596 |
++ |
597 |
++out_free: |
598 |
++ kfree_skb(phy->pending_skb); |
599 |
++ return r; |
600 |
+ } |
601 |
+ |
602 |
+ static int st21nfca_hci_i2c_remove(struct i2c_client *client) |
603 |
+@@ -574,6 +583,8 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client) |
604 |
+ |
605 |
+ if (phy->powered) |
606 |
+ st21nfca_hci_i2c_disable(phy); |
607 |
++ if (phy->pending_skb) |
608 |
++ kfree_skb(phy->pending_skb); |
609 |
+ |
610 |
+ return 0; |
611 |
+ } |
612 |
+diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c |
613 |
+index 7e3083deb1c5d..1b86005c0f5f4 100644 |
614 |
+--- a/drivers/platform/x86/apple-gmux.c |
615 |
++++ b/drivers/platform/x86/apple-gmux.c |
616 |
+@@ -625,7 +625,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) |
617 |
+ } |
618 |
+ |
619 |
+ gmux_data->iostart = res->start; |
620 |
+- gmux_data->iolen = res->end - res->start; |
621 |
++ gmux_data->iolen = resource_size(res); |
622 |
+ |
623 |
+ if (gmux_data->iolen < GMUX_MIN_IO_LEN) { |
624 |
+ pr_err("gmux I/O region too small (%lu < %u)\n", |
625 |
+diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c |
626 |
+index 3c9248d2435e1..e15bb3dfe9956 100644 |
627 |
+--- a/drivers/scsi/lpfc/lpfc_debugfs.c |
628 |
++++ b/drivers/scsi/lpfc/lpfc_debugfs.c |
629 |
+@@ -2757,8 +2757,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf, |
630 |
+ char mybuf[64]; |
631 |
+ char *pbuf; |
632 |
+ |
633 |
+- if (nbytes > 64) |
634 |
+- nbytes = 64; |
635 |
++ if (nbytes > 63) |
636 |
++ nbytes = 63; |
637 |
+ |
638 |
+ memset(mybuf, 0, sizeof(mybuf)); |
639 |
+ |
640 |
+diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c |
641 |
+index 0ac342b1deb95..0370ff6dd2efd 100644 |
642 |
+--- a/drivers/scsi/vmw_pvscsi.c |
643 |
++++ b/drivers/scsi/vmw_pvscsi.c |
644 |
+@@ -578,9 +578,12 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, |
645 |
+ * Commands like INQUIRY may transfer less data than |
646 |
+ * requested by the initiator via bufflen. Set residual |
647 |
+ * count to make upper layer aware of the actual amount |
648 |
+- * of data returned. |
649 |
++ * of data returned. There are cases when controller |
650 |
++ * returns zero dataLen with non zero data - do not set |
651 |
++ * residual count in that case. |
652 |
+ */ |
653 |
+- scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); |
654 |
++ if (e->dataLen && (e->dataLen < scsi_bufflen(cmd))) |
655 |
++ scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen); |
656 |
+ cmd->result = (DID_OK << 16); |
657 |
+ break; |
658 |
+ |
659 |
+diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c |
660 |
+index d6491e973fa4c..0d5ae80530498 100644 |
661 |
+--- a/drivers/tee/tee_shm.c |
662 |
++++ b/drivers/tee/tee_shm.c |
663 |
+@@ -1,26 +1,18 @@ |
664 |
+ // SPDX-License-Identifier: GPL-2.0-only |
665 |
+ /* |
666 |
+- * Copyright (c) 2015-2016, Linaro Limited |
667 |
++ * Copyright (c) 2015-2017, 2019-2021 Linaro Limited |
668 |
+ */ |
669 |
++#include <linux/anon_inodes.h> |
670 |
+ #include <linux/device.h> |
671 |
+-#include <linux/dma-buf.h> |
672 |
+-#include <linux/fdtable.h> |
673 |
+ #include <linux/idr.h> |
674 |
++#include <linux/mm.h> |
675 |
+ #include <linux/sched.h> |
676 |
+ #include <linux/slab.h> |
677 |
+ #include <linux/tee_drv.h> |
678 |
+ #include "tee_private.h" |
679 |
+ |
680 |
+-static void tee_shm_release(struct tee_shm *shm) |
681 |
++static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) |
682 |
+ { |
683 |
+- struct tee_device *teedev = shm->teedev; |
684 |
+- |
685 |
+- mutex_lock(&teedev->mutex); |
686 |
+- idr_remove(&teedev->idr, shm->id); |
687 |
+- if (shm->ctx) |
688 |
+- list_del(&shm->link); |
689 |
+- mutex_unlock(&teedev->mutex); |
690 |
+- |
691 |
+ if (shm->flags & TEE_SHM_POOL) { |
692 |
+ struct tee_shm_pool_mgr *poolm; |
693 |
+ |
694 |
+@@ -52,51 +44,6 @@ static void tee_shm_release(struct tee_shm *shm) |
695 |
+ tee_device_put(teedev); |
696 |
+ } |
697 |
+ |
698 |
+-static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment |
699 |
+- *attach, enum dma_data_direction dir) |
700 |
+-{ |
701 |
+- return NULL; |
702 |
+-} |
703 |
+- |
704 |
+-static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach, |
705 |
+- struct sg_table *table, |
706 |
+- enum dma_data_direction dir) |
707 |
+-{ |
708 |
+-} |
709 |
+- |
710 |
+-static void tee_shm_op_release(struct dma_buf *dmabuf) |
711 |
+-{ |
712 |
+- struct tee_shm *shm = dmabuf->priv; |
713 |
+- |
714 |
+- tee_shm_release(shm); |
715 |
+-} |
716 |
+- |
717 |
+-static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum) |
718 |
+-{ |
719 |
+- return NULL; |
720 |
+-} |
721 |
+- |
722 |
+-static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) |
723 |
+-{ |
724 |
+- struct tee_shm *shm = dmabuf->priv; |
725 |
+- size_t size = vma->vm_end - vma->vm_start; |
726 |
+- |
727 |
+- /* Refuse sharing shared memory provided by application */ |
728 |
+- if (shm->flags & TEE_SHM_REGISTER) |
729 |
+- return -EINVAL; |
730 |
+- |
731 |
+- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT, |
732 |
+- size, vma->vm_page_prot); |
733 |
+-} |
734 |
+- |
735 |
+-static const struct dma_buf_ops tee_shm_dma_buf_ops = { |
736 |
+- .map_dma_buf = tee_shm_op_map_dma_buf, |
737 |
+- .unmap_dma_buf = tee_shm_op_unmap_dma_buf, |
738 |
+- .release = tee_shm_op_release, |
739 |
+- .map = tee_shm_op_map, |
740 |
+- .mmap = tee_shm_op_mmap, |
741 |
+-}; |
742 |
+- |
743 |
+ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx, |
744 |
+ struct tee_device *teedev, |
745 |
+ size_t size, u32 flags) |
746 |
+@@ -137,6 +84,7 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx, |
747 |
+ goto err_dev_put; |
748 |
+ } |
749 |
+ |
750 |
++ refcount_set(&shm->refcount, 1); |
751 |
+ shm->flags = flags | TEE_SHM_POOL; |
752 |
+ shm->teedev = teedev; |
753 |
+ shm->ctx = ctx; |
754 |
+@@ -159,21 +107,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx, |
755 |
+ goto err_pool_free; |
756 |
+ } |
757 |
+ |
758 |
+- if (flags & TEE_SHM_DMA_BUF) { |
759 |
+- DEFINE_DMA_BUF_EXPORT_INFO(exp_info); |
760 |
+- |
761 |
+- exp_info.ops = &tee_shm_dma_buf_ops; |
762 |
+- exp_info.size = shm->size; |
763 |
+- exp_info.flags = O_RDWR; |
764 |
+- exp_info.priv = shm; |
765 |
+- |
766 |
+- shm->dmabuf = dma_buf_export(&exp_info); |
767 |
+- if (IS_ERR(shm->dmabuf)) { |
768 |
+- ret = ERR_CAST(shm->dmabuf); |
769 |
+- goto err_rem; |
770 |
+- } |
771 |
+- } |
772 |
+- |
773 |
+ if (ctx) { |
774 |
+ teedev_ctx_get(ctx); |
775 |
+ mutex_lock(&teedev->mutex); |
776 |
+@@ -182,10 +115,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx, |
777 |
+ } |
778 |
+ |
779 |
+ return shm; |
780 |
+-err_rem: |
781 |
+- mutex_lock(&teedev->mutex); |
782 |
+- idr_remove(&teedev->idr, shm->id); |
783 |
+- mutex_unlock(&teedev->mutex); |
784 |
+ err_pool_free: |
785 |
+ poolm->ops->free(poolm, shm); |
786 |
+ err_kfree: |
787 |
+@@ -268,6 +197,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, |
788 |
+ goto err; |
789 |
+ } |
790 |
+ |
791 |
++ refcount_set(&shm->refcount, 1); |
792 |
+ shm->flags = flags | TEE_SHM_REGISTER; |
793 |
+ shm->teedev = teedev; |
794 |
+ shm->ctx = ctx; |
795 |
+@@ -309,22 +239,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, |
796 |
+ goto err; |
797 |
+ } |
798 |
+ |
799 |
+- if (flags & TEE_SHM_DMA_BUF) { |
800 |
+- DEFINE_DMA_BUF_EXPORT_INFO(exp_info); |
801 |
+- |
802 |
+- exp_info.ops = &tee_shm_dma_buf_ops; |
803 |
+- exp_info.size = shm->size; |
804 |
+- exp_info.flags = O_RDWR; |
805 |
+- exp_info.priv = shm; |
806 |
+- |
807 |
+- shm->dmabuf = dma_buf_export(&exp_info); |
808 |
+- if (IS_ERR(shm->dmabuf)) { |
809 |
+- ret = ERR_CAST(shm->dmabuf); |
810 |
+- teedev->desc->ops->shm_unregister(ctx, shm); |
811 |
+- goto err; |
812 |
+- } |
813 |
+- } |
814 |
+- |
815 |
+ mutex_lock(&teedev->mutex); |
816 |
+ list_add_tail(&shm->link, &ctx->list_shm); |
817 |
+ mutex_unlock(&teedev->mutex); |
818 |
+@@ -352,6 +266,35 @@ err: |
819 |
+ } |
820 |
+ EXPORT_SYMBOL_GPL(tee_shm_register); |
821 |
+ |
822 |
++static int tee_shm_fop_release(struct inode *inode, struct file *filp) |
823 |
++{ |
824 |
++ tee_shm_put(filp->private_data); |
825 |
++ return 0; |
826 |
++} |
827 |
++ |
828 |
++static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma) |
829 |
++{ |
830 |
++ struct tee_shm *shm = filp->private_data; |
831 |
++ size_t size = vma->vm_end - vma->vm_start; |
832 |
++ |
833 |
++ /* Refuse sharing shared memory provided by application */ |
834 |
++ if (shm->flags & TEE_SHM_USER_MAPPED) |
835 |
++ return -EINVAL; |
836 |
++ |
837 |
++ /* check for overflowing the buffer's size */ |
838 |
++ if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT) |
839 |
++ return -EINVAL; |
840 |
++ |
841 |
++ return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT, |
842 |
++ size, vma->vm_page_prot); |
843 |
++} |
844 |
++ |
845 |
++static const struct file_operations tee_shm_fops = { |
846 |
++ .owner = THIS_MODULE, |
847 |
++ .release = tee_shm_fop_release, |
848 |
++ .mmap = tee_shm_fop_mmap, |
849 |
++}; |
850 |
++ |
851 |
+ /** |
852 |
+ * tee_shm_get_fd() - Increase reference count and return file descriptor |
853 |
+ * @shm: Shared memory handle |
854 |
+@@ -364,10 +307,11 @@ int tee_shm_get_fd(struct tee_shm *shm) |
855 |
+ if (!(shm->flags & TEE_SHM_DMA_BUF)) |
856 |
+ return -EINVAL; |
857 |
+ |
858 |
+- get_dma_buf(shm->dmabuf); |
859 |
+- fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC); |
860 |
++ /* matched by tee_shm_put() in tee_shm_op_release() */ |
861 |
++ refcount_inc(&shm->refcount); |
862 |
++ fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR); |
863 |
+ if (fd < 0) |
864 |
+- dma_buf_put(shm->dmabuf); |
865 |
++ tee_shm_put(shm); |
866 |
+ return fd; |
867 |
+ } |
868 |
+ |
869 |
+@@ -377,17 +321,7 @@ int tee_shm_get_fd(struct tee_shm *shm) |
870 |
+ */ |
871 |
+ void tee_shm_free(struct tee_shm *shm) |
872 |
+ { |
873 |
+- /* |
874 |
+- * dma_buf_put() decreases the dmabuf reference counter and will |
875 |
+- * call tee_shm_release() when the last reference is gone. |
876 |
+- * |
877 |
+- * In the case of driver private memory we call tee_shm_release |
878 |
+- * directly instead as it doesn't have a reference counter. |
879 |
+- */ |
880 |
+- if (shm->flags & TEE_SHM_DMA_BUF) |
881 |
+- dma_buf_put(shm->dmabuf); |
882 |
+- else |
883 |
+- tee_shm_release(shm); |
884 |
++ tee_shm_put(shm); |
885 |
+ } |
886 |
+ EXPORT_SYMBOL_GPL(tee_shm_free); |
887 |
+ |
888 |
+@@ -494,10 +428,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id) |
889 |
+ teedev = ctx->teedev; |
890 |
+ mutex_lock(&teedev->mutex); |
891 |
+ shm = idr_find(&teedev->idr, id); |
892 |
++ /* |
893 |
++ * If the tee_shm was found in the IDR it must have a refcount |
894 |
++ * larger than 0 due to the guarantee in tee_shm_put() below. So |
895 |
++ * it's safe to use refcount_inc(). |
896 |
++ */ |
897 |
+ if (!shm || shm->ctx != ctx) |
898 |
+ shm = ERR_PTR(-EINVAL); |
899 |
+- else if (shm->flags & TEE_SHM_DMA_BUF) |
900 |
+- get_dma_buf(shm->dmabuf); |
901 |
++ else |
902 |
++ refcount_inc(&shm->refcount); |
903 |
+ mutex_unlock(&teedev->mutex); |
904 |
+ return shm; |
905 |
+ } |
906 |
+@@ -509,7 +448,25 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id); |
907 |
+ */ |
908 |
+ void tee_shm_put(struct tee_shm *shm) |
909 |
+ { |
910 |
+- if (shm->flags & TEE_SHM_DMA_BUF) |
911 |
+- dma_buf_put(shm->dmabuf); |
912 |
++ struct tee_device *teedev = shm->teedev; |
913 |
++ bool do_release = false; |
914 |
++ |
915 |
++ mutex_lock(&teedev->mutex); |
916 |
++ if (refcount_dec_and_test(&shm->refcount)) { |
917 |
++ /* |
918 |
++ * refcount has reached 0, we must now remove it from the |
919 |
++ * IDR before releasing the mutex. This will guarantee that |
920 |
++ * the refcount_inc() in tee_shm_get_from_id() never starts |
921 |
++ * from 0. |
922 |
++ */ |
923 |
++ idr_remove(&teedev->idr, shm->id); |
924 |
++ if (shm->ctx) |
925 |
++ list_del(&shm->link); |
926 |
++ do_release = true; |
927 |
++ } |
928 |
++ mutex_unlock(&teedev->mutex); |
929 |
++ |
930 |
++ if (do_release) |
931 |
++ tee_shm_release(teedev, shm); |
932 |
+ } |
933 |
+ EXPORT_SYMBOL_GPL(tee_shm_put); |
934 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
935 |
+index 94ccf43368dfc..3f5c21f7f9905 100644 |
936 |
+--- a/drivers/usb/gadget/function/f_fs.c |
937 |
++++ b/drivers/usb/gadget/function/f_fs.c |
938 |
+@@ -1791,11 +1791,15 @@ static void ffs_data_clear(struct ffs_data *ffs) |
939 |
+ |
940 |
+ BUG_ON(ffs->gadget); |
941 |
+ |
942 |
+- if (ffs->epfiles) |
943 |
++ if (ffs->epfiles) { |
944 |
+ ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count); |
945 |
++ ffs->epfiles = NULL; |
946 |
++ } |
947 |
+ |
948 |
+- if (ffs->ffs_eventfd) |
949 |
++ if (ffs->ffs_eventfd) { |
950 |
+ eventfd_ctx_put(ffs->ffs_eventfd); |
951 |
++ ffs->ffs_eventfd = NULL; |
952 |
++ } |
953 |
+ |
954 |
+ kfree(ffs->raw_descs_data); |
955 |
+ kfree(ffs->raw_strings); |
956 |
+@@ -1808,7 +1812,6 @@ static void ffs_data_reset(struct ffs_data *ffs) |
957 |
+ |
958 |
+ ffs_data_clear(ffs); |
959 |
+ |
960 |
+- ffs->epfiles = NULL; |
961 |
+ ffs->raw_descs_data = NULL; |
962 |
+ ffs->raw_descs = NULL; |
963 |
+ ffs->raw_strings = NULL; |
964 |
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
965 |
+index ded05c39e4d1c..e7533787db411 100644 |
966 |
+--- a/drivers/usb/host/xhci-pci.c |
967 |
++++ b/drivers/usb/host/xhci-pci.c |
968 |
+@@ -108,7 +108,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
969 |
+ /* Look for vendor-specific quirks */ |
970 |
+ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && |
971 |
+ (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || |
972 |
+- pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || |
973 |
+ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { |
974 |
+ if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && |
975 |
+ pdev->revision == 0x0) { |
976 |
+@@ -143,6 +142,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) |
977 |
+ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009) |
978 |
+ xhci->quirks |= XHCI_BROKEN_STREAMS; |
979 |
+ |
980 |
++ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && |
981 |
++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100) |
982 |
++ xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
983 |
++ |
984 |
+ if (pdev->vendor == PCI_VENDOR_ID_NEC) |
985 |
+ xhci->quirks |= XHCI_NEC_HOST; |
986 |
+ |
987 |
+diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c |
988 |
+index 619c4598e64ea..253c8b71d3c49 100644 |
989 |
+--- a/drivers/usb/mtu3/mtu3_gadget.c |
990 |
++++ b/drivers/usb/mtu3/mtu3_gadget.c |
991 |
+@@ -100,6 +100,13 @@ static int mtu3_ep_enable(struct mtu3_ep *mep) |
992 |
+ interval = clamp_val(interval, 1, 16) - 1; |
993 |
+ mult = usb_endpoint_maxp_mult(desc) - 1; |
994 |
+ } |
995 |
++ break; |
996 |
++ case USB_SPEED_FULL: |
997 |
++ if (usb_endpoint_xfer_isoc(desc)) |
998 |
++ interval = clamp_val(desc->bInterval, 1, 16); |
999 |
++ else if (usb_endpoint_xfer_int(desc)) |
1000 |
++ interval = clamp_val(desc->bInterval, 1, 255); |
1001 |
++ |
1002 |
+ break; |
1003 |
+ default: |
1004 |
+ break; /*others are ignored */ |
1005 |
+@@ -245,6 +252,7 @@ struct usb_request *mtu3_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) |
1006 |
+ mreq->request.dma = DMA_ADDR_INVALID; |
1007 |
+ mreq->epnum = mep->epnum; |
1008 |
+ mreq->mep = mep; |
1009 |
++ INIT_LIST_HEAD(&mreq->list); |
1010 |
+ trace_mtu3_alloc_request(mreq); |
1011 |
+ |
1012 |
+ return &mreq->request; |
1013 |
+diff --git a/drivers/usb/mtu3/mtu3_qmu.c b/drivers/usb/mtu3/mtu3_qmu.c |
1014 |
+index 3f414f91b5899..2ea3157ddb6e2 100644 |
1015 |
+--- a/drivers/usb/mtu3/mtu3_qmu.c |
1016 |
++++ b/drivers/usb/mtu3/mtu3_qmu.c |
1017 |
+@@ -273,6 +273,8 @@ static int mtu3_prepare_tx_gpd(struct mtu3_ep *mep, struct mtu3_request *mreq) |
1018 |
+ gpd->dw3_info |= cpu_to_le32(GPD_EXT_FLAG_ZLP); |
1019 |
+ } |
1020 |
+ |
1021 |
++ /* prevent reorder, make sure GPD's HWO is set last */ |
1022 |
++ mb(); |
1023 |
+ gpd->dw0_info |= cpu_to_le32(GPD_FLAGS_IOC | GPD_FLAGS_HWO); |
1024 |
+ |
1025 |
+ mreq->gpd = gpd; |
1026 |
+@@ -306,6 +308,8 @@ static int mtu3_prepare_rx_gpd(struct mtu3_ep *mep, struct mtu3_request *mreq) |
1027 |
+ gpd->next_gpd = cpu_to_le32(lower_32_bits(enq_dma)); |
1028 |
+ ext_addr |= GPD_EXT_NGP(mtu, upper_32_bits(enq_dma)); |
1029 |
+ gpd->dw3_info = cpu_to_le32(ext_addr); |
1030 |
++ /* prevent reorder, make sure GPD's HWO is set last */ |
1031 |
++ mb(); |
1032 |
+ gpd->dw0_info |= cpu_to_le32(GPD_FLAGS_IOC | GPD_FLAGS_HWO); |
1033 |
+ |
1034 |
+ mreq->gpd = gpd; |
1035 |
+@@ -445,7 +449,8 @@ static void qmu_tx_zlp_error_handler(struct mtu3 *mtu, u8 epnum) |
1036 |
+ return; |
1037 |
+ } |
1038 |
+ mtu3_setbits(mbase, MU3D_EP_TXCR0(mep->epnum), TX_TXPKTRDY); |
1039 |
+- |
1040 |
++ /* prevent reorder, make sure GPD's HWO is set last */ |
1041 |
++ mb(); |
1042 |
+ /* by pass the current GDP */ |
1043 |
+ gpd_current->dw0_info |= cpu_to_le32(GPD_FLAGS_BPS | GPD_FLAGS_HWO); |
1044 |
+ |
1045 |
+diff --git a/include/linux/memblock.h b/include/linux/memblock.h |
1046 |
+index f491690d54c6c..64b971b2542d6 100644 |
1047 |
+--- a/include/linux/memblock.h |
1048 |
++++ b/include/linux/memblock.h |
1049 |
+@@ -351,8 +351,8 @@ phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align, |
1050 |
+ phys_addr_t start, phys_addr_t end); |
1051 |
+ phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); |
1052 |
+ |
1053 |
+-static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, |
1054 |
+- phys_addr_t align) |
1055 |
++static __always_inline phys_addr_t memblock_phys_alloc(phys_addr_t size, |
1056 |
++ phys_addr_t align) |
1057 |
+ { |
1058 |
+ return memblock_phys_alloc_range(size, align, 0, |
1059 |
+ MEMBLOCK_ALLOC_ACCESSIBLE); |
1060 |
+diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h |
1061 |
+index cd15c1b7fae06..e08ace76eba6a 100644 |
1062 |
+--- a/include/linux/tee_drv.h |
1063 |
++++ b/include/linux/tee_drv.h |
1064 |
+@@ -178,7 +178,7 @@ void tee_device_unregister(struct tee_device *teedev); |
1065 |
+ * @offset: offset of buffer in user space |
1066 |
+ * @pages: locked pages from userspace |
1067 |
+ * @num_pages: number of locked pages |
1068 |
+- * @dmabuf: dmabuf used to for exporting to user space |
1069 |
++ * @refcount: reference counter |
1070 |
+ * @flags: defined by TEE_SHM_* in tee_drv.h |
1071 |
+ * @id: unique id of a shared memory object on this device |
1072 |
+ * |
1073 |
+@@ -195,7 +195,7 @@ struct tee_shm { |
1074 |
+ unsigned int offset; |
1075 |
+ struct page **pages; |
1076 |
+ size_t num_pages; |
1077 |
+- struct dma_buf *dmabuf; |
1078 |
++ refcount_t refcount; |
1079 |
+ u32 flags; |
1080 |
+ int id; |
1081 |
+ }; |
1082 |
+diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h |
1083 |
+index 3ab5c6bbb90bd..35c108a6b8720 100644 |
1084 |
+--- a/include/net/sctp/sctp.h |
1085 |
++++ b/include/net/sctp/sctp.h |
1086 |
+@@ -103,6 +103,7 @@ extern struct percpu_counter sctp_sockets_allocated; |
1087 |
+ int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *); |
1088 |
+ struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *); |
1089 |
+ |
1090 |
++typedef int (*sctp_callback_t)(struct sctp_endpoint *, struct sctp_transport *, void *); |
1091 |
+ void sctp_transport_walk_start(struct rhashtable_iter *iter); |
1092 |
+ void sctp_transport_walk_stop(struct rhashtable_iter *iter); |
1093 |
+ struct sctp_transport *sctp_transport_get_next(struct net *net, |
1094 |
+@@ -113,9 +114,8 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *), |
1095 |
+ struct net *net, |
1096 |
+ const union sctp_addr *laddr, |
1097 |
+ const union sctp_addr *paddr, void *p); |
1098 |
+-int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), |
1099 |
+- int (*cb_done)(struct sctp_transport *, void *), |
1100 |
+- struct net *net, int *pos, void *p); |
1101 |
++int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done, |
1102 |
++ struct net *net, int *pos, void *p); |
1103 |
+ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p); |
1104 |
+ int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc, |
1105 |
+ struct sctp_info *info); |
1106 |
+diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h |
1107 |
+index fd7c3f76040c3..cb05e503c9cd1 100644 |
1108 |
+--- a/include/net/sctp/structs.h |
1109 |
++++ b/include/net/sctp/structs.h |
1110 |
+@@ -1345,6 +1345,7 @@ struct sctp_endpoint { |
1111 |
+ |
1112 |
+ u32 secid; |
1113 |
+ u32 peer_secid; |
1114 |
++ struct rcu_head rcu; |
1115 |
+ }; |
1116 |
+ |
1117 |
+ /* Recover the outter endpoint structure. */ |
1118 |
+@@ -1360,7 +1361,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base) |
1119 |
+ struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t); |
1120 |
+ void sctp_endpoint_free(struct sctp_endpoint *); |
1121 |
+ void sctp_endpoint_put(struct sctp_endpoint *); |
1122 |
+-void sctp_endpoint_hold(struct sctp_endpoint *); |
1123 |
++int sctp_endpoint_hold(struct sctp_endpoint *ep); |
1124 |
+ void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *); |
1125 |
+ struct sctp_association *sctp_endpoint_lookup_assoc( |
1126 |
+ const struct sctp_endpoint *ep, |
1127 |
+diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h |
1128 |
+index f6e3c8c9c7449..4fa4e979e948a 100644 |
1129 |
+--- a/include/uapi/linux/nfc.h |
1130 |
++++ b/include/uapi/linux/nfc.h |
1131 |
+@@ -263,7 +263,7 @@ enum nfc_sdp_attr { |
1132 |
+ #define NFC_SE_ENABLED 0x1 |
1133 |
+ |
1134 |
+ struct sockaddr_nfc { |
1135 |
+- sa_family_t sa_family; |
1136 |
++ __kernel_sa_family_t sa_family; |
1137 |
+ __u32 dev_idx; |
1138 |
+ __u32 target_idx; |
1139 |
+ __u32 nfc_protocol; |
1140 |
+@@ -271,14 +271,14 @@ struct sockaddr_nfc { |
1141 |
+ |
1142 |
+ #define NFC_LLCP_MAX_SERVICE_NAME 63 |
1143 |
+ struct sockaddr_nfc_llcp { |
1144 |
+- sa_family_t sa_family; |
1145 |
++ __kernel_sa_family_t sa_family; |
1146 |
+ __u32 dev_idx; |
1147 |
+ __u32 target_idx; |
1148 |
+ __u32 nfc_protocol; |
1149 |
+ __u8 dsap; /* Destination SAP, if known */ |
1150 |
+ __u8 ssap; /* Source SAP to be bound to */ |
1151 |
+ char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */; |
1152 |
+- size_t service_name_len; |
1153 |
++ __kernel_size_t service_name_len; |
1154 |
+ }; |
1155 |
+ |
1156 |
+ /* NFC socket protocols */ |
1157 |
+diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c |
1158 |
+index 70f92aaca4110..c800220c404d5 100644 |
1159 |
+--- a/net/ipv4/af_inet.c |
1160 |
++++ b/net/ipv4/af_inet.c |
1161 |
+@@ -1974,6 +1974,10 @@ static int __init inet_init(void) |
1162 |
+ |
1163 |
+ ip_init(); |
1164 |
+ |
1165 |
++ /* Initialise per-cpu ipv4 mibs */ |
1166 |
++ if (init_ipv4_mibs()) |
1167 |
++ panic("%s: Cannot init ipv4 mibs\n", __func__); |
1168 |
++ |
1169 |
+ /* Setup TCP slab cache for open requests. */ |
1170 |
+ tcp_init(); |
1171 |
+ |
1172 |
+@@ -2004,12 +2008,6 @@ static int __init inet_init(void) |
1173 |
+ |
1174 |
+ if (init_inet_pernet_ops()) |
1175 |
+ pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__); |
1176 |
+- /* |
1177 |
+- * Initialise per-cpu ipv4 mibs |
1178 |
+- */ |
1179 |
+- |
1180 |
+- if (init_ipv4_mibs()) |
1181 |
+- pr_crit("%s: Cannot init ipv4 mibs\n", __func__); |
1182 |
+ |
1183 |
+ ipv4_proc_init(); |
1184 |
+ |
1185 |
+diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c |
1186 |
+index 818fc99756256..a71bfa5b02770 100644 |
1187 |
+--- a/net/ipv6/udp.c |
1188 |
++++ b/net/ipv6/udp.c |
1189 |
+@@ -1132,7 +1132,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, |
1190 |
+ kfree_skb(skb); |
1191 |
+ return -EINVAL; |
1192 |
+ } |
1193 |
+- if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) { |
1194 |
++ if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) { |
1195 |
+ kfree_skb(skb); |
1196 |
+ return -EINVAL; |
1197 |
+ } |
1198 |
+diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c |
1199 |
+index a33ea45dec054..27700887c3217 100644 |
1200 |
+--- a/net/ncsi/ncsi-netlink.c |
1201 |
++++ b/net/ncsi/ncsi-netlink.c |
1202 |
+@@ -112,7 +112,11 @@ static int ncsi_write_package_info(struct sk_buff *skb, |
1203 |
+ pnest = nla_nest_start_noflag(skb, NCSI_PKG_ATTR); |
1204 |
+ if (!pnest) |
1205 |
+ return -ENOMEM; |
1206 |
+- nla_put_u32(skb, NCSI_PKG_ATTR_ID, np->id); |
1207 |
++ rc = nla_put_u32(skb, NCSI_PKG_ATTR_ID, np->id); |
1208 |
++ if (rc) { |
1209 |
++ nla_nest_cancel(skb, pnest); |
1210 |
++ return rc; |
1211 |
++ } |
1212 |
+ if ((0x1 << np->id) == ndp->package_whitelist) |
1213 |
+ nla_put_flag(skb, NCSI_PKG_ATTR_FORCED); |
1214 |
+ cnest = nla_nest_start_noflag(skb, NCSI_PKG_ATTR_CHANNEL_LIST); |
1215 |
+diff --git a/net/sctp/diag.c b/net/sctp/diag.c |
1216 |
+index ba9f64fdfd238..7921e77fa55a3 100644 |
1217 |
+--- a/net/sctp/diag.c |
1218 |
++++ b/net/sctp/diag.c |
1219 |
+@@ -292,9 +292,8 @@ out: |
1220 |
+ return err; |
1221 |
+ } |
1222 |
+ |
1223 |
+-static int sctp_sock_dump(struct sctp_transport *tsp, void *p) |
1224 |
++static int sctp_sock_dump(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p) |
1225 |
+ { |
1226 |
+- struct sctp_endpoint *ep = tsp->asoc->ep; |
1227 |
+ struct sctp_comm_param *commp = p; |
1228 |
+ struct sock *sk = ep->base.sk; |
1229 |
+ struct sk_buff *skb = commp->skb; |
1230 |
+@@ -304,6 +303,8 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p) |
1231 |
+ int err = 0; |
1232 |
+ |
1233 |
+ lock_sock(sk); |
1234 |
++ if (ep != tsp->asoc->ep) |
1235 |
++ goto release; |
1236 |
+ list_for_each_entry(assoc, &ep->asocs, asocs) { |
1237 |
+ if (cb->args[4] < cb->args[1]) |
1238 |
+ goto next; |
1239 |
+@@ -346,9 +347,8 @@ release: |
1240 |
+ return err; |
1241 |
+ } |
1242 |
+ |
1243 |
+-static int sctp_sock_filter(struct sctp_transport *tsp, void *p) |
1244 |
++static int sctp_sock_filter(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p) |
1245 |
+ { |
1246 |
+- struct sctp_endpoint *ep = tsp->asoc->ep; |
1247 |
+ struct sctp_comm_param *commp = p; |
1248 |
+ struct sock *sk = ep->base.sk; |
1249 |
+ const struct inet_diag_req_v2 *r = commp->r; |
1250 |
+@@ -506,8 +506,8 @@ skip: |
1251 |
+ if (!(idiag_states & ~(TCPF_LISTEN | TCPF_CLOSE))) |
1252 |
+ goto done; |
1253 |
+ |
1254 |
+- sctp_for_each_transport(sctp_sock_filter, sctp_sock_dump, |
1255 |
+- net, &pos, &commp); |
1256 |
++ sctp_transport_traverse_process(sctp_sock_filter, sctp_sock_dump, |
1257 |
++ net, &pos, &commp); |
1258 |
+ cb->args[2] = pos; |
1259 |
+ |
1260 |
+ done: |
1261 |
+diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c |
1262 |
+index 3067deb0fbec1..665a22d5c725b 100644 |
1263 |
+--- a/net/sctp/endpointola.c |
1264 |
++++ b/net/sctp/endpointola.c |
1265 |
+@@ -184,6 +184,18 @@ void sctp_endpoint_free(struct sctp_endpoint *ep) |
1266 |
+ } |
1267 |
+ |
1268 |
+ /* Final destructor for endpoint. */ |
1269 |
++static void sctp_endpoint_destroy_rcu(struct rcu_head *head) |
1270 |
++{ |
1271 |
++ struct sctp_endpoint *ep = container_of(head, struct sctp_endpoint, rcu); |
1272 |
++ struct sock *sk = ep->base.sk; |
1273 |
++ |
1274 |
++ sctp_sk(sk)->ep = NULL; |
1275 |
++ sock_put(sk); |
1276 |
++ |
1277 |
++ kfree(ep); |
1278 |
++ SCTP_DBG_OBJCNT_DEC(ep); |
1279 |
++} |
1280 |
++ |
1281 |
+ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) |
1282 |
+ { |
1283 |
+ struct sock *sk; |
1284 |
+@@ -213,18 +225,13 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) |
1285 |
+ if (sctp_sk(sk)->bind_hash) |
1286 |
+ sctp_put_port(sk); |
1287 |
+ |
1288 |
+- sctp_sk(sk)->ep = NULL; |
1289 |
+- /* Give up our hold on the sock */ |
1290 |
+- sock_put(sk); |
1291 |
+- |
1292 |
+- kfree(ep); |
1293 |
+- SCTP_DBG_OBJCNT_DEC(ep); |
1294 |
++ call_rcu(&ep->rcu, sctp_endpoint_destroy_rcu); |
1295 |
+ } |
1296 |
+ |
1297 |
+ /* Hold a reference to an endpoint. */ |
1298 |
+-void sctp_endpoint_hold(struct sctp_endpoint *ep) |
1299 |
++int sctp_endpoint_hold(struct sctp_endpoint *ep) |
1300 |
+ { |
1301 |
+- refcount_inc(&ep->base.refcnt); |
1302 |
++ return refcount_inc_not_zero(&ep->base.refcnt); |
1303 |
+ } |
1304 |
+ |
1305 |
+ /* Release a reference to an endpoint and clean up if there are |
1306 |
+diff --git a/net/sctp/socket.c b/net/sctp/socket.c |
1307 |
+index 2146372adff43..565aa77fe5cbe 100644 |
1308 |
+--- a/net/sctp/socket.c |
1309 |
++++ b/net/sctp/socket.c |
1310 |
+@@ -5395,11 +5395,12 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *), |
1311 |
+ } |
1312 |
+ EXPORT_SYMBOL_GPL(sctp_transport_lookup_process); |
1313 |
+ |
1314 |
+-int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), |
1315 |
+- int (*cb_done)(struct sctp_transport *, void *), |
1316 |
+- struct net *net, int *pos, void *p) { |
1317 |
++int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done, |
1318 |
++ struct net *net, int *pos, void *p) |
1319 |
++{ |
1320 |
+ struct rhashtable_iter hti; |
1321 |
+ struct sctp_transport *tsp; |
1322 |
++ struct sctp_endpoint *ep; |
1323 |
+ int ret; |
1324 |
+ |
1325 |
+ again: |
1326 |
+@@ -5408,26 +5409,32 @@ again: |
1327 |
+ |
1328 |
+ tsp = sctp_transport_get_idx(net, &hti, *pos + 1); |
1329 |
+ for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) { |
1330 |
+- ret = cb(tsp, p); |
1331 |
+- if (ret) |
1332 |
+- break; |
1333 |
++ ep = tsp->asoc->ep; |
1334 |
++ if (sctp_endpoint_hold(ep)) { /* asoc can be peeled off */ |
1335 |
++ ret = cb(ep, tsp, p); |
1336 |
++ if (ret) |
1337 |
++ break; |
1338 |
++ sctp_endpoint_put(ep); |
1339 |
++ } |
1340 |
+ (*pos)++; |
1341 |
+ sctp_transport_put(tsp); |
1342 |
+ } |
1343 |
+ sctp_transport_walk_stop(&hti); |
1344 |
+ |
1345 |
+ if (ret) { |
1346 |
+- if (cb_done && !cb_done(tsp, p)) { |
1347 |
++ if (cb_done && !cb_done(ep, tsp, p)) { |
1348 |
+ (*pos)++; |
1349 |
++ sctp_endpoint_put(ep); |
1350 |
+ sctp_transport_put(tsp); |
1351 |
+ goto again; |
1352 |
+ } |
1353 |
++ sctp_endpoint_put(ep); |
1354 |
+ sctp_transport_put(tsp); |
1355 |
+ } |
1356 |
+ |
1357 |
+ return ret; |
1358 |
+ } |
1359 |
+-EXPORT_SYMBOL_GPL(sctp_for_each_transport); |
1360 |
++EXPORT_SYMBOL_GPL(sctp_transport_traverse_process); |
1361 |
+ |
1362 |
+ /* 7.2.1 Association Status (SCTP_STATUS) |
1363 |
+ |
1364 |
+diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl |
1365 |
+index a4ca050815aba..dc1d3696af6b8 100755 |
1366 |
+--- a/scripts/recordmcount.pl |
1367 |
++++ b/scripts/recordmcount.pl |
1368 |
+@@ -252,7 +252,7 @@ if ($arch eq "x86_64") { |
1369 |
+ |
1370 |
+ } elsif ($arch eq "s390" && $bits == 64) { |
1371 |
+ if ($cc =~ /-DCC_USING_HOTPATCH/) { |
1372 |
+- $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$"; |
1373 |
++ $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(brcl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$"; |
1374 |
+ $mcount_adjust = 0; |
1375 |
+ } else { |
1376 |
+ $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$"; |
1377 |
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
1378 |
+index 8b9cbe1e8ee22..91f2ba0b225b7 100644 |
1379 |
+--- a/security/selinux/hooks.c |
1380 |
++++ b/security/selinux/hooks.c |
1381 |
+@@ -5734,7 +5734,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, |
1382 |
+ struct common_audit_data ad; |
1383 |
+ struct lsm_network_audit net = {0,}; |
1384 |
+ char *addrp; |
1385 |
+- u8 proto; |
1386 |
++ u8 proto = 0; |
1387 |
+ |
1388 |
+ if (sk == NULL) |
1389 |
+ return NF_ACCEPT; |
1390 |
+diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c |
1391 |
+index eba0b3395851e..861fc6f4ebfb7 100644 |
1392 |
+--- a/security/tomoyo/util.c |
1393 |
++++ b/security/tomoyo/util.c |
1394 |
+@@ -1029,6 +1029,8 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) |
1395 |
+ return false; |
1396 |
+ if (!domain) |
1397 |
+ return true; |
1398 |
++ if (READ_ONCE(domain->flags[TOMOYO_DIF_QUOTA_WARNED])) |
1399 |
++ return false; |
1400 |
+ list_for_each_entry_rcu(ptr, &domain->acl_info_list, list, |
1401 |
+ srcu_read_lock_held(&tomoyo_ss)) { |
1402 |
+ u16 perm; |
1403 |
+@@ -1074,14 +1076,12 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) |
1404 |
+ if (count < tomoyo_profile(domain->ns, domain->profile)-> |
1405 |
+ pref[TOMOYO_PREF_MAX_LEARNING_ENTRY]) |
1406 |
+ return true; |
1407 |
+- if (!domain->flags[TOMOYO_DIF_QUOTA_WARNED]) { |
1408 |
+- domain->flags[TOMOYO_DIF_QUOTA_WARNED] = true; |
1409 |
+- /* r->granted = false; */ |
1410 |
+- tomoyo_write_log(r, "%s", tomoyo_dif[TOMOYO_DIF_QUOTA_WARNED]); |
1411 |
++ WRITE_ONCE(domain->flags[TOMOYO_DIF_QUOTA_WARNED], true); |
1412 |
++ /* r->granted = false; */ |
1413 |
++ tomoyo_write_log(r, "%s", tomoyo_dif[TOMOYO_DIF_QUOTA_WARNED]); |
1414 |
+ #ifndef CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING |
1415 |
+- pr_warn("WARNING: Domain '%s' has too many ACLs to hold. Stopped learning mode.\n", |
1416 |
+- domain->domainname->name); |
1417 |
++ pr_warn("WARNING: Domain '%s' has too many ACLs to hold. Stopped learning mode.\n", |
1418 |
++ domain->domainname->name); |
1419 |
+ #endif |
1420 |
+- } |
1421 |
+ return false; |
1422 |
+ } |
1423 |
+diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c |
1424 |
+index 3a169a026635d..bbf1f2d3387e3 100644 |
1425 |
+--- a/tools/perf/builtin-script.c |
1426 |
++++ b/tools/perf/builtin-script.c |
1427 |
+@@ -2308,7 +2308,7 @@ static int process_switch_event(struct perf_tool *tool, |
1428 |
+ if (perf_event__process_switch(tool, event, sample, machine) < 0) |
1429 |
+ return -1; |
1430 |
+ |
1431 |
+- if (scripting_ops && scripting_ops->process_switch) |
1432 |
++ if (scripting_ops && scripting_ops->process_switch && !filter_cpu(sample)) |
1433 |
+ scripting_ops->process_switch(event, sample, machine); |
1434 |
+ |
1435 |
+ if (!script->show_switch_events) |
1436 |
+diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c |
1437 |
+index c66da6ffd6d8d..7badaf215de28 100644 |
1438 |
+--- a/tools/testing/selftests/net/udpgso.c |
1439 |
++++ b/tools/testing/selftests/net/udpgso.c |
1440 |
+@@ -156,13 +156,13 @@ struct testcase testcases_v4[] = { |
1441 |
+ }, |
1442 |
+ { |
1443 |
+ /* send max number of min sized segments */ |
1444 |
+- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4, |
1445 |
++ .tlen = UDP_MAX_SEGMENTS, |
1446 |
+ .gso_len = 1, |
1447 |
+- .r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4, |
1448 |
++ .r_num_mss = UDP_MAX_SEGMENTS, |
1449 |
+ }, |
1450 |
+ { |
1451 |
+ /* send max number + 1 of min sized segments: fail */ |
1452 |
+- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1, |
1453 |
++ .tlen = UDP_MAX_SEGMENTS + 1, |
1454 |
+ .gso_len = 1, |
1455 |
+ .tfail = true, |
1456 |
+ }, |
1457 |
+@@ -259,13 +259,13 @@ struct testcase testcases_v6[] = { |
1458 |
+ }, |
1459 |
+ { |
1460 |
+ /* send max number of min sized segments */ |
1461 |
+- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6, |
1462 |
++ .tlen = UDP_MAX_SEGMENTS, |
1463 |
+ .gso_len = 1, |
1464 |
+- .r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6, |
1465 |
++ .r_num_mss = UDP_MAX_SEGMENTS, |
1466 |
+ }, |
1467 |
+ { |
1468 |
+ /* send max number + 1 of min sized segments: fail */ |
1469 |
+- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1, |
1470 |
++ .tlen = UDP_MAX_SEGMENTS + 1, |
1471 |
+ .gso_len = 1, |
1472 |
+ .tfail = true, |
1473 |
+ }, |
1474 |
+diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c |
1475 |
+index 17512a43885e7..f1fdaa2702913 100644 |
1476 |
+--- a/tools/testing/selftests/net/udpgso_bench_tx.c |
1477 |
++++ b/tools/testing/selftests/net/udpgso_bench_tx.c |
1478 |
+@@ -419,6 +419,7 @@ static void usage(const char *filepath) |
1479 |
+ |
1480 |
+ static void parse_opts(int argc, char **argv) |
1481 |
+ { |
1482 |
++ const char *bind_addr = NULL; |
1483 |
+ int max_len, hdrlen; |
1484 |
+ int c; |
1485 |
+ |
1486 |
+@@ -446,7 +447,7 @@ static void parse_opts(int argc, char **argv) |
1487 |
+ cfg_cpu = strtol(optarg, NULL, 0); |
1488 |
+ break; |
1489 |
+ case 'D': |
1490 |
+- setup_sockaddr(cfg_family, optarg, &cfg_dst_addr); |
1491 |
++ bind_addr = optarg; |
1492 |
+ break; |
1493 |
+ case 'l': |
1494 |
+ cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000; |
1495 |
+@@ -492,6 +493,11 @@ static void parse_opts(int argc, char **argv) |
1496 |
+ } |
1497 |
+ } |
1498 |
+ |
1499 |
++ if (!bind_addr) |
1500 |
++ bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0"; |
1501 |
++ |
1502 |
++ setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr); |
1503 |
++ |
1504 |
+ if (optind != argc) |
1505 |
+ usage(argv[0]); |
1506 |
+ |