Annotation of /trunk/kernel-alx-legacy/patches-4.9/0388-4.9.289-all-fixes.patch
Parent Directory | Revision Log
Revision 3690 -
(hide annotations)
(download)
Mon Oct 24 14:08:05 2022 UTC (23 months ago) by niro
File size: 17917 byte(s)
Mon Oct 24 14:08:05 2022 UTC (23 months ago) by niro
File size: 17917 byte(s)
-linux-4.9.289
1 | niro | 3690 | diff --git a/Makefile b/Makefile |
2 | index 49568e384a924..76e6507e4145f 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 9 | ||
8 | -SUBLEVEL = 288 | ||
9 | +SUBLEVEL = 289 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Roaring Lionus | ||
12 | |||
13 | diff --git a/arch/arm/Makefile b/arch/arm/Makefile | ||
14 | index 975b110e7d87a..d9a2fcd33bc60 100644 | ||
15 | --- a/arch/arm/Makefile | ||
16 | +++ b/arch/arm/Makefile | ||
17 | @@ -13,7 +13,7 @@ | ||
18 | # Ensure linker flags are correct | ||
19 | LDFLAGS := | ||
20 | |||
21 | -LDFLAGS_vmlinux :=-p --no-undefined -X --pic-veneer | ||
22 | +LDFLAGS_vmlinux := --no-undefined -X --pic-veneer | ||
23 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) | ||
24 | LDFLAGS_vmlinux += --be8 | ||
25 | LDFLAGS_MODULE += --be8 | ||
26 | diff --git a/arch/arm/boot/bootp/Makefile b/arch/arm/boot/bootp/Makefile | ||
27 | index 5e4acd253b300..8d1e31b4ba941 100644 | ||
28 | --- a/arch/arm/boot/bootp/Makefile | ||
29 | +++ b/arch/arm/boot/bootp/Makefile | ||
30 | @@ -7,7 +7,7 @@ | ||
31 | |||
32 | GCOV_PROFILE := n | ||
33 | |||
34 | -LDFLAGS_bootp :=-p --no-undefined -X \ | ||
35 | +LDFLAGS_bootp := --no-undefined -X \ | ||
36 | --defsym initrd_phys=$(INITRD_PHYS) \ | ||
37 | --defsym params_phys=$(PARAMS_PHYS) -T | ||
38 | AFLAGS_initrd.o :=-DINITRD=\"$(INITRD)\" | ||
39 | diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile | ||
40 | index 2f3ba4d9683c3..561dbc0ee2ba0 100644 | ||
41 | --- a/arch/arm/boot/compressed/Makefile | ||
42 | +++ b/arch/arm/boot/compressed/Makefile | ||
43 | @@ -128,8 +128,6 @@ endif | ||
44 | ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) | ||
45 | LDFLAGS_vmlinux += --be8 | ||
46 | endif | ||
47 | -# ? | ||
48 | -LDFLAGS_vmlinux += -p | ||
49 | # Report unresolved symbol references | ||
50 | LDFLAGS_vmlinux += --no-undefined | ||
51 | # Delete all temporary local symbols | ||
52 | diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c | ||
53 | index a0765e7ed6c7d..b0255cbf3b766 100644 | ||
54 | --- a/arch/arm/boot/compressed/decompress.c | ||
55 | +++ b/arch/arm/boot/compressed/decompress.c | ||
56 | @@ -46,7 +46,10 @@ extern char * strstr(const char * s1, const char *s2); | ||
57 | #endif | ||
58 | |||
59 | #ifdef CONFIG_KERNEL_XZ | ||
60 | +/* Prevent KASAN override of string helpers in decompressor */ | ||
61 | +#undef memmove | ||
62 | #define memmove memmove | ||
63 | +#undef memcpy | ||
64 | #define memcpy memcpy | ||
65 | #include "../../../../lib/decompress_unxz.c" | ||
66 | #endif | ||
67 | diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S | ||
68 | index 796e8f675a936..422162f1b9802 100644 | ||
69 | --- a/arch/arm/mm/proc-macros.S | ||
70 | +++ b/arch/arm/mm/proc-macros.S | ||
71 | @@ -343,6 +343,7 @@ ENTRY(\name\()_cache_fns) | ||
72 | |||
73 | .macro define_tlb_functions name:req, flags_up:req, flags_smp | ||
74 | .type \name\()_tlb_fns, #object | ||
75 | + .align 2 | ||
76 | ENTRY(\name\()_tlb_fns) | ||
77 | .long \name\()_flush_user_tlb_range | ||
78 | .long \name\()_flush_kern_tlb_range | ||
79 | diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c | ||
80 | index c3362ddd6c4cb..bc7a5dbaf423f 100644 | ||
81 | --- a/arch/arm/probes/kprobes/core.c | ||
82 | +++ b/arch/arm/probes/kprobes/core.c | ||
83 | @@ -666,7 +666,7 @@ static struct undef_hook kprobes_arm_break_hook = { | ||
84 | |||
85 | #endif /* !CONFIG_THUMB2_KERNEL */ | ||
86 | |||
87 | -int __init arch_init_kprobes() | ||
88 | +int __init arch_init_kprobes(void) | ||
89 | { | ||
90 | arm_probes_decode_init(); | ||
91 | #ifdef CONFIG_THUMB2_KERNEL | ||
92 | diff --git a/arch/nios2/platform/Kconfig.platform b/arch/nios2/platform/Kconfig.platform | ||
93 | index d3e5df9fb36bd..78ffc0bf4ebed 100644 | ||
94 | --- a/arch/nios2/platform/Kconfig.platform | ||
95 | +++ b/arch/nios2/platform/Kconfig.platform | ||
96 | @@ -37,6 +37,7 @@ config NIOS2_DTB_PHYS_ADDR | ||
97 | |||
98 | config NIOS2_DTB_SOURCE_BOOL | ||
99 | bool "Compile and link device tree into kernel image" | ||
100 | + depends on !COMPILE_TEST | ||
101 | default n | ||
102 | help | ||
103 | This allows you to specify a dts (device tree source) file | ||
104 | diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c | ||
105 | index 888ee95340da2..e08e55cd98e6f 100644 | ||
106 | --- a/arch/powerpc/net/bpf_jit_comp64.c | ||
107 | +++ b/arch/powerpc/net/bpf_jit_comp64.c | ||
108 | @@ -430,8 +430,14 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, | ||
109 | case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */ | ||
110 | if (imm == 0) | ||
111 | return -EINVAL; | ||
112 | - else if (imm == 1) | ||
113 | - goto bpf_alu32_trunc; | ||
114 | + if (imm == 1) { | ||
115 | + if (BPF_OP(code) == BPF_DIV) { | ||
116 | + goto bpf_alu32_trunc; | ||
117 | + } else { | ||
118 | + PPC_LI(dst_reg, 0); | ||
119 | + break; | ||
120 | + } | ||
121 | + } | ||
122 | |||
123 | PPC_LI32(b2p[TMP_REG_1], imm); | ||
124 | switch (BPF_CLASS(code)) { | ||
125 | diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c | ||
126 | index ded3a66049d2c..6007ebb80f886 100644 | ||
127 | --- a/drivers/ata/sata_mv.c | ||
128 | +++ b/drivers/ata/sata_mv.c | ||
129 | @@ -3907,8 +3907,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | ||
130 | break; | ||
131 | |||
132 | default: | ||
133 | - dev_err(host->dev, "BUG: invalid board index %u\n", board_idx); | ||
134 | - return 1; | ||
135 | + dev_alert(host->dev, "BUG: invalid board index %u\n", board_idx); | ||
136 | + return -EINVAL; | ||
137 | } | ||
138 | |||
139 | hpriv->hp_flags = hp_flags; | ||
140 | diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c | ||
141 | index b11af3f2c1dbf..c0fdbb3927586 100644 | ||
142 | --- a/drivers/base/regmap/regcache-rbtree.c | ||
143 | +++ b/drivers/base/regmap/regcache-rbtree.c | ||
144 | @@ -296,14 +296,14 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, | ||
145 | if (!blk) | ||
146 | return -ENOMEM; | ||
147 | |||
148 | + rbnode->block = blk; | ||
149 | + | ||
150 | if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) { | ||
151 | present = krealloc(rbnode->cache_present, | ||
152 | BITS_TO_LONGS(blklen) * sizeof(*present), | ||
153 | GFP_KERNEL); | ||
154 | - if (!present) { | ||
155 | - kfree(blk); | ||
156 | + if (!present) | ||
157 | return -ENOMEM; | ||
158 | - } | ||
159 | |||
160 | memset(present + BITS_TO_LONGS(rbnode->blklen), 0, | ||
161 | (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen)) | ||
162 | @@ -320,7 +320,6 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, | ||
163 | } | ||
164 | |||
165 | /* update the rbnode block, its size and the base register */ | ||
166 | - rbnode->block = blk; | ||
167 | rbnode->blklen = blklen; | ||
168 | rbnode->base_reg = base_reg; | ||
169 | rbnode->cache_present = present; | ||
170 | diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c | ||
171 | index 7ab3d749b5aee..48aed0dc84a58 100644 | ||
172 | --- a/drivers/mmc/host/dw_mmc-exynos.c | ||
173 | +++ b/drivers/mmc/host/dw_mmc-exynos.c | ||
174 | @@ -440,6 +440,18 @@ static s8 dw_mci_exynos_get_best_clksmpl(u8 candiates) | ||
175 | } | ||
176 | } | ||
177 | |||
178 | + /* | ||
179 | + * If there is no cadiates value, then it needs to return -EIO. | ||
180 | + * If there are candiates values and don't find bset clk sample value, | ||
181 | + * then use a first candiates clock sample value. | ||
182 | + */ | ||
183 | + for (i = 0; i < iter; i++) { | ||
184 | + __c = ror8(candiates, i); | ||
185 | + if ((__c & 0x1) == 0x1) { | ||
186 | + loc = i; | ||
187 | + goto out; | ||
188 | + } | ||
189 | + } | ||
190 | out: | ||
191 | return loc; | ||
192 | } | ||
193 | @@ -470,6 +482,8 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode) | ||
194 | priv->tuned_sample = found; | ||
195 | } else { | ||
196 | ret = -EIO; | ||
197 | + dev_warn(&mmc->class_dev, | ||
198 | + "There is no candiates value about clksmpl!\n"); | ||
199 | } | ||
200 | |||
201 | return ret; | ||
202 | diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c | ||
203 | index 0325083b10493..560b2996911ac 100644 | ||
204 | --- a/drivers/mmc/host/sdhci.c | ||
205 | +++ b/drivers/mmc/host/sdhci.c | ||
206 | @@ -1421,6 +1421,12 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, | ||
207 | break; | ||
208 | case MMC_VDD_32_33: | ||
209 | case MMC_VDD_33_34: | ||
210 | + /* | ||
211 | + * 3.4 ~ 3.6V are valid only for those platforms where it's | ||
212 | + * known that the voltage range is supported by hardware. | ||
213 | + */ | ||
214 | + case MMC_VDD_34_35: | ||
215 | + case MMC_VDD_35_36: | ||
216 | pwr = SDHCI_POWER_330; | ||
217 | break; | ||
218 | default: | ||
219 | diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c | ||
220 | index a3e4288e5391b..875e438ab9738 100644 | ||
221 | --- a/drivers/mmc/host/vub300.c | ||
222 | +++ b/drivers/mmc/host/vub300.c | ||
223 | @@ -579,7 +579,7 @@ static void check_vub300_port_status(struct vub300_mmc_host *vub300) | ||
224 | GET_SYSTEM_PORT_STATUS, | ||
225 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
226 | 0x0000, 0x0000, &vub300->system_port_status, | ||
227 | - sizeof(vub300->system_port_status), HZ); | ||
228 | + sizeof(vub300->system_port_status), 1000); | ||
229 | if (sizeof(vub300->system_port_status) == retval) | ||
230 | new_system_port_status(vub300); | ||
231 | } | ||
232 | @@ -1245,7 +1245,7 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300, | ||
233 | SET_INTERRUPT_PSEUDOCODE, | ||
234 | USB_DIR_OUT | USB_TYPE_VENDOR | | ||
235 | USB_RECIP_DEVICE, 0x0000, 0x0000, | ||
236 | - xfer_buffer, xfer_length, HZ); | ||
237 | + xfer_buffer, xfer_length, 1000); | ||
238 | kfree(xfer_buffer); | ||
239 | if (retval < 0) { | ||
240 | strncpy(vub300->vub_name, | ||
241 | @@ -1292,7 +1292,7 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300, | ||
242 | SET_TRANSFER_PSEUDOCODE, | ||
243 | USB_DIR_OUT | USB_TYPE_VENDOR | | ||
244 | USB_RECIP_DEVICE, 0x0000, 0x0000, | ||
245 | - xfer_buffer, xfer_length, HZ); | ||
246 | + xfer_buffer, xfer_length, 1000); | ||
247 | kfree(xfer_buffer); | ||
248 | if (retval < 0) { | ||
249 | strncpy(vub300->vub_name, | ||
250 | @@ -1998,7 +1998,7 @@ static void __set_clock_speed(struct vub300_mmc_host *vub300, u8 buf[8], | ||
251 | usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), | ||
252 | SET_CLOCK_SPEED, | ||
253 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
254 | - 0x00, 0x00, buf, buf_array_size, HZ); | ||
255 | + 0x00, 0x00, buf, buf_array_size, 1000); | ||
256 | if (retval != 8) { | ||
257 | dev_err(&vub300->udev->dev, "SET_CLOCK_SPEED" | ||
258 | " %dkHz failed with retval=%d\n", kHzClock, retval); | ||
259 | @@ -2020,14 +2020,14 @@ static void vub300_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | ||
260 | usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), | ||
261 | SET_SD_POWER, | ||
262 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
263 | - 0x0000, 0x0000, NULL, 0, HZ); | ||
264 | + 0x0000, 0x0000, NULL, 0, 1000); | ||
265 | /* must wait for the VUB300 u-proc to boot up */ | ||
266 | msleep(600); | ||
267 | } else if ((ios->power_mode == MMC_POWER_UP) && !vub300->card_powered) { | ||
268 | usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), | ||
269 | SET_SD_POWER, | ||
270 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
271 | - 0x0001, 0x0000, NULL, 0, HZ); | ||
272 | + 0x0001, 0x0000, NULL, 0, 1000); | ||
273 | msleep(600); | ||
274 | vub300->card_powered = 1; | ||
275 | } else if (ios->power_mode == MMC_POWER_ON) { | ||
276 | @@ -2288,14 +2288,14 @@ static int vub300_probe(struct usb_interface *interface, | ||
277 | GET_HC_INF0, | ||
278 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
279 | 0x0000, 0x0000, &vub300->hc_info, | ||
280 | - sizeof(vub300->hc_info), HZ); | ||
281 | + sizeof(vub300->hc_info), 1000); | ||
282 | if (retval < 0) | ||
283 | goto error5; | ||
284 | retval = | ||
285 | usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), | ||
286 | SET_ROM_WAIT_STATES, | ||
287 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
288 | - firmware_rom_wait_states, 0x0000, NULL, 0, HZ); | ||
289 | + firmware_rom_wait_states, 0x0000, NULL, 0, 1000); | ||
290 | if (retval < 0) | ||
291 | goto error5; | ||
292 | dev_info(&vub300->udev->dev, | ||
293 | @@ -2310,7 +2310,7 @@ static int vub300_probe(struct usb_interface *interface, | ||
294 | GET_SYSTEM_PORT_STATUS, | ||
295 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
296 | 0x0000, 0x0000, &vub300->system_port_status, | ||
297 | - sizeof(vub300->system_port_status), HZ); | ||
298 | + sizeof(vub300->system_port_status), 1000); | ||
299 | if (retval < 0) { | ||
300 | goto error4; | ||
301 | } else if (sizeof(vub300->system_port_status) == retval) { | ||
302 | diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c | ||
303 | index 9b98ec3dcb82e..ad7b9772a4b27 100644 | ||
304 | --- a/drivers/net/ethernet/nxp/lpc_eth.c | ||
305 | +++ b/drivers/net/ethernet/nxp/lpc_eth.c | ||
306 | @@ -1039,9 +1039,6 @@ static int lpc_eth_close(struct net_device *ndev) | ||
307 | napi_disable(&pldat->napi); | ||
308 | netif_stop_queue(ndev); | ||
309 | |||
310 | - if (ndev->phydev) | ||
311 | - phy_stop(ndev->phydev); | ||
312 | - | ||
313 | spin_lock_irqsave(&pldat->lock, flags); | ||
314 | __lpc_eth_reset(pldat); | ||
315 | netif_carrier_off(ndev); | ||
316 | @@ -1049,6 +1046,8 @@ static int lpc_eth_close(struct net_device *ndev) | ||
317 | writel(0, LPC_ENET_MAC2(pldat->net_base)); | ||
318 | spin_unlock_irqrestore(&pldat->lock, flags); | ||
319 | |||
320 | + if (ndev->phydev) | ||
321 | + phy_stop(ndev->phydev); | ||
322 | clk_disable_unprepare(pldat->clk); | ||
323 | |||
324 | return 0; | ||
325 | diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c | ||
326 | index 73f97d00ede79..92fb664b56fbb 100644 | ||
327 | --- a/drivers/net/phy/mdio_bus.c | ||
328 | +++ b/drivers/net/phy/mdio_bus.c | ||
329 | @@ -326,7 +326,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) | ||
330 | err = device_register(&bus->dev); | ||
331 | if (err) { | ||
332 | pr_err("mii_bus %s failed to register\n", bus->id); | ||
333 | - put_device(&bus->dev); | ||
334 | return -EINVAL; | ||
335 | } | ||
336 | |||
337 | diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c | ||
338 | index bca6237597233..bce898ad6e96f 100644 | ||
339 | --- a/drivers/net/usb/lan78xx.c | ||
340 | +++ b/drivers/net/usb/lan78xx.c | ||
341 | @@ -3370,6 +3370,12 @@ static int lan78xx_probe(struct usb_interface *intf, | ||
342 | |||
343 | dev->maxpacket = usb_maxpacket(dev->udev, dev->pipe_out, 1); | ||
344 | |||
345 | + /* Reject broken descriptors. */ | ||
346 | + if (dev->maxpacket == 0) { | ||
347 | + ret = -ENODEV; | ||
348 | + goto out3; | ||
349 | + } | ||
350 | + | ||
351 | /* driver requires remote-wakeup capability during autosuspend. */ | ||
352 | intf->needs_remote_wakeup = 1; | ||
353 | |||
354 | diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c | ||
355 | index 0b5fd1499ac06..6a004742ec71a 100644 | ||
356 | --- a/drivers/net/usb/usbnet.c | ||
357 | +++ b/drivers/net/usb/usbnet.c | ||
358 | @@ -1740,6 +1740,11 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | ||
359 | if (!dev->rx_urb_size) | ||
360 | dev->rx_urb_size = dev->hard_mtu; | ||
361 | dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); | ||
362 | + if (dev->maxpacket == 0) { | ||
363 | + /* that is a broken device */ | ||
364 | + status = -ENODEV; | ||
365 | + goto out4; | ||
366 | + } | ||
367 | |||
368 | /* let userspace know we have a random address */ | ||
369 | if (ether_addr_equal(net->dev_addr, node_id)) | ||
370 | diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c | ||
371 | index 151b220381f95..ed65993aae96a 100644 | ||
372 | --- a/drivers/nfc/port100.c | ||
373 | +++ b/drivers/nfc/port100.c | ||
374 | @@ -1011,11 +1011,11 @@ static u64 port100_get_command_type_mask(struct port100 *dev) | ||
375 | |||
376 | skb = port100_alloc_skb(dev, 0); | ||
377 | if (!skb) | ||
378 | - return -ENOMEM; | ||
379 | + return 0; | ||
380 | |||
381 | resp = port100_send_cmd_sync(dev, PORT100_CMD_GET_COMMAND_TYPE, skb); | ||
382 | if (IS_ERR(resp)) | ||
383 | - return PTR_ERR(resp); | ||
384 | + return 0; | ||
385 | |||
386 | if (resp->len < 8) | ||
387 | mask = 0; | ||
388 | diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c | ||
389 | index 516c45771d59b..dc635bd935846 100644 | ||
390 | --- a/net/batman-adv/bridge_loop_avoidance.c | ||
391 | +++ b/net/batman-adv/bridge_loop_avoidance.c | ||
392 | @@ -1569,10 +1569,14 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | ||
393 | return 0; | ||
394 | |||
395 | bat_priv->bla.claim_hash = batadv_hash_new(128); | ||
396 | - bat_priv->bla.backbone_hash = batadv_hash_new(32); | ||
397 | + if (!bat_priv->bla.claim_hash) | ||
398 | + return -ENOMEM; | ||
399 | |||
400 | - if (!bat_priv->bla.claim_hash || !bat_priv->bla.backbone_hash) | ||
401 | + bat_priv->bla.backbone_hash = batadv_hash_new(32); | ||
402 | + if (!bat_priv->bla.backbone_hash) { | ||
403 | + batadv_hash_destroy(bat_priv->bla.claim_hash); | ||
404 | return -ENOMEM; | ||
405 | + } | ||
406 | |||
407 | batadv_hash_set_lock_class(bat_priv->bla.claim_hash, | ||
408 | &batadv_claim_hash_lock_class_key); | ||
409 | diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c | ||
410 | index 2c017ab47557b..96b6ab9681cd9 100644 | ||
411 | --- a/net/batman-adv/main.c | ||
412 | +++ b/net/batman-adv/main.c | ||
413 | @@ -177,29 +177,41 @@ int batadv_mesh_init(struct net_device *soft_iface) | ||
414 | INIT_HLIST_HEAD(&bat_priv->softif_vlan_list); | ||
415 | INIT_HLIST_HEAD(&bat_priv->tp_list); | ||
416 | |||
417 | - ret = batadv_v_mesh_init(bat_priv); | ||
418 | - if (ret < 0) | ||
419 | - goto err; | ||
420 | - | ||
421 | ret = batadv_originator_init(bat_priv); | ||
422 | - if (ret < 0) | ||
423 | - goto err; | ||
424 | + if (ret < 0) { | ||
425 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); | ||
426 | + goto err_orig; | ||
427 | + } | ||
428 | |||
429 | ret = batadv_tt_init(bat_priv); | ||
430 | - if (ret < 0) | ||
431 | - goto err; | ||
432 | + if (ret < 0) { | ||
433 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); | ||
434 | + goto err_tt; | ||
435 | + } | ||
436 | + | ||
437 | + ret = batadv_v_mesh_init(bat_priv); | ||
438 | + if (ret < 0) { | ||
439 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); | ||
440 | + goto err_v; | ||
441 | + } | ||
442 | |||
443 | ret = batadv_bla_init(bat_priv); | ||
444 | - if (ret < 0) | ||
445 | - goto err; | ||
446 | + if (ret < 0) { | ||
447 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); | ||
448 | + goto err_bla; | ||
449 | + } | ||
450 | |||
451 | ret = batadv_dat_init(bat_priv); | ||
452 | - if (ret < 0) | ||
453 | - goto err; | ||
454 | + if (ret < 0) { | ||
455 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); | ||
456 | + goto err_dat; | ||
457 | + } | ||
458 | |||
459 | ret = batadv_nc_mesh_init(bat_priv); | ||
460 | - if (ret < 0) | ||
461 | - goto err; | ||
462 | + if (ret < 0) { | ||
463 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING); | ||
464 | + goto err_nc; | ||
465 | + } | ||
466 | |||
467 | batadv_gw_init(bat_priv); | ||
468 | batadv_mcast_init(bat_priv); | ||
469 | @@ -209,8 +221,20 @@ int batadv_mesh_init(struct net_device *soft_iface) | ||
470 | |||
471 | return 0; | ||
472 | |||
473 | -err: | ||
474 | - batadv_mesh_free(soft_iface); | ||
475 | +err_nc: | ||
476 | + batadv_dat_free(bat_priv); | ||
477 | +err_dat: | ||
478 | + batadv_bla_free(bat_priv); | ||
479 | +err_bla: | ||
480 | + batadv_v_mesh_free(bat_priv); | ||
481 | +err_v: | ||
482 | + batadv_tt_free(bat_priv); | ||
483 | +err_tt: | ||
484 | + batadv_originator_free(bat_priv); | ||
485 | +err_orig: | ||
486 | + batadv_purge_outstanding_packets(bat_priv, NULL); | ||
487 | + atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); | ||
488 | + | ||
489 | return ret; | ||
490 | } | ||
491 | |||
492 | diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c | ||
493 | index 09549885cd147..b0a85bd72afca 100644 | ||
494 | --- a/net/batman-adv/network-coding.c | ||
495 | +++ b/net/batman-adv/network-coding.c | ||
496 | @@ -166,8 +166,10 @@ int batadv_nc_mesh_init(struct batadv_priv *bat_priv) | ||
497 | &batadv_nc_coding_hash_lock_class_key); | ||
498 | |||
499 | bat_priv->nc.decoding_hash = batadv_hash_new(128); | ||
500 | - if (!bat_priv->nc.decoding_hash) | ||
501 | + if (!bat_priv->nc.decoding_hash) { | ||
502 | + batadv_hash_destroy(bat_priv->nc.coding_hash); | ||
503 | goto err; | ||
504 | + } | ||
505 | |||
506 | batadv_hash_set_lock_class(bat_priv->nc.decoding_hash, | ||
507 | &batadv_nc_decoding_hash_lock_class_key); | ||
508 | diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c | ||
509 | index 607d8bac83760..6e9844e73bac3 100644 | ||
510 | --- a/net/batman-adv/translation-table.c | ||
511 | +++ b/net/batman-adv/translation-table.c | ||
512 | @@ -4373,8 +4373,10 @@ int batadv_tt_init(struct batadv_priv *bat_priv) | ||
513 | return ret; | ||
514 | |||
515 | ret = batadv_tt_global_init(bat_priv); | ||
516 | - if (ret < 0) | ||
517 | + if (ret < 0) { | ||
518 | + batadv_tt_local_table_free(bat_priv); | ||
519 | return ret; | ||
520 | + } | ||
521 | |||
522 | batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, | ||
523 | batadv_tt_tvlv_unicast_handler_v1, | ||
524 | diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c | ||
525 | index 9045f6bcb34c4..f71991520ad69 100644 | ||
526 | --- a/net/sctp/sm_statefuns.c | ||
527 | +++ b/net/sctp/sm_statefuns.c | ||
528 | @@ -4333,6 +4333,9 @@ sctp_disposition_t sctp_sf_violation(struct net *net, | ||
529 | { | ||
530 | struct sctp_chunk *chunk = arg; | ||
531 | |||
532 | + if (!sctp_vtag_verify(chunk, asoc)) | ||
533 | + return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | ||
534 | + | ||
535 | /* Make sure that the chunk has a valid length. */ | ||
536 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | ||
537 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | ||
538 | @@ -6018,6 +6021,7 @@ static struct sctp_packet *sctp_ootb_pkt_new(struct net *net, | ||
539 | * yet. | ||
540 | */ | ||
541 | switch (chunk->chunk_hdr->type) { | ||
542 | + case SCTP_CID_INIT: | ||
543 | case SCTP_CID_INIT_ACK: | ||
544 | { | ||
545 | sctp_initack_chunk_t *initack; |