Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Tue, 02 Nov 2021 19:36:50
Message-Id: 1635881795.001b31139e4c70e7887352c8e81d6f60c1402dfb.mpagano@gentoo
1 commit: 001b31139e4c70e7887352c8e81d6f60c1402dfb
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 2 19:36:35 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 2 19:36:35 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=001b3113
7
8 Linux patch 4.14.254
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1253_linux-4.14.254.patch | 682 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 686 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index d4ac84b..0bc848c 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1059,6 +1059,10 @@ Patch: 1252_linux-4.14.253.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.253
23
24 +Patch: 1253_linux-4.14.254.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.254
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1253_linux-4.14.254.patch b/1253_linux-4.14.254.patch
33 new file mode 100644
34 index 0000000..6fa6584
35 --- /dev/null
36 +++ b/1253_linux-4.14.254.patch
37 @@ -0,0 +1,682 @@
38 +diff --git a/Makefile b/Makefile
39 +index f4084bf887619..b684983722afb 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 253
47 ++SUBLEVEL = 254
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +diff --git a/arch/arm/Makefile b/arch/arm/Makefile
52 +index 234ee43b44384..e7455058416ef 100644
53 +--- a/arch/arm/Makefile
54 ++++ b/arch/arm/Makefile
55 +@@ -13,7 +13,7 @@
56 + # Ensure linker flags are correct
57 + LDFLAGS :=
58 +
59 +-LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer
60 ++LDFLAGS_vmlinux := --no-undefined -X --pic-veneer
61 + ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
62 + LDFLAGS_vmlinux += --be8
63 + LDFLAGS_MODULE += --be8
64 +diff --git a/arch/arm/boot/bootp/Makefile b/arch/arm/boot/bootp/Makefile
65 +index 83e1a076a5d64..981a8d03f064c 100644
66 +--- a/arch/arm/boot/bootp/Makefile
67 ++++ b/arch/arm/boot/bootp/Makefile
68 +@@ -8,7 +8,7 @@
69 +
70 + GCOV_PROFILE := n
71 +
72 +-LDFLAGS_bootp :=-p --no-undefined -X \
73 ++LDFLAGS_bootp := --no-undefined -X \
74 + --defsym initrd_phys=$(INITRD_PHYS) \
75 + --defsym params_phys=$(PARAMS_PHYS) -T
76 + AFLAGS_initrd.o :=-DINITRD=\"$(INITRD)\"
77 +diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
78 +index a61b7e4d06668..d912628e1c9f2 100644
79 +--- a/arch/arm/boot/compressed/Makefile
80 ++++ b/arch/arm/boot/compressed/Makefile
81 +@@ -129,8 +129,6 @@ endif
82 + ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
83 + LDFLAGS_vmlinux += --be8
84 + endif
85 +-# ?
86 +-LDFLAGS_vmlinux += -p
87 + # Report unresolved symbol references
88 + LDFLAGS_vmlinux += --no-undefined
89 + # Delete all temporary local symbols
90 +diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
91 +index a2ac3fe7dbf8a..944534eb0bd8b 100644
92 +--- a/arch/arm/boot/compressed/decompress.c
93 ++++ b/arch/arm/boot/compressed/decompress.c
94 +@@ -49,7 +49,10 @@ extern int memcmp(const void *cs, const void *ct, size_t count);
95 + #endif
96 +
97 + #ifdef CONFIG_KERNEL_XZ
98 ++/* Prevent KASAN override of string helpers in decompressor */
99 ++#undef memmove
100 + #define memmove memmove
101 ++#undef memcpy
102 + #define memcpy memcpy
103 + #include "../../../../lib/decompress_unxz.c"
104 + #endif
105 +diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
106 +index 60ac7c5999a98..86e54447dc916 100644
107 +--- a/arch/arm/mm/proc-macros.S
108 ++++ b/arch/arm/mm/proc-macros.S
109 +@@ -342,6 +342,7 @@ ENTRY(\name\()_cache_fns)
110 +
111 + .macro define_tlb_functions name:req, flags_up:req, flags_smp
112 + .type \name\()_tlb_fns, #object
113 ++ .align 2
114 + ENTRY(\name\()_tlb_fns)
115 + .long \name\()_flush_user_tlb_range
116 + .long \name\()_flush_kern_tlb_range
117 +diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c
118 +index 091e9a3c2dcb1..3cd2066c2ca3c 100644
119 +--- a/arch/arm/probes/kprobes/core.c
120 ++++ b/arch/arm/probes/kprobes/core.c
121 +@@ -669,7 +669,7 @@ static struct undef_hook kprobes_arm_break_hook = {
122 +
123 + #endif /* !CONFIG_THUMB2_KERNEL */
124 +
125 +-int __init arch_init_kprobes()
126 ++int __init arch_init_kprobes(void)
127 + {
128 + arm_probes_decode_init();
129 + #ifdef CONFIG_THUMB2_KERNEL
130 +diff --git a/arch/nios2/platform/Kconfig.platform b/arch/nios2/platform/Kconfig.platform
131 +index 74c1aaf588b8b..54f6dfb3b7974 100644
132 +--- a/arch/nios2/platform/Kconfig.platform
133 ++++ b/arch/nios2/platform/Kconfig.platform
134 +@@ -37,6 +37,7 @@ config NIOS2_DTB_PHYS_ADDR
135 +
136 + config NIOS2_DTB_SOURCE_BOOL
137 + bool "Compile and link device tree into kernel image"
138 ++ depends on !COMPILE_TEST
139 + default n
140 + help
141 + This allows you to specify a dts (device tree source) file
142 +diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
143 +index 28434040cfb61..b6374f6831a27 100644
144 +--- a/arch/powerpc/net/bpf_jit_comp64.c
145 ++++ b/arch/powerpc/net/bpf_jit_comp64.c
146 +@@ -426,8 +426,14 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
147 + case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */
148 + if (imm == 0)
149 + return -EINVAL;
150 +- else if (imm == 1)
151 +- goto bpf_alu32_trunc;
152 ++ if (imm == 1) {
153 ++ if (BPF_OP(code) == BPF_DIV) {
154 ++ goto bpf_alu32_trunc;
155 ++ } else {
156 ++ PPC_LI(dst_reg, 0);
157 ++ break;
158 ++ }
159 ++ }
160 +
161 + PPC_LI32(b2p[TMP_REG_1], imm);
162 + switch (BPF_CLASS(code)) {
163 +diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
164 +index 6059b030678b6..c2dc8e5cfbfc2 100644
165 +--- a/drivers/ata/sata_mv.c
166 ++++ b/drivers/ata/sata_mv.c
167 +@@ -3907,8 +3907,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
168 + break;
169 +
170 + default:
171 +- dev_err(host->dev, "BUG: invalid board index %u\n", board_idx);
172 +- return 1;
173 ++ dev_alert(host->dev, "BUG: invalid board index %u\n", board_idx);
174 ++ return -EINVAL;
175 + }
176 +
177 + hpriv->hp_flags = hp_flags;
178 +diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
179 +index b1e9aae9a5d0b..e9b7ce8c272c6 100644
180 +--- a/drivers/base/regmap/regcache-rbtree.c
181 ++++ b/drivers/base/regmap/regcache-rbtree.c
182 +@@ -295,14 +295,14 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
183 + if (!blk)
184 + return -ENOMEM;
185 +
186 ++ rbnode->block = blk;
187 ++
188 + if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
189 + present = krealloc(rbnode->cache_present,
190 + BITS_TO_LONGS(blklen) * sizeof(*present),
191 + GFP_KERNEL);
192 +- if (!present) {
193 +- kfree(blk);
194 ++ if (!present)
195 + return -ENOMEM;
196 +- }
197 +
198 + memset(present + BITS_TO_LONGS(rbnode->blklen), 0,
199 + (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen))
200 +@@ -319,7 +319,6 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
201 + }
202 +
203 + /* update the rbnode block, its size and the base register */
204 +- rbnode->block = blk;
205 + rbnode->blklen = blklen;
206 + rbnode->base_reg = base_reg;
207 + rbnode->cache_present = present;
208 +diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
209 +index a84aa3f1ae854..ae0357481041b 100644
210 +--- a/drivers/mmc/host/dw_mmc-exynos.c
211 ++++ b/drivers/mmc/host/dw_mmc-exynos.c
212 +@@ -437,6 +437,18 @@ static s8 dw_mci_exynos_get_best_clksmpl(u8 candiates)
213 + }
214 + }
215 +
216 ++ /*
217 ++ * If there is no cadiates value, then it needs to return -EIO.
218 ++ * If there are candiates values and don't find bset clk sample value,
219 ++ * then use a first candiates clock sample value.
220 ++ */
221 ++ for (i = 0; i < iter; i++) {
222 ++ __c = ror8(candiates, i);
223 ++ if ((__c & 0x1) == 0x1) {
224 ++ loc = i;
225 ++ goto out;
226 ++ }
227 ++ }
228 + out:
229 + return loc;
230 + }
231 +@@ -467,6 +479,8 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
232 + priv->tuned_sample = found;
233 + } else {
234 + ret = -EIO;
235 ++ dev_warn(&mmc->class_dev,
236 ++ "There is no candiates value about clksmpl!\n");
237 + }
238 +
239 + return ret;
240 +diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
241 +index c13a83ebec8ed..3c0e78036805e 100644
242 +--- a/drivers/mmc/host/sdhci-esdhc-imx.c
243 ++++ b/drivers/mmc/host/sdhci-esdhc-imx.c
244 +@@ -28,6 +28,7 @@
245 + #include <linux/pinctrl/consumer.h>
246 + #include <linux/platform_data/mmc-esdhc-imx.h>
247 + #include <linux/pm_runtime.h>
248 ++#include <linux/iopoll.h>
249 + #include "sdhci-pltfm.h"
250 + #include "sdhci-esdhc.h"
251 +
252 +@@ -927,6 +928,7 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
253 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
254 + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
255 + u32 ctrl;
256 ++ int ret;
257 +
258 + /* Reset the tuning circuit */
259 + if (esdhc_is_usdhc(imx_data)) {
260 +@@ -939,7 +941,22 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
261 + } else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
262 + ctrl = readl(host->ioaddr + SDHCI_AUTO_CMD_STATUS);
263 + ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
264 ++ ctrl &= ~ESDHC_MIX_CTRL_EXE_TUNE;
265 + writel(ctrl, host->ioaddr + SDHCI_AUTO_CMD_STATUS);
266 ++ /* Make sure ESDHC_MIX_CTRL_EXE_TUNE cleared */
267 ++ ret = readl_poll_timeout(host->ioaddr + SDHCI_AUTO_CMD_STATUS,
268 ++ ctrl, !(ctrl & ESDHC_MIX_CTRL_EXE_TUNE), 1, 50);
269 ++ if (ret == -ETIMEDOUT)
270 ++ dev_warn(mmc_dev(host->mmc),
271 ++ "Warning! clear execute tuning bit failed\n");
272 ++ /*
273 ++ * SDHCI_INT_DATA_AVAIL is W1C bit, set this bit will clear the
274 ++ * usdhc IP internal logic flag execute_tuning_with_clr_buf, which
275 ++ * will finally make sure the normal data transfer logic correct.
276 ++ */
277 ++ ctrl = readl(host->ioaddr + SDHCI_INT_STATUS);
278 ++ ctrl |= SDHCI_INT_DATA_AVAIL;
279 ++ writel(ctrl, host->ioaddr + SDHCI_INT_STATUS);
280 + }
281 + }
282 + }
283 +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
284 +index ee3ce0d34dfc5..6ef45f3fefa8a 100644
285 +--- a/drivers/mmc/host/sdhci.c
286 ++++ b/drivers/mmc/host/sdhci.c
287 +@@ -1500,6 +1500,12 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
288 + break;
289 + case MMC_VDD_32_33:
290 + case MMC_VDD_33_34:
291 ++ /*
292 ++ * 3.4 ~ 3.6V are valid only for those platforms where it's
293 ++ * known that the voltage range is supported by hardware.
294 ++ */
295 ++ case MMC_VDD_34_35:
296 ++ case MMC_VDD_35_36:
297 + pwr = SDHCI_POWER_330;
298 + break;
299 + default:
300 +diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
301 +index 7978ba98d0474..71e4392de25ae 100644
302 +--- a/drivers/mmc/host/vub300.c
303 ++++ b/drivers/mmc/host/vub300.c
304 +@@ -579,7 +579,7 @@ static void check_vub300_port_status(struct vub300_mmc_host *vub300)
305 + GET_SYSTEM_PORT_STATUS,
306 + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
307 + 0x0000, 0x0000, &vub300->system_port_status,
308 +- sizeof(vub300->system_port_status), HZ);
309 ++ sizeof(vub300->system_port_status), 1000);
310 + if (sizeof(vub300->system_port_status) == retval)
311 + new_system_port_status(vub300);
312 + }
313 +@@ -1242,7 +1242,7 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
314 + SET_INTERRUPT_PSEUDOCODE,
315 + USB_DIR_OUT | USB_TYPE_VENDOR |
316 + USB_RECIP_DEVICE, 0x0000, 0x0000,
317 +- xfer_buffer, xfer_length, HZ);
318 ++ xfer_buffer, xfer_length, 1000);
319 + kfree(xfer_buffer);
320 + if (retval < 0) {
321 + strncpy(vub300->vub_name,
322 +@@ -1289,7 +1289,7 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
323 + SET_TRANSFER_PSEUDOCODE,
324 + USB_DIR_OUT | USB_TYPE_VENDOR |
325 + USB_RECIP_DEVICE, 0x0000, 0x0000,
326 +- xfer_buffer, xfer_length, HZ);
327 ++ xfer_buffer, xfer_length, 1000);
328 + kfree(xfer_buffer);
329 + if (retval < 0) {
330 + strncpy(vub300->vub_name,
331 +@@ -1994,7 +1994,7 @@ static void __set_clock_speed(struct vub300_mmc_host *vub300, u8 buf[8],
332 + usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
333 + SET_CLOCK_SPEED,
334 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
335 +- 0x00, 0x00, buf, buf_array_size, HZ);
336 ++ 0x00, 0x00, buf, buf_array_size, 1000);
337 + if (retval != 8) {
338 + dev_err(&vub300->udev->dev, "SET_CLOCK_SPEED"
339 + " %dkHz failed with retval=%d\n", kHzClock, retval);
340 +@@ -2016,14 +2016,14 @@ static void vub300_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
341 + usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
342 + SET_SD_POWER,
343 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
344 +- 0x0000, 0x0000, NULL, 0, HZ);
345 ++ 0x0000, 0x0000, NULL, 0, 1000);
346 + /* must wait for the VUB300 u-proc to boot up */
347 + msleep(600);
348 + } else if ((ios->power_mode == MMC_POWER_UP) && !vub300->card_powered) {
349 + usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
350 + SET_SD_POWER,
351 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
352 +- 0x0001, 0x0000, NULL, 0, HZ);
353 ++ 0x0001, 0x0000, NULL, 0, 1000);
354 + msleep(600);
355 + vub300->card_powered = 1;
356 + } else if (ios->power_mode == MMC_POWER_ON) {
357 +@@ -2285,14 +2285,14 @@ static int vub300_probe(struct usb_interface *interface,
358 + GET_HC_INF0,
359 + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
360 + 0x0000, 0x0000, &vub300->hc_info,
361 +- sizeof(vub300->hc_info), HZ);
362 ++ sizeof(vub300->hc_info), 1000);
363 + if (retval < 0)
364 + goto error5;
365 + retval =
366 + usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
367 + SET_ROM_WAIT_STATES,
368 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
369 +- firmware_rom_wait_states, 0x0000, NULL, 0, HZ);
370 ++ firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
371 + if (retval < 0)
372 + goto error5;
373 + dev_info(&vub300->udev->dev,
374 +@@ -2307,7 +2307,7 @@ static int vub300_probe(struct usb_interface *interface,
375 + GET_SYSTEM_PORT_STATUS,
376 + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
377 + 0x0000, 0x0000, &vub300->system_port_status,
378 +- sizeof(vub300->system_port_status), HZ);
379 ++ sizeof(vub300->system_port_status), 1000);
380 + if (retval < 0) {
381 + goto error4;
382 + } else if (sizeof(vub300->system_port_status) == retval) {
383 +diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
384 +index 6bd6c261f2ba9..415ac33341c58 100644
385 +--- a/drivers/net/ethernet/nxp/lpc_eth.c
386 ++++ b/drivers/net/ethernet/nxp/lpc_eth.c
387 +@@ -1037,9 +1037,6 @@ static int lpc_eth_close(struct net_device *ndev)
388 + napi_disable(&pldat->napi);
389 + netif_stop_queue(ndev);
390 +
391 +- if (ndev->phydev)
392 +- phy_stop(ndev->phydev);
393 +-
394 + spin_lock_irqsave(&pldat->lock, flags);
395 + __lpc_eth_reset(pldat);
396 + netif_carrier_off(ndev);
397 +@@ -1047,6 +1044,8 @@ static int lpc_eth_close(struct net_device *ndev)
398 + writel(0, LPC_ENET_MAC2(pldat->net_base));
399 + spin_unlock_irqrestore(&pldat->lock, flags);
400 +
401 ++ if (ndev->phydev)
402 ++ phy_stop(ndev->phydev);
403 + clk_disable_unprepare(pldat->clk);
404 +
405 + return 0;
406 +diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
407 +index b8a38f32d27f0..5ef9bbbab3dbb 100644
408 +--- a/drivers/net/phy/mdio_bus.c
409 ++++ b/drivers/net/phy/mdio_bus.c
410 +@@ -354,7 +354,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
411 + err = device_register(&bus->dev);
412 + if (err) {
413 + pr_err("mii_bus %s failed to register\n", bus->id);
414 +- put_device(&bus->dev);
415 + return -EINVAL;
416 + }
417 +
418 +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
419 +index ff108611c5e48..1b30636c8bc73 100644
420 +--- a/drivers/net/usb/lan78xx.c
421 ++++ b/drivers/net/usb/lan78xx.c
422 +@@ -3615,6 +3615,12 @@ static int lan78xx_probe(struct usb_interface *intf,
423 +
424 + dev->maxpacket = usb_maxpacket(dev->udev, dev->pipe_out, 1);
425 +
426 ++ /* Reject broken descriptors. */
427 ++ if (dev->maxpacket == 0) {
428 ++ ret = -ENODEV;
429 ++ goto out4;
430 ++ }
431 ++
432 + /* driver requires remote-wakeup capability during autosuspend. */
433 + intf->needs_remote_wakeup = 1;
434 +
435 +diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
436 +index cb9a18eda798f..c83b6f05ff7f8 100644
437 +--- a/drivers/net/usb/usbnet.c
438 ++++ b/drivers/net/usb/usbnet.c
439 +@@ -1788,6 +1788,11 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
440 + if (!dev->rx_urb_size)
441 + dev->rx_urb_size = dev->hard_mtu;
442 + dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1);
443 ++ if (dev->maxpacket == 0) {
444 ++ /* that is a broken device */
445 ++ status = -ENODEV;
446 ++ goto out4;
447 ++ }
448 +
449 + /* let userspace know we have a random address */
450 + if (ether_addr_equal(net->dev_addr, node_id))
451 +diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c
452 +index 06bb226c62ef4..0f37acec98ab4 100644
453 +--- a/drivers/nfc/port100.c
454 ++++ b/drivers/nfc/port100.c
455 +@@ -1012,11 +1012,11 @@ static u64 port100_get_command_type_mask(struct port100 *dev)
456 +
457 + skb = port100_alloc_skb(dev, 0);
458 + if (!skb)
459 +- return -ENOMEM;
460 ++ return 0;
461 +
462 + resp = port100_send_cmd_sync(dev, PORT100_CMD_GET_COMMAND_TYPE, skb);
463 + if (IS_ERR(resp))
464 +- return PTR_ERR(resp);
465 ++ return 0;
466 +
467 + if (resp->len < 8)
468 + mask = 0;
469 +diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
470 +index ae1147b8710f3..12ecde765003f 100644
471 +--- a/net/batman-adv/bridge_loop_avoidance.c
472 ++++ b/net/batman-adv/bridge_loop_avoidance.c
473 +@@ -1574,10 +1574,14 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
474 + return 0;
475 +
476 + bat_priv->bla.claim_hash = batadv_hash_new(128);
477 +- bat_priv->bla.backbone_hash = batadv_hash_new(32);
478 ++ if (!bat_priv->bla.claim_hash)
479 ++ return -ENOMEM;
480 +
481 +- if (!bat_priv->bla.claim_hash || !bat_priv->bla.backbone_hash)
482 ++ bat_priv->bla.backbone_hash = batadv_hash_new(32);
483 ++ if (!bat_priv->bla.backbone_hash) {
484 ++ batadv_hash_destroy(bat_priv->bla.claim_hash);
485 + return -ENOMEM;
486 ++ }
487 +
488 + batadv_hash_set_lock_class(bat_priv->bla.claim_hash,
489 + &batadv_claim_hash_lock_class_key);
490 +diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
491 +index 5762e52f1d1f6..c93a75f70f015 100644
492 +--- a/net/batman-adv/main.c
493 ++++ b/net/batman-adv/main.c
494 +@@ -180,29 +180,41 @@ int batadv_mesh_init(struct net_device *soft_iface)
495 + INIT_HLIST_HEAD(&bat_priv->softif_vlan_list);
496 + INIT_HLIST_HEAD(&bat_priv->tp_list);
497 +
498 +- ret = batadv_v_mesh_init(bat_priv);
499 +- if (ret < 0)
500 +- goto err;
501 +-
502 + ret = batadv_originator_init(bat_priv);
503 +- if (ret < 0)
504 +- goto err;
505 ++ if (ret < 0) {
506 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
507 ++ goto err_orig;
508 ++ }
509 +
510 + ret = batadv_tt_init(bat_priv);
511 +- if (ret < 0)
512 +- goto err;
513 ++ if (ret < 0) {
514 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
515 ++ goto err_tt;
516 ++ }
517 ++
518 ++ ret = batadv_v_mesh_init(bat_priv);
519 ++ if (ret < 0) {
520 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
521 ++ goto err_v;
522 ++ }
523 +
524 + ret = batadv_bla_init(bat_priv);
525 +- if (ret < 0)
526 +- goto err;
527 ++ if (ret < 0) {
528 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
529 ++ goto err_bla;
530 ++ }
531 +
532 + ret = batadv_dat_init(bat_priv);
533 +- if (ret < 0)
534 +- goto err;
535 ++ if (ret < 0) {
536 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
537 ++ goto err_dat;
538 ++ }
539 +
540 + ret = batadv_nc_mesh_init(bat_priv);
541 +- if (ret < 0)
542 +- goto err;
543 ++ if (ret < 0) {
544 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
545 ++ goto err_nc;
546 ++ }
547 +
548 + batadv_gw_init(bat_priv);
549 + batadv_mcast_init(bat_priv);
550 +@@ -212,8 +224,20 @@ int batadv_mesh_init(struct net_device *soft_iface)
551 +
552 + return 0;
553 +
554 +-err:
555 +- batadv_mesh_free(soft_iface);
556 ++err_nc:
557 ++ batadv_dat_free(bat_priv);
558 ++err_dat:
559 ++ batadv_bla_free(bat_priv);
560 ++err_bla:
561 ++ batadv_v_mesh_free(bat_priv);
562 ++err_v:
563 ++ batadv_tt_free(bat_priv);
564 ++err_tt:
565 ++ batadv_originator_free(bat_priv);
566 ++err_orig:
567 ++ batadv_purge_outstanding_packets(bat_priv, NULL);
568 ++ atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
569 ++
570 + return ret;
571 + }
572 +
573 +diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
574 +index 7aacec24958eb..400e31ace4d0e 100644
575 +--- a/net/batman-adv/network-coding.c
576 ++++ b/net/batman-adv/network-coding.c
577 +@@ -165,8 +165,10 @@ int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
578 + &batadv_nc_coding_hash_lock_class_key);
579 +
580 + bat_priv->nc.decoding_hash = batadv_hash_new(128);
581 +- if (!bat_priv->nc.decoding_hash)
582 ++ if (!bat_priv->nc.decoding_hash) {
583 ++ batadv_hash_destroy(bat_priv->nc.coding_hash);
584 + goto err;
585 ++ }
586 +
587 + batadv_hash_set_lock_class(bat_priv->nc.decoding_hash,
588 + &batadv_nc_decoding_hash_lock_class_key);
589 +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
590 +index 9cef38f6cb4de..47b19ad5a02e1 100644
591 +--- a/net/batman-adv/translation-table.c
592 ++++ b/net/batman-adv/translation-table.c
593 +@@ -4373,8 +4373,10 @@ int batadv_tt_init(struct batadv_priv *bat_priv)
594 + return ret;
595 +
596 + ret = batadv_tt_global_init(bat_priv);
597 +- if (ret < 0)
598 ++ if (ret < 0) {
599 ++ batadv_tt_local_table_free(bat_priv);
600 + return ret;
601 ++ }
602 +
603 + batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1,
604 + batadv_tt_tvlv_unicast_handler_v1,
605 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
606 +index d67d424be9192..34cf572cc5dcd 100644
607 +--- a/net/ipv4/route.c
608 ++++ b/net/ipv4/route.c
609 +@@ -640,14 +640,14 @@ static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
610 + kfree_rcu(oldest, rcu);
611 + }
612 +
613 +-static inline u32 fnhe_hashfun(__be32 daddr)
614 ++static u32 fnhe_hashfun(__be32 daddr)
615 + {
616 +- static u32 fnhe_hashrnd __read_mostly;
617 +- u32 hval;
618 ++ static siphash_key_t fnhe_hash_key __read_mostly;
619 ++ u64 hval;
620 +
621 +- net_get_random_once(&fnhe_hashrnd, sizeof(fnhe_hashrnd));
622 +- hval = jhash_1word((__force u32) daddr, fnhe_hashrnd);
623 +- return hash_32(hval, FNHE_HASH_SHIFT);
624 ++ net_get_random_once(&fnhe_hash_key, sizeof(fnhe_hash_key));
625 ++ hval = siphash_1u32((__force u32)daddr, &fnhe_hash_key);
626 ++ return hash_64(hval, FNHE_HASH_SHIFT);
627 + }
628 +
629 + static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe)
630 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
631 +index e943fb28f581b..b26067798dbf1 100644
632 +--- a/net/sctp/sm_statefuns.c
633 ++++ b/net/sctp/sm_statefuns.c
634 +@@ -704,6 +704,9 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
635 + struct sock *sk;
636 + int error = 0;
637 +
638 ++ if (asoc && !sctp_vtag_verify(chunk, asoc))
639 ++ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
640 ++
641 + /* If the packet is an OOTB packet which is temporarily on the
642 + * control endpoint, respond with an ABORT.
643 + */
644 +@@ -718,7 +721,8 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
645 + * in sctp_unpack_cookie().
646 + */
647 + if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
648 +- return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
649 ++ return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
650 ++ commands);
651 +
652 + /* If the endpoint is not listening or if the number of associations
653 + * on the TCP-style socket exceed the max backlog, respond with an
654 +@@ -2080,9 +2084,11 @@ enum sctp_disposition sctp_sf_do_5_2_4_dupcook(
655 + * enough for the chunk header. Cookie length verification is
656 + * done later.
657 + */
658 +- if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
659 +- return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
660 +- commands);
661 ++ if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) {
662 ++ if (!sctp_vtag_verify(chunk, asoc))
663 ++ asoc = NULL;
664 ++ return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands);
665 ++ }
666 +
667 + /* "Decode" the chunk. We have no optional parameters so we
668 + * are in good shape.
669 +@@ -3492,6 +3498,9 @@ enum sctp_disposition sctp_sf_ootb(struct net *net,
670 +
671 + SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);
672 +
673 ++ if (asoc && !sctp_vtag_verify(chunk, asoc))
674 ++ asoc = NULL;
675 ++
676 + ch = (struct sctp_chunkhdr *)chunk->chunk_hdr;
677 + do {
678 + /* Report violation if the chunk is less then minimal */
679 +@@ -3607,12 +3616,6 @@ static enum sctp_disposition sctp_sf_shut_8_4_5(
680 +
681 + SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS);
682 +
683 +- /* If the chunk length is invalid, we don't want to process
684 +- * the reset of the packet.
685 +- */
686 +- if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
687 +- return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
688 +-
689 + /* We need to discard the rest of the packet to prevent
690 + * potential bomming attacks from additional bundled chunks.
691 + * This is documented in SCTP Threats ID.
692 +@@ -3640,6 +3643,9 @@ enum sctp_disposition sctp_sf_do_8_5_1_E_sa(struct net *net,
693 + {
694 + struct sctp_chunk *chunk = arg;
695 +
696 ++ if (!sctp_vtag_verify(chunk, asoc))
697 ++ asoc = NULL;
698 ++
699 + /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */
700 + if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
701 + return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
702 +@@ -4475,6 +4481,9 @@ enum sctp_disposition sctp_sf_violation(struct net *net,
703 + {
704 + struct sctp_chunk *chunk = arg;
705 +
706 ++ if (!sctp_vtag_verify(chunk, asoc))
707 ++ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
708 ++
709 + /* Make sure that the chunk has a valid length. */
710 + if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr)))
711 + return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
712 +@@ -6181,6 +6190,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(
713 + * yet.
714 + */
715 + switch (chunk->chunk_hdr->type) {
716 ++ case SCTP_CID_INIT:
717 + case SCTP_CID_INIT_ACK:
718 + {
719 + struct sctp_initack_chunk *initack;