Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Wed, 05 Jan 2022 12:55:28
Message-Id: 1641387312.4f588a1e14e02fad34135c810254cf54ecce1690.mpagano@gentoo
1 commit: 4f588a1e14e02fad34135c810254cf54ecce1690
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 5 12:55:12 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 5 12:55:12 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4f588a1e
7
8 Linux patch 4.19.224
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1223_linux-4.19.224.patch | 1307 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1311 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index ed044b8e..f8c41458 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -931,6 +931,10 @@ Patch: 1222_linux-4.19.223.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.223
23
24 +Patch: 1223_linux-4.19.224.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.224
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/1223_linux-4.19.224.patch b/1223_linux-4.19.224.patch
33 new file mode 100644
34 index 00000000..3027aed9
35 --- /dev/null
36 +++ b/1223_linux-4.19.224.patch
37 @@ -0,0 +1,1307 @@
38 +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
39 +index 607db9519cfbd..0ee49b4929be2 100644
40 +--- a/Documentation/admin-guide/kernel-parameters.txt
41 ++++ b/Documentation/admin-guide/kernel-parameters.txt
42 +@@ -1439,6 +1439,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 6637882cb5e54..cfcecc33b4c1f 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,7 +1,7 @@
56 + # SPDX-License-Identifier: GPL-2.0
57 + VERSION = 4
58 + PATCHLEVEL = 19
59 +-SUBLEVEL = 223
60 ++SUBLEVEL = 224
61 + EXTRAVERSION =
62 + NAME = "People's Front"
63 +
64 +diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
65 +index 3371b986e3b40..cd845afc48809 100644
66 +--- a/drivers/android/binder_alloc.c
67 ++++ b/drivers/android/binder_alloc.c
68 +@@ -630,7 +630,7 @@ static void binder_free_buf_locked(struct binder_alloc *alloc,
69 + BUG_ON(buffer->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 98e91e14cefd3..88bb59ba58cd2 100644
79 +--- a/drivers/hid/Kconfig
80 ++++ b/drivers/hid/Kconfig
81 +@@ -148,6 +148,7 @@ config HID_APPLEIR
82 +
83 + config HID_ASUS
84 + tristate "Asus"
85 ++ depends on USB_HID
86 + depends on LEDS_CLASS
87 + ---help---
88 + Support for Asus notebook built-in keyboard and touchpad via i2c, and
89 +diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
90 +index 57aece8098416..140dd074fdee5 100644
91 +--- a/drivers/i2c/i2c-dev.c
92 ++++ b/drivers/i2c/i2c-dev.c
93 +@@ -544,6 +544,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 ffb9c1f495b6c..197e0b5d5a80a 100644
105 +--- a/drivers/input/joystick/spaceball.c
106 ++++ b/drivers/input/joystick/spaceball.c
107 +@@ -31,6 +31,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 +@@ -87,9 +88,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 f1e66e257cff7..e305a4f2b0f04 100644
135 +--- a/drivers/input/mouse/appletouch.c
136 ++++ b/drivers/input/mouse/appletouch.c
137 +@@ -930,6 +930,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 +@@ -937,8 +939,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 c218e107c0c8f..ee0b0a7237ad8 100644
157 +--- a/drivers/input/serio/i8042-x86ia64io.h
158 ++++ b/drivers/input/serio/i8042-x86ia64io.h
159 +@@ -999,6 +999,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 +@@ -1318,6 +1336,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 c60593c8d2be5..082afbf088d67 100644
196 +--- a/drivers/input/serio/i8042.c
197 ++++ b/drivers/input/serio/i8042.c
198 +@@ -48,6 +48,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 +@@ -702,7 +706,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 +@@ -731,10 +735,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 +@@ -761,7 +765,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 +@@ -789,7 +793,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 +@@ -996,7 +1000,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 +@@ -1311,7 +1315,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 +@@ -1339,7 +1343,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 +@@ -1376,13 +1380,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 +@@ -1392,7 +1396,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 +@@ -1444,7 +1448,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 +@@ -1486,7 +1490,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 +@@ -1536,7 +1540,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 +@@ -1601,6 +1605,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 +@@ -1611,7 +1616,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 +@@ -1627,17 +1631,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/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
437 +index 9003702892cda..5979fcf124bb4 100644
438 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
439 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
440 +@@ -3666,12 +3666,11 @@ static int set_feature_arfs(struct net_device *netdev, bool enable)
441 +
442 + static int mlx5e_handle_feature(struct net_device *netdev,
443 + netdev_features_t *features,
444 +- netdev_features_t wanted_features,
445 + netdev_features_t feature,
446 + mlx5e_feature_handler feature_handler)
447 + {
448 +- netdev_features_t changes = wanted_features ^ netdev->features;
449 +- bool enable = !!(wanted_features & feature);
450 ++ netdev_features_t changes = *features ^ netdev->features;
451 ++ bool enable = !!(*features & feature);
452 + int err;
453 +
454 + if (!(changes & feature))
455 +@@ -3679,23 +3678,23 @@ static int mlx5e_handle_feature(struct net_device *netdev,
456 +
457 + err = feature_handler(netdev, enable);
458 + if (err) {
459 ++ MLX5E_SET_FEATURE(features, feature, !enable);
460 + netdev_err(netdev, "%s feature %pNF failed, err %d\n",
461 + enable ? "Enable" : "Disable", &feature, err);
462 + return err;
463 + }
464 +
465 +- MLX5E_SET_FEATURE(features, feature, enable);
466 + return 0;
467 + }
468 +
469 + static int mlx5e_set_features(struct net_device *netdev,
470 + netdev_features_t features)
471 + {
472 +- netdev_features_t oper_features = netdev->features;
473 ++ netdev_features_t oper_features = features;
474 + int err = 0;
475 +
476 + #define MLX5E_HANDLE_FEATURE(feature, handler) \
477 +- mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
478 ++ mlx5e_handle_feature(netdev, &oper_features, feature, handler)
479 +
480 + err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
481 + err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
482 +diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
483 +index 9f1777e56d7db..881468ff02bfa 100644
484 +--- a/drivers/net/usb/pegasus.c
485 ++++ b/drivers/net/usb/pegasus.c
486 +@@ -498,11 +498,11 @@ static void read_bulk_callback(struct urb *urb)
487 + goto goon;
488 +
489 + rx_status = buf[count - 2];
490 +- if (rx_status & 0x1e) {
491 ++ if (rx_status & 0x1c) {
492 + netif_dbg(pegasus, rx_err, net,
493 + "RX packet error %x\n", rx_status);
494 + net->stats.rx_errors++;
495 +- if (rx_status & 0x06) /* long or runt */
496 ++ if (rx_status & 0x04) /* runt */
497 + net->stats.rx_length_errors++;
498 + if (rx_status & 0x08)
499 + net->stats.rx_crc_errors++;
500 +diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
501 +index 1b347096422ff..ebea3b4dd8e1b 100644
502 +--- a/drivers/nfc/st21nfca/i2c.c
503 ++++ b/drivers/nfc/st21nfca/i2c.c
504 +@@ -544,7 +544,8 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
505 + phy->gpiod_ena = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
506 + if (IS_ERR(phy->gpiod_ena)) {
507 + nfc_err(dev, "Unable to get ENABLE GPIO\n");
508 +- return PTR_ERR(phy->gpiod_ena);
509 ++ r = PTR_ERR(phy->gpiod_ena);
510 ++ goto out_free;
511 + }
512 +
513 + phy->se_status.is_ese_present =
514 +@@ -555,7 +556,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
515 + r = st21nfca_hci_platform_init(phy);
516 + if (r < 0) {
517 + nfc_err(&client->dev, "Unable to reboot st21nfca\n");
518 +- return r;
519 ++ goto out_free;
520 + }
521 +
522 + r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
523 +@@ -564,15 +565,23 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
524 + ST21NFCA_HCI_DRIVER_NAME, phy);
525 + if (r < 0) {
526 + nfc_err(&client->dev, "Unable to register IRQ handler\n");
527 +- return r;
528 ++ goto out_free;
529 + }
530 +
531 +- return st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME,
532 +- ST21NFCA_FRAME_HEADROOM,
533 +- ST21NFCA_FRAME_TAILROOM,
534 +- ST21NFCA_HCI_LLC_MAX_PAYLOAD,
535 +- &phy->hdev,
536 +- &phy->se_status);
537 ++ r = st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME,
538 ++ ST21NFCA_FRAME_HEADROOM,
539 ++ ST21NFCA_FRAME_TAILROOM,
540 ++ ST21NFCA_HCI_LLC_MAX_PAYLOAD,
541 ++ &phy->hdev,
542 ++ &phy->se_status);
543 ++ if (r)
544 ++ goto out_free;
545 ++
546 ++ return 0;
547 ++
548 ++out_free:
549 ++ kfree_skb(phy->pending_skb);
550 ++ return r;
551 + }
552 +
553 + static int st21nfca_hci_i2c_remove(struct i2c_client *client)
554 +@@ -585,6 +594,8 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client)
555 +
556 + if (phy->powered)
557 + st21nfca_hci_i2c_disable(phy);
558 ++ if (phy->pending_skb)
559 ++ kfree_skb(phy->pending_skb);
560 +
561 + return 0;
562 + }
563 +diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
564 +index fd2ffebc868fc..caa03565c139b 100644
565 +--- a/drivers/platform/x86/apple-gmux.c
566 ++++ b/drivers/platform/x86/apple-gmux.c
567 +@@ -628,7 +628,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
568 + }
569 +
570 + gmux_data->iostart = res->start;
571 +- gmux_data->iolen = res->end - res->start;
572 ++ gmux_data->iolen = resource_size(res);
573 +
574 + if (gmux_data->iolen < GMUX_MIN_IO_LEN) {
575 + pr_err("gmux I/O region too small (%lu < %u)\n",
576 +diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
577 +index 2c70e311943ac..0a908d1cc494a 100644
578 +--- a/drivers/scsi/lpfc/lpfc_debugfs.c
579 ++++ b/drivers/scsi/lpfc/lpfc_debugfs.c
580 +@@ -2267,8 +2267,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
581 + char mybuf[64];
582 + char *pbuf;
583 +
584 +- if (nbytes > 64)
585 +- nbytes = 64;
586 ++ if (nbytes > 63)
587 ++ nbytes = 63;
588 +
589 + memset(mybuf, 0, sizeof(mybuf));
590 +
591 +diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
592 +index 2c707b5c7b0b7..68b5177bf09d6 100644
593 +--- a/drivers/scsi/vmw_pvscsi.c
594 ++++ b/drivers/scsi/vmw_pvscsi.c
595 +@@ -578,9 +578,12 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
596 + * Commands like INQUIRY may transfer less data than
597 + * requested by the initiator via bufflen. Set residual
598 + * count to make upper layer aware of the actual amount
599 +- * of data returned.
600 ++ * of data returned. There are cases when controller
601 ++ * returns zero dataLen with non zero data - do not set
602 ++ * residual count in that case.
603 + */
604 +- scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
605 ++ if (e->dataLen && (e->dataLen < scsi_bufflen(cmd)))
606 ++ scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
607 + cmd->result = (DID_OK << 16);
608 + break;
609 +
610 +diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
611 +index 0b9ab1d0dd45d..5fd5aa5f0a1d1 100644
612 +--- a/drivers/tee/tee_shm.c
613 ++++ b/drivers/tee/tee_shm.c
614 +@@ -1,5 +1,5 @@
615 + /*
616 +- * Copyright (c) 2015-2016, Linaro Limited
617 ++ * Copyright (c) 2015-2017, 2019-2021 Linaro Limited
618 + *
619 + * This software is licensed under the terms of the GNU General Public
620 + * License version 2, as published by the Free Software Foundation, and
621 +@@ -11,25 +11,17 @@
622 + * GNU General Public License for more details.
623 + *
624 + */
625 ++#include <linux/anon_inodes.h>
626 + #include <linux/device.h>
627 +-#include <linux/dma-buf.h>
628 +-#include <linux/fdtable.h>
629 + #include <linux/idr.h>
630 ++#include <linux/mm.h>
631 + #include <linux/sched.h>
632 + #include <linux/slab.h>
633 + #include <linux/tee_drv.h>
634 + #include "tee_private.h"
635 +
636 +-static void tee_shm_release(struct tee_shm *shm)
637 ++static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
638 + {
639 +- struct tee_device *teedev = shm->teedev;
640 +-
641 +- mutex_lock(&teedev->mutex);
642 +- idr_remove(&teedev->idr, shm->id);
643 +- if (shm->ctx)
644 +- list_del(&shm->link);
645 +- mutex_unlock(&teedev->mutex);
646 +-
647 + if (shm->flags & TEE_SHM_POOL) {
648 + struct tee_shm_pool_mgr *poolm;
649 +
650 +@@ -61,51 +53,6 @@ static void tee_shm_release(struct tee_shm *shm)
651 + tee_device_put(teedev);
652 + }
653 +
654 +-static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment
655 +- *attach, enum dma_data_direction dir)
656 +-{
657 +- return NULL;
658 +-}
659 +-
660 +-static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach,
661 +- struct sg_table *table,
662 +- enum dma_data_direction dir)
663 +-{
664 +-}
665 +-
666 +-static void tee_shm_op_release(struct dma_buf *dmabuf)
667 +-{
668 +- struct tee_shm *shm = dmabuf->priv;
669 +-
670 +- tee_shm_release(shm);
671 +-}
672 +-
673 +-static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum)
674 +-{
675 +- return NULL;
676 +-}
677 +-
678 +-static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
679 +-{
680 +- struct tee_shm *shm = dmabuf->priv;
681 +- size_t size = vma->vm_end - vma->vm_start;
682 +-
683 +- /* Refuse sharing shared memory provided by application */
684 +- if (shm->flags & TEE_SHM_REGISTER)
685 +- return -EINVAL;
686 +-
687 +- return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
688 +- size, vma->vm_page_prot);
689 +-}
690 +-
691 +-static const struct dma_buf_ops tee_shm_dma_buf_ops = {
692 +- .map_dma_buf = tee_shm_op_map_dma_buf,
693 +- .unmap_dma_buf = tee_shm_op_unmap_dma_buf,
694 +- .release = tee_shm_op_release,
695 +- .map = tee_shm_op_map,
696 +- .mmap = tee_shm_op_mmap,
697 +-};
698 +-
699 + static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
700 + struct tee_device *teedev,
701 + size_t size, u32 flags)
702 +@@ -146,6 +93,7 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
703 + goto err_dev_put;
704 + }
705 +
706 ++ refcount_set(&shm->refcount, 1);
707 + shm->flags = flags | TEE_SHM_POOL;
708 + shm->teedev = teedev;
709 + shm->ctx = ctx;
710 +@@ -168,21 +116,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
711 + goto err_pool_free;
712 + }
713 +
714 +- if (flags & TEE_SHM_DMA_BUF) {
715 +- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
716 +-
717 +- exp_info.ops = &tee_shm_dma_buf_ops;
718 +- exp_info.size = shm->size;
719 +- exp_info.flags = O_RDWR;
720 +- exp_info.priv = shm;
721 +-
722 +- shm->dmabuf = dma_buf_export(&exp_info);
723 +- if (IS_ERR(shm->dmabuf)) {
724 +- ret = ERR_CAST(shm->dmabuf);
725 +- goto err_rem;
726 +- }
727 +- }
728 +-
729 + if (ctx) {
730 + teedev_ctx_get(ctx);
731 + mutex_lock(&teedev->mutex);
732 +@@ -191,10 +124,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
733 + }
734 +
735 + return shm;
736 +-err_rem:
737 +- mutex_lock(&teedev->mutex);
738 +- idr_remove(&teedev->idr, shm->id);
739 +- mutex_unlock(&teedev->mutex);
740 + err_pool_free:
741 + poolm->ops->free(poolm, shm);
742 + err_kfree:
743 +@@ -259,6 +188,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
744 + goto err;
745 + }
746 +
747 ++ refcount_set(&shm->refcount, 1);
748 + shm->flags = flags | TEE_SHM_REGISTER;
749 + shm->teedev = teedev;
750 + shm->ctx = ctx;
751 +@@ -299,22 +229,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
752 + goto err;
753 + }
754 +
755 +- if (flags & TEE_SHM_DMA_BUF) {
756 +- DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
757 +-
758 +- exp_info.ops = &tee_shm_dma_buf_ops;
759 +- exp_info.size = shm->size;
760 +- exp_info.flags = O_RDWR;
761 +- exp_info.priv = shm;
762 +-
763 +- shm->dmabuf = dma_buf_export(&exp_info);
764 +- if (IS_ERR(shm->dmabuf)) {
765 +- ret = ERR_CAST(shm->dmabuf);
766 +- teedev->desc->ops->shm_unregister(ctx, shm);
767 +- goto err;
768 +- }
769 +- }
770 +-
771 + mutex_lock(&teedev->mutex);
772 + list_add_tail(&shm->link, &ctx->list_shm);
773 + mutex_unlock(&teedev->mutex);
774 +@@ -342,6 +256,35 @@ err:
775 + }
776 + EXPORT_SYMBOL_GPL(tee_shm_register);
777 +
778 ++static int tee_shm_fop_release(struct inode *inode, struct file *filp)
779 ++{
780 ++ tee_shm_put(filp->private_data);
781 ++ return 0;
782 ++}
783 ++
784 ++static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
785 ++{
786 ++ struct tee_shm *shm = filp->private_data;
787 ++ size_t size = vma->vm_end - vma->vm_start;
788 ++
789 ++ /* Refuse sharing shared memory provided by application */
790 ++ if (shm->flags & TEE_SHM_USER_MAPPED)
791 ++ return -EINVAL;
792 ++
793 ++ /* check for overflowing the buffer's size */
794 ++ if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
795 ++ return -EINVAL;
796 ++
797 ++ return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
798 ++ size, vma->vm_page_prot);
799 ++}
800 ++
801 ++static const struct file_operations tee_shm_fops = {
802 ++ .owner = THIS_MODULE,
803 ++ .release = tee_shm_fop_release,
804 ++ .mmap = tee_shm_fop_mmap,
805 ++};
806 ++
807 + /**
808 + * tee_shm_get_fd() - Increase reference count and return file descriptor
809 + * @shm: Shared memory handle
810 +@@ -354,10 +297,11 @@ int tee_shm_get_fd(struct tee_shm *shm)
811 + if (!(shm->flags & TEE_SHM_DMA_BUF))
812 + return -EINVAL;
813 +
814 +- get_dma_buf(shm->dmabuf);
815 +- fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC);
816 ++ /* matched by tee_shm_put() in tee_shm_op_release() */
817 ++ refcount_inc(&shm->refcount);
818 ++ fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR);
819 + if (fd < 0)
820 +- dma_buf_put(shm->dmabuf);
821 ++ tee_shm_put(shm);
822 + return fd;
823 + }
824 +
825 +@@ -367,17 +311,7 @@ int tee_shm_get_fd(struct tee_shm *shm)
826 + */
827 + void tee_shm_free(struct tee_shm *shm)
828 + {
829 +- /*
830 +- * dma_buf_put() decreases the dmabuf reference counter and will
831 +- * call tee_shm_release() when the last reference is gone.
832 +- *
833 +- * In the case of driver private memory we call tee_shm_release
834 +- * directly instead as it doesn't have a reference counter.
835 +- */
836 +- if (shm->flags & TEE_SHM_DMA_BUF)
837 +- dma_buf_put(shm->dmabuf);
838 +- else
839 +- tee_shm_release(shm);
840 ++ tee_shm_put(shm);
841 + }
842 + EXPORT_SYMBOL_GPL(tee_shm_free);
843 +
844 +@@ -484,10 +418,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id)
845 + teedev = ctx->teedev;
846 + mutex_lock(&teedev->mutex);
847 + shm = idr_find(&teedev->idr, id);
848 ++ /*
849 ++ * If the tee_shm was found in the IDR it must have a refcount
850 ++ * larger than 0 due to the guarantee in tee_shm_put() below. So
851 ++ * it's safe to use refcount_inc().
852 ++ */
853 + if (!shm || shm->ctx != ctx)
854 + shm = ERR_PTR(-EINVAL);
855 +- else if (shm->flags & TEE_SHM_DMA_BUF)
856 +- get_dma_buf(shm->dmabuf);
857 ++ else
858 ++ refcount_inc(&shm->refcount);
859 + mutex_unlock(&teedev->mutex);
860 + return shm;
861 + }
862 +@@ -499,7 +438,25 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id);
863 + */
864 + void tee_shm_put(struct tee_shm *shm)
865 + {
866 +- if (shm->flags & TEE_SHM_DMA_BUF)
867 +- dma_buf_put(shm->dmabuf);
868 ++ struct tee_device *teedev = shm->teedev;
869 ++ bool do_release = false;
870 ++
871 ++ mutex_lock(&teedev->mutex);
872 ++ if (refcount_dec_and_test(&shm->refcount)) {
873 ++ /*
874 ++ * refcount has reached 0, we must now remove it from the
875 ++ * IDR before releasing the mutex. This will guarantee that
876 ++ * the refcount_inc() in tee_shm_get_from_id() never starts
877 ++ * from 0.
878 ++ */
879 ++ idr_remove(&teedev->idr, shm->id);
880 ++ if (shm->ctx)
881 ++ list_del(&shm->link);
882 ++ do_release = true;
883 ++ }
884 ++ mutex_unlock(&teedev->mutex);
885 ++
886 ++ if (do_release)
887 ++ tee_shm_release(teedev, shm);
888 + }
889 + EXPORT_SYMBOL_GPL(tee_shm_put);
890 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
891 +index e6805492409f6..f070082124742 100644
892 +--- a/drivers/usb/gadget/function/f_fs.c
893 ++++ b/drivers/usb/gadget/function/f_fs.c
894 +@@ -1698,11 +1698,15 @@ static void ffs_data_clear(struct ffs_data *ffs)
895 +
896 + BUG_ON(ffs->gadget);
897 +
898 +- if (ffs->epfiles)
899 ++ if (ffs->epfiles) {
900 + ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
901 ++ ffs->epfiles = NULL;
902 ++ }
903 +
904 +- if (ffs->ffs_eventfd)
905 ++ if (ffs->ffs_eventfd) {
906 + eventfd_ctx_put(ffs->ffs_eventfd);
907 ++ ffs->ffs_eventfd = NULL;
908 ++ }
909 +
910 + kfree(ffs->raw_descs_data);
911 + kfree(ffs->raw_strings);
912 +@@ -1715,7 +1719,6 @@ static void ffs_data_reset(struct ffs_data *ffs)
913 +
914 + ffs_data_clear(ffs);
915 +
916 +- ffs->epfiles = NULL;
917 + ffs->raw_descs_data = NULL;
918 + ffs->raw_descs = NULL;
919 + ffs->raw_strings = NULL;
920 +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
921 +index d707993ac9215..e6bbb91955546 100644
922 +--- a/drivers/usb/host/xhci-pci.c
923 ++++ b/drivers/usb/host/xhci-pci.c
924 +@@ -90,7 +90,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
925 + /* Look for vendor-specific quirks */
926 + if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
927 + (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK ||
928 +- pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 ||
929 + pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) {
930 + if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK &&
931 + pdev->revision == 0x0) {
932 +@@ -125,6 +124,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
933 + pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)
934 + xhci->quirks |= XHCI_BROKEN_STREAMS;
935 +
936 ++ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
937 ++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100)
938 ++ xhci->quirks |= XHCI_TRUST_TX_LENGTH;
939 ++
940 + if (pdev->vendor == PCI_VENDOR_ID_NEC)
941 + xhci->quirks |= XHCI_NEC_HOST;
942 +
943 +diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c
944 +index 270721cf229f7..07a6ee8db6123 100644
945 +--- a/drivers/usb/mtu3/mtu3_gadget.c
946 ++++ b/drivers/usb/mtu3/mtu3_gadget.c
947 +@@ -97,6 +97,13 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
948 + interval = clamp_val(interval, 1, 16) - 1;
949 + mult = usb_endpoint_maxp_mult(desc) - 1;
950 + }
951 ++ break;
952 ++ case USB_SPEED_FULL:
953 ++ if (usb_endpoint_xfer_isoc(desc))
954 ++ interval = clamp_val(desc->bInterval, 1, 16);
955 ++ else if (usb_endpoint_xfer_int(desc))
956 ++ interval = clamp_val(desc->bInterval, 1, 255);
957 ++
958 + break;
959 + default:
960 + break; /*others are ignored */
961 +diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
962 +index a2b3dfcee0b55..535f2ecf3c160 100644
963 +--- a/include/linux/tee_drv.h
964 ++++ b/include/linux/tee_drv.h
965 +@@ -177,7 +177,7 @@ void tee_device_unregister(struct tee_device *teedev);
966 + * @offset: offset of buffer in user space
967 + * @pages: locked pages from userspace
968 + * @num_pages: number of locked pages
969 +- * @dmabuf: dmabuf used to for exporting to user space
970 ++ * @refcount: reference counter
971 + * @flags: defined by TEE_SHM_* in tee_drv.h
972 + * @id: unique id of a shared memory object on this device
973 + *
974 +@@ -194,7 +194,7 @@ struct tee_shm {
975 + unsigned int offset;
976 + struct page **pages;
977 + size_t num_pages;
978 +- struct dma_buf *dmabuf;
979 ++ refcount_t refcount;
980 + u32 flags;
981 + int id;
982 + };
983 +diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
984 +index 2c6570e6fcfec..903b2ddde1b43 100644
985 +--- a/include/net/sctp/sctp.h
986 ++++ b/include/net/sctp/sctp.h
987 +@@ -118,6 +118,7 @@ extern struct percpu_counter sctp_sockets_allocated;
988 + int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
989 + struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *);
990 +
991 ++typedef int (*sctp_callback_t)(struct sctp_endpoint *, struct sctp_transport *, void *);
992 + void sctp_transport_walk_start(struct rhashtable_iter *iter);
993 + void sctp_transport_walk_stop(struct rhashtable_iter *iter);
994 + struct sctp_transport *sctp_transport_get_next(struct net *net,
995 +@@ -128,9 +129,8 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
996 + struct net *net,
997 + const union sctp_addr *laddr,
998 + const union sctp_addr *paddr, void *p);
999 +-int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
1000 +- int (*cb_done)(struct sctp_transport *, void *),
1001 +- struct net *net, int *pos, void *p);
1002 ++int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
1003 ++ struct net *net, int *pos, void *p);
1004 + int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p);
1005 + int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
1006 + struct sctp_info *info);
1007 +diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
1008 +index 2882bc7a5b4b8..18f9924aa2507 100644
1009 +--- a/include/net/sctp/structs.h
1010 ++++ b/include/net/sctp/structs.h
1011 +@@ -1348,6 +1348,7 @@ struct sctp_endpoint {
1012 +
1013 + u32 secid;
1014 + u32 peer_secid;
1015 ++ struct rcu_head rcu;
1016 + };
1017 +
1018 + /* Recover the outter endpoint structure. */
1019 +@@ -1363,7 +1364,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
1020 + struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
1021 + void sctp_endpoint_free(struct sctp_endpoint *);
1022 + void sctp_endpoint_put(struct sctp_endpoint *);
1023 +-void sctp_endpoint_hold(struct sctp_endpoint *);
1024 ++int sctp_endpoint_hold(struct sctp_endpoint *ep);
1025 + void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *);
1026 + struct sctp_association *sctp_endpoint_lookup_assoc(
1027 + const struct sctp_endpoint *ep,
1028 +diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
1029 +index f6e3c8c9c7449..4fa4e979e948a 100644
1030 +--- a/include/uapi/linux/nfc.h
1031 ++++ b/include/uapi/linux/nfc.h
1032 +@@ -263,7 +263,7 @@ enum nfc_sdp_attr {
1033 + #define NFC_SE_ENABLED 0x1
1034 +
1035 + struct sockaddr_nfc {
1036 +- sa_family_t sa_family;
1037 ++ __kernel_sa_family_t sa_family;
1038 + __u32 dev_idx;
1039 + __u32 target_idx;
1040 + __u32 nfc_protocol;
1041 +@@ -271,14 +271,14 @@ struct sockaddr_nfc {
1042 +
1043 + #define NFC_LLCP_MAX_SERVICE_NAME 63
1044 + struct sockaddr_nfc_llcp {
1045 +- sa_family_t sa_family;
1046 ++ __kernel_sa_family_t sa_family;
1047 + __u32 dev_idx;
1048 + __u32 target_idx;
1049 + __u32 nfc_protocol;
1050 + __u8 dsap; /* Destination SAP, if known */
1051 + __u8 ssap; /* Source SAP to be bound to */
1052 + char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
1053 +- size_t service_name_len;
1054 ++ __kernel_size_t service_name_len;
1055 + };
1056 +
1057 + /* NFC socket protocols */
1058 +diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
1059 +index bbf3b3daa9994..713eea9affaad 100644
1060 +--- a/net/ipv4/af_inet.c
1061 ++++ b/net/ipv4/af_inet.c
1062 +@@ -1955,6 +1955,10 @@ static int __init inet_init(void)
1063 +
1064 + ip_init();
1065 +
1066 ++ /* Initialise per-cpu ipv4 mibs */
1067 ++ if (init_ipv4_mibs())
1068 ++ panic("%s: Cannot init ipv4 mibs\n", __func__);
1069 ++
1070 + /* Setup TCP slab cache for open requests. */
1071 + tcp_init();
1072 +
1073 +@@ -1983,12 +1987,6 @@ static int __init inet_init(void)
1074 +
1075 + if (init_inet_pernet_ops())
1076 + pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
1077 +- /*
1078 +- * Initialise per-cpu ipv4 mibs
1079 +- */
1080 +-
1081 +- if (init_ipv4_mibs())
1082 +- pr_crit("%s: Cannot init ipv4 mibs\n", __func__);
1083 +
1084 + ipv4_proc_init();
1085 +
1086 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
1087 +index 0198910c2bf27..7d3caafdf2059 100644
1088 +--- a/net/ipv6/udp.c
1089 ++++ b/net/ipv6/udp.c
1090 +@@ -1069,7 +1069,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
1091 + kfree_skb(skb);
1092 + return -EINVAL;
1093 + }
1094 +- if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
1095 ++ if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) {
1096 + kfree_skb(skb);
1097 + return -EINVAL;
1098 + }
1099 +diff --git a/net/sctp/diag.c b/net/sctp/diag.c
1100 +index 8767405de9fa4..0a9db0a7f4234 100644
1101 +--- a/net/sctp/diag.c
1102 ++++ b/net/sctp/diag.c
1103 +@@ -307,9 +307,8 @@ out:
1104 + return err;
1105 + }
1106 +
1107 +-static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
1108 ++static int sctp_sock_dump(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p)
1109 + {
1110 +- struct sctp_endpoint *ep = tsp->asoc->ep;
1111 + struct sctp_comm_param *commp = p;
1112 + struct sock *sk = ep->base.sk;
1113 + struct sk_buff *skb = commp->skb;
1114 +@@ -319,6 +318,8 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
1115 + int err = 0;
1116 +
1117 + lock_sock(sk);
1118 ++ if (ep != tsp->asoc->ep)
1119 ++ goto release;
1120 + list_for_each_entry(assoc, &ep->asocs, asocs) {
1121 + if (cb->args[4] < cb->args[1])
1122 + goto next;
1123 +@@ -361,9 +362,8 @@ release:
1124 + return err;
1125 + }
1126 +
1127 +-static int sctp_sock_filter(struct sctp_transport *tsp, void *p)
1128 ++static int sctp_sock_filter(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p)
1129 + {
1130 +- struct sctp_endpoint *ep = tsp->asoc->ep;
1131 + struct sctp_comm_param *commp = p;
1132 + struct sock *sk = ep->base.sk;
1133 + const struct inet_diag_req_v2 *r = commp->r;
1134 +@@ -521,8 +521,8 @@ skip:
1135 + if (!(idiag_states & ~(TCPF_LISTEN | TCPF_CLOSE)))
1136 + goto done;
1137 +
1138 +- sctp_for_each_transport(sctp_sock_filter, sctp_sock_dump,
1139 +- net, &pos, &commp);
1140 ++ sctp_transport_traverse_process(sctp_sock_filter, sctp_sock_dump,
1141 ++ net, &pos, &commp);
1142 + cb->args[2] = pos;
1143 +
1144 + done:
1145 +diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
1146 +index 8640dedcf64f1..c4068451b9c76 100644
1147 +--- a/net/sctp/endpointola.c
1148 ++++ b/net/sctp/endpointola.c
1149 +@@ -242,6 +242,18 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
1150 + }
1151 +
1152 + /* Final destructor for endpoint. */
1153 ++static void sctp_endpoint_destroy_rcu(struct rcu_head *head)
1154 ++{
1155 ++ struct sctp_endpoint *ep = container_of(head, struct sctp_endpoint, rcu);
1156 ++ struct sock *sk = ep->base.sk;
1157 ++
1158 ++ sctp_sk(sk)->ep = NULL;
1159 ++ sock_put(sk);
1160 ++
1161 ++ kfree(ep);
1162 ++ SCTP_DBG_OBJCNT_DEC(ep);
1163 ++}
1164 ++
1165 + static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
1166 + {
1167 + struct sock *sk;
1168 +@@ -275,18 +287,13 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
1169 + if (sctp_sk(sk)->bind_hash)
1170 + sctp_put_port(sk);
1171 +
1172 +- sctp_sk(sk)->ep = NULL;
1173 +- /* Give up our hold on the sock */
1174 +- sock_put(sk);
1175 +-
1176 +- kfree(ep);
1177 +- SCTP_DBG_OBJCNT_DEC(ep);
1178 ++ call_rcu(&ep->rcu, sctp_endpoint_destroy_rcu);
1179 + }
1180 +
1181 + /* Hold a reference to an endpoint. */
1182 +-void sctp_endpoint_hold(struct sctp_endpoint *ep)
1183 ++int sctp_endpoint_hold(struct sctp_endpoint *ep)
1184 + {
1185 +- refcount_inc(&ep->base.refcnt);
1186 ++ return refcount_inc_not_zero(&ep->base.refcnt);
1187 + }
1188 +
1189 + /* Release a reference to an endpoint and clean up if there are
1190 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
1191 +index 1148f66917079..d429d59228041 100644
1192 +--- a/net/sctp/socket.c
1193 ++++ b/net/sctp/socket.c
1194 +@@ -5056,11 +5056,12 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
1195 + }
1196 + EXPORT_SYMBOL_GPL(sctp_transport_lookup_process);
1197 +
1198 +-int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
1199 +- int (*cb_done)(struct sctp_transport *, void *),
1200 +- struct net *net, int *pos, void *p) {
1201 ++int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
1202 ++ struct net *net, int *pos, void *p)
1203 ++{
1204 + struct rhashtable_iter hti;
1205 + struct sctp_transport *tsp;
1206 ++ struct sctp_endpoint *ep;
1207 + int ret;
1208 +
1209 + again:
1210 +@@ -5069,26 +5070,32 @@ again:
1211 +
1212 + tsp = sctp_transport_get_idx(net, &hti, *pos + 1);
1213 + for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) {
1214 +- ret = cb(tsp, p);
1215 +- if (ret)
1216 +- break;
1217 ++ ep = tsp->asoc->ep;
1218 ++ if (sctp_endpoint_hold(ep)) { /* asoc can be peeled off */
1219 ++ ret = cb(ep, tsp, p);
1220 ++ if (ret)
1221 ++ break;
1222 ++ sctp_endpoint_put(ep);
1223 ++ }
1224 + (*pos)++;
1225 + sctp_transport_put(tsp);
1226 + }
1227 + sctp_transport_walk_stop(&hti);
1228 +
1229 + if (ret) {
1230 +- if (cb_done && !cb_done(tsp, p)) {
1231 ++ if (cb_done && !cb_done(ep, tsp, p)) {
1232 + (*pos)++;
1233 ++ sctp_endpoint_put(ep);
1234 + sctp_transport_put(tsp);
1235 + goto again;
1236 + }
1237 ++ sctp_endpoint_put(ep);
1238 + sctp_transport_put(tsp);
1239 + }
1240 +
1241 + return ret;
1242 + }
1243 +-EXPORT_SYMBOL_GPL(sctp_for_each_transport);
1244 ++EXPORT_SYMBOL_GPL(sctp_transport_traverse_process);
1245 +
1246 + /* 7.2.1 Association Status (SCTP_STATUS)
1247 +
1248 +diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
1249 +index d8cbbedef3161..ac2f9e511fc3a 100755
1250 +--- a/scripts/recordmcount.pl
1251 ++++ b/scripts/recordmcount.pl
1252 +@@ -252,7 +252,7 @@ if ($arch eq "x86_64") {
1253 +
1254 + } elsif ($arch eq "s390" && $bits == 64) {
1255 + if ($cc =~ /-DCC_USING_HOTPATCH/) {
1256 +- $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
1257 ++ $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(brcl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
1258 + $mcount_adjust = 0;
1259 + } else {
1260 + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$";
1261 +diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
1262 +index 89dfdbb131291..41e24df986eb4 100644
1263 +--- a/security/selinux/hooks.c
1264 ++++ b/security/selinux/hooks.c
1265 +@@ -5808,7 +5808,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
1266 + struct common_audit_data ad;
1267 + struct lsm_network_audit net = {0,};
1268 + char *addrp;
1269 +- u8 proto;
1270 ++ u8 proto = 0;
1271 +
1272 + if (sk == NULL)
1273 + return NF_ACCEPT;
1274 +diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c
1275 +index 270c17ab071e4..23177b6436067 100644
1276 +--- a/tools/testing/selftests/net/udpgso.c
1277 ++++ b/tools/testing/selftests/net/udpgso.c
1278 +@@ -157,13 +157,13 @@ struct testcase testcases_v4[] = {
1279 + },
1280 + {
1281 + /* send max number of min sized segments */
1282 +- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
1283 ++ .tlen = UDP_MAX_SEGMENTS,
1284 + .gso_len = 1,
1285 +- .r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
1286 ++ .r_num_mss = UDP_MAX_SEGMENTS,
1287 + },
1288 + {
1289 + /* send max number + 1 of min sized segments: fail */
1290 +- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1,
1291 ++ .tlen = UDP_MAX_SEGMENTS + 1,
1292 + .gso_len = 1,
1293 + .tfail = true,
1294 + },
1295 +@@ -260,13 +260,13 @@ struct testcase testcases_v6[] = {
1296 + },
1297 + {
1298 + /* send max number of min sized segments */
1299 +- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
1300 ++ .tlen = UDP_MAX_SEGMENTS,
1301 + .gso_len = 1,
1302 +- .r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
1303 ++ .r_num_mss = UDP_MAX_SEGMENTS,
1304 + },
1305 + {
1306 + /* send max number + 1 of min sized segments: fail */
1307 +- .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1,
1308 ++ .tlen = UDP_MAX_SEGMENTS + 1,
1309 + .gso_len = 1,
1310 + .tfail = true,
1311 + },
1312 +diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
1313 +index e821564053cfb..463a2cbd0261a 100644
1314 +--- a/tools/testing/selftests/net/udpgso_bench_tx.c
1315 ++++ b/tools/testing/selftests/net/udpgso_bench_tx.c
1316 +@@ -247,6 +247,7 @@ static void usage(const char *filepath)
1317 +
1318 + static void parse_opts(int argc, char **argv)
1319 + {
1320 ++ const char *bind_addr = NULL;
1321 + int max_len, hdrlen;
1322 + int c;
1323 +
1324 +@@ -271,7 +272,7 @@ static void parse_opts(int argc, char **argv)
1325 + cfg_cpu = strtol(optarg, NULL, 0);
1326 + break;
1327 + case 'D':
1328 +- setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
1329 ++ bind_addr = optarg;
1330 + break;
1331 + case 'l':
1332 + cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
1333 +@@ -300,6 +301,11 @@ static void parse_opts(int argc, char **argv)
1334 + }
1335 + }
1336 +
1337 ++ if (!bind_addr)
1338 ++ bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
1339 ++
1340 ++ setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr);
1341 ++
1342 + if (optind != argc)
1343 + usage(argv[0]);
1344 +