Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Wed, 19 Sep 2018 22:38:40
Message-Id: 1537396703.afb98793078913ec641b5fd45d722a0757116f4f.mpagano@gentoo
1 commit: afb98793078913ec641b5fd45d722a0757116f4f
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 19 22:38:23 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 19 22:38:23 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=afb98793
7
8 Linux patch 4.9.127
9
10 0000_README | 4 +
11 1127_linux-4.9.128.patch | 1886 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1890 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index ad1fe4a..582011b 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -551,6 +551,10 @@ Patch: 1126_linux-4.9.127.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.127
21
22 +Patch: 1127_linux-4.9.128.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.128
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1127_linux-4.9.128.patch b/1127_linux-4.9.128.patch
31 new file mode 100644
32 index 0000000..a7af6c8
33 --- /dev/null
34 +++ b/1127_linux-4.9.128.patch
35 @@ -0,0 +1,1886 @@
36 +diff --git a/Makefile b/Makefile
37 +index 4e37716ae395..1892bdb6a760 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 9
43 +-SUBLEVEL = 127
44 ++SUBLEVEL = 128
45 + EXTRAVERSION =
46 + NAME = Roaring Lionus
47 +
48 +diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
49 +index 5367fe36b69d..dd623199bb48 100644
50 +--- a/arch/arc/configs/axs101_defconfig
51 ++++ b/arch/arc/configs/axs101_defconfig
52 +@@ -1,5 +1,4 @@
53 + CONFIG_DEFAULT_HOSTNAME="ARCLinux"
54 +-# CONFIG_SWAP is not set
55 + CONFIG_SYSVIPC=y
56 + CONFIG_POSIX_MQUEUE=y
57 + # CONFIG_CROSS_MEMORY_ATTACH is not set
58 +diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
59 +index d40fad485982..2e0d7d74b8ee 100644
60 +--- a/arch/arc/configs/axs103_defconfig
61 ++++ b/arch/arc/configs/axs103_defconfig
62 +@@ -1,5 +1,4 @@
63 + CONFIG_DEFAULT_HOSTNAME="ARCLinux"
64 +-# CONFIG_SWAP is not set
65 + CONFIG_SYSVIPC=y
66 + CONFIG_POSIX_MQUEUE=y
67 + # CONFIG_CROSS_MEMORY_ATTACH is not set
68 +diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
69 +index 06cbd27ef860..ec188fca2cc9 100644
70 +--- a/arch/arc/configs/axs103_smp_defconfig
71 ++++ b/arch/arc/configs/axs103_smp_defconfig
72 +@@ -1,5 +1,4 @@
73 + CONFIG_DEFAULT_HOSTNAME="ARCLinux"
74 +-# CONFIG_SWAP is not set
75 + CONFIG_SYSVIPC=y
76 + CONFIG_POSIX_MQUEUE=y
77 + # CONFIG_CROSS_MEMORY_ATTACH is not set
78 +diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
79 +index 37a932d9148c..1ba6bcf98570 100644
80 +--- a/arch/mips/cavium-octeon/octeon-platform.c
81 ++++ b/arch/mips/cavium-octeon/octeon-platform.c
82 +@@ -366,6 +366,7 @@ static int __init octeon_ehci_device_init(void)
83 + return 0;
84 +
85 + pd = of_find_device_by_node(ehci_node);
86 ++ of_node_put(ehci_node);
87 + if (!pd)
88 + return 0;
89 +
90 +@@ -428,6 +429,7 @@ static int __init octeon_ohci_device_init(void)
91 + return 0;
92 +
93 + pd = of_find_device_by_node(ohci_node);
94 ++ of_node_put(ohci_node);
95 + if (!pd)
96 + return 0;
97 +
98 +diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
99 +index d493ccbf274a..cf5b56492d8e 100644
100 +--- a/arch/mips/generic/init.c
101 ++++ b/arch/mips/generic/init.c
102 +@@ -159,6 +159,7 @@ void __init arch_init_irq(void)
103 + "mti,cpu-interrupt-controller");
104 + if (!cpu_has_veic && !intc_node)
105 + mips_cpu_irq_init();
106 ++ of_node_put(intc_node);
107 +
108 + irqchip_init();
109 + }
110 +diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
111 +index 853b2f4954fa..06049b6b3ddd 100644
112 +--- a/arch/mips/include/asm/io.h
113 ++++ b/arch/mips/include/asm/io.h
114 +@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsigned long address)
115 + /*
116 + * ISA I/O bus memory addresses are 1:1 with the physical address.
117 + */
118 +-static inline unsigned long isa_virt_to_bus(volatile void * address)
119 ++static inline unsigned long isa_virt_to_bus(volatile void *address)
120 + {
121 +- return (unsigned long)address - PAGE_OFFSET;
122 ++ return virt_to_phys(address);
123 + }
124 +
125 +-static inline void * isa_bus_to_virt(unsigned long address)
126 ++static inline void *isa_bus_to_virt(unsigned long address)
127 + {
128 +- return (void *)(address + PAGE_OFFSET);
129 ++ return phys_to_virt(address);
130 + }
131 +
132 + #define isa_page_to_bus page_to_phys
133 +diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
134 +index 513a63b9b991..ba315e523b33 100644
135 +--- a/arch/mips/kernel/process.c
136 ++++ b/arch/mips/kernel/process.c
137 +@@ -118,7 +118,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
138 + struct thread_info *ti = task_thread_info(p);
139 + struct pt_regs *childregs, *regs = current_pt_regs();
140 + unsigned long childksp;
141 +- p->set_child_tid = p->clear_child_tid = NULL;
142 +
143 + childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
144 +
145 +diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
146 +index 43fa682e55da..0ff379f0cc4a 100644
147 +--- a/arch/mips/mm/c-r4k.c
148 ++++ b/arch/mips/mm/c-r4k.c
149 +@@ -835,7 +835,8 @@ static void r4k_flush_icache_user_range(unsigned long start, unsigned long end)
150 + static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
151 + {
152 + /* Catch bad driver code */
153 +- BUG_ON(size == 0);
154 ++ if (WARN_ON(size == 0))
155 ++ return;
156 +
157 + preempt_disable();
158 + if (cpu_has_inclusive_pcaches) {
159 +@@ -871,7 +872,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
160 + static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
161 + {
162 + /* Catch bad driver code */
163 +- BUG_ON(size == 0);
164 ++ if (WARN_ON(size == 0))
165 ++ return;
166 +
167 + preempt_disable();
168 + if (cpu_has_inclusive_pcaches) {
169 +diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
170 +index 7095dfe7666b..962372143fda 100644
171 +--- a/arch/openrisc/kernel/process.c
172 ++++ b/arch/openrisc/kernel/process.c
173 +@@ -152,8 +152,6 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
174 +
175 + top_of_kernel_stack = sp;
176 +
177 +- p->set_child_tid = p->clear_child_tid = NULL;
178 +-
179 + /* Locate userspace context on stack... */
180 + sp -= STACK_FRAME_OVERHEAD; /* redzone */
181 + sp -= sizeof(struct pt_regs);
182 +diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
183 +index 51f842c0a175..da246d95b87c 100644
184 +--- a/arch/s390/kvm/vsie.c
185 ++++ b/arch/s390/kvm/vsie.c
186 +@@ -156,7 +156,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
187 + return set_validity_icpt(scb_s, 0x0039U);
188 +
189 + /* copy only the wrapping keys */
190 +- if (read_guest_real(vcpu, crycb_addr + 72, &vsie_page->crycb, 56))
191 ++ if (read_guest_real(vcpu, crycb_addr + 72,
192 ++ vsie_page->crycb.dea_wrapping_key_mask, 56))
193 + return set_validity_icpt(scb_s, 0x0035U);
194 +
195 + scb_s->ecb3 |= ecb3_flags;
196 +diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
197 +index acef3c6a32a2..5c419b8f99a0 100644
198 +--- a/arch/x86/mm/fault.c
199 ++++ b/arch/x86/mm/fault.c
200 +@@ -330,8 +330,6 @@ static noinline int vmalloc_fault(unsigned long address)
201 + if (!(address >= VMALLOC_START && address < VMALLOC_END))
202 + return -1;
203 +
204 +- WARN_ON_ONCE(in_nmi());
205 +-
206 + /*
207 + * Synchronize this task's top level page-table
208 + * with the 'reference' page table.
209 +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
210 +index 6cd839c1f507..f570f387034d 100644
211 +--- a/block/blk-cgroup.c
212 ++++ b/block/blk-cgroup.c
213 +@@ -185,7 +185,8 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
214 + }
215 +
216 + wb_congested = wb_congested_get_create(&q->backing_dev_info,
217 +- blkcg->css.id, GFP_NOWAIT);
218 ++ blkcg->css.id,
219 ++ GFP_NOWAIT | __GFP_NOWARN);
220 + if (!wb_congested) {
221 + ret = -ENOMEM;
222 + goto err_put_css;
223 +@@ -193,7 +194,7 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
224 +
225 + /* allocate */
226 + if (!new_blkg) {
227 +- new_blkg = blkg_alloc(blkcg, q, GFP_NOWAIT);
228 ++ new_blkg = blkg_alloc(blkcg, q, GFP_NOWAIT | __GFP_NOWARN);
229 + if (unlikely(!new_blkg)) {
230 + ret = -ENOMEM;
231 + goto err_put_congested;
232 +@@ -1022,7 +1023,7 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
233 + }
234 +
235 + spin_lock_init(&blkcg->lock);
236 +- INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT);
237 ++ INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT | __GFP_NOWARN);
238 + INIT_HLIST_HEAD(&blkcg->blkg_list);
239 + #ifdef CONFIG_CGROUP_WRITEBACK
240 + INIT_LIST_HEAD(&blkcg->cgwb_list);
241 +@@ -1238,7 +1239,7 @@ pd_prealloc:
242 + if (blkg->pd[pol->plid])
243 + continue;
244 +
245 +- pd = pol->pd_alloc_fn(GFP_NOWAIT, q->node);
246 ++ pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q->node);
247 + if (!pd)
248 + swap(pd, pd_prealloc);
249 + if (!pd) {
250 +diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
251 +index c7c3d4e6bc27..a4e2d0104af4 100644
252 +--- a/block/cfq-iosched.c
253 ++++ b/block/cfq-iosched.c
254 +@@ -2951,7 +2951,8 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
255 + * for devices that support queuing, otherwise we still have a problem
256 + * with sync vs async workloads.
257 + */
258 +- if (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag)
259 ++ if (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag &&
260 ++ !cfqd->cfq_group_idle)
261 + return;
262 +
263 + WARN_ON(!RB_EMPTY_ROOT(&cfqq->sort_list));
264 +@@ -3867,7 +3868,8 @@ cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
265 + goto out;
266 + }
267 +
268 +- cfqq = kmem_cache_alloc_node(cfq_pool, GFP_NOWAIT | __GFP_ZERO,
269 ++ cfqq = kmem_cache_alloc_node(cfq_pool,
270 ++ GFP_NOWAIT | __GFP_ZERO | __GFP_NOWARN,
271 + cfqd->queue->node);
272 + if (!cfqq) {
273 + cfqq = &cfqd->oom_cfqq;
274 +diff --git a/block/partitions/aix.c b/block/partitions/aix.c
275 +index f3ed7b2d89bf..8e7d358e0226 100644
276 +--- a/block/partitions/aix.c
277 ++++ b/block/partitions/aix.c
278 +@@ -177,7 +177,7 @@ int aix_partition(struct parsed_partitions *state)
279 + u32 vgda_sector = 0;
280 + u32 vgda_len = 0;
281 + int numlvs = 0;
282 +- struct pvd *pvd;
283 ++ struct pvd *pvd = NULL;
284 + struct lv_info {
285 + unsigned short pps_per_lv;
286 + unsigned short pps_found;
287 +@@ -231,10 +231,11 @@ int aix_partition(struct parsed_partitions *state)
288 + if (lvip[i].pps_per_lv)
289 + foundlvs += 1;
290 + }
291 ++ /* pvd loops depend on n[].name and lvip[].pps_per_lv */
292 ++ pvd = alloc_pvd(state, vgda_sector + 17);
293 + }
294 + put_dev_sector(sect);
295 + }
296 +- pvd = alloc_pvd(state, vgda_sector + 17);
297 + if (pvd) {
298 + int numpps = be16_to_cpu(pvd->pp_count);
299 + int psn_part1 = be32_to_cpu(pvd->psn_part1);
300 +@@ -281,10 +282,14 @@ int aix_partition(struct parsed_partitions *state)
301 + next_lp_ix += 1;
302 + }
303 + for (i = 0; i < state->limit; i += 1)
304 +- if (lvip[i].pps_found && !lvip[i].lv_is_contiguous)
305 ++ if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) {
306 ++ char tmp[sizeof(n[i].name) + 1]; // null char
307 ++
308 ++ snprintf(tmp, sizeof(tmp), "%s", n[i].name);
309 + pr_warn("partition %s (%u pp's found) is "
310 + "not contiguous\n",
311 +- n[i].name, lvip[i].pps_found);
312 ++ tmp, lvip[i].pps_found);
313 ++ }
314 + kfree(pvd);
315 + }
316 + kfree(n);
317 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
318 +index d81b984b72e4..f233ce60a678 100644
319 +--- a/drivers/ata/libahci.c
320 ++++ b/drivers/ata/libahci.c
321 +@@ -2132,6 +2132,8 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
322 + deto = 20;
323 + }
324 +
325 ++ /* Make dito, mdat, deto bits to 0s */
326 ++ devslp &= ~GENMASK_ULL(24, 2);
327 + devslp |= ((dito << PORT_DEVSLP_DITO_OFFSET) |
328 + (mdat << PORT_DEVSLP_MDAT_OFFSET) |
329 + (deto << PORT_DEVSLP_DETO_OFFSET) |
330 +diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
331 +index 3cc9bff9d99d..4a9493a4159f 100644
332 +--- a/drivers/bluetooth/Kconfig
333 ++++ b/drivers/bluetooth/Kconfig
334 +@@ -125,6 +125,7 @@ config BT_HCIUART_LL
335 + config BT_HCIUART_3WIRE
336 + bool "Three-wire UART (H5) protocol support"
337 + depends on BT_HCIUART
338 ++ depends on BT_HCIUART_SERDEV
339 + help
340 + The HCI Three-wire UART Transport Layer makes it possible to
341 + user the Bluetooth HCI over a serial port interface. The HCI
342 +diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
343 +index da69ddea56cf..b15479ac0f90 100644
344 +--- a/drivers/char/tpm/tpm_i2c_infineon.c
345 ++++ b/drivers/char/tpm/tpm_i2c_infineon.c
346 +@@ -115,7 +115,7 @@ static int iic_tpm_read(u8 addr, u8 *buffer, size_t len)
347 + /* Lock the adapter for the duration of the whole sequence. */
348 + if (!tpm_dev.client->adapter->algo->master_xfer)
349 + return -EOPNOTSUPP;
350 +- i2c_lock_adapter(tpm_dev.client->adapter);
351 ++ i2c_lock_bus(tpm_dev.client->adapter, I2C_LOCK_SEGMENT);
352 +
353 + if (tpm_dev.chip_type == SLB9645) {
354 + /* use a combined read for newer chips
355 +@@ -156,7 +156,7 @@ static int iic_tpm_read(u8 addr, u8 *buffer, size_t len)
356 + }
357 +
358 + out:
359 +- i2c_unlock_adapter(tpm_dev.client->adapter);
360 ++ i2c_unlock_bus(tpm_dev.client->adapter, I2C_LOCK_SEGMENT);
361 + /* take care of 'guard time' */
362 + usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI);
363 +
364 +@@ -188,7 +188,7 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
365 +
366 + if (!tpm_dev.client->adapter->algo->master_xfer)
367 + return -EOPNOTSUPP;
368 +- i2c_lock_adapter(tpm_dev.client->adapter);
369 ++ i2c_lock_bus(tpm_dev.client->adapter, I2C_LOCK_SEGMENT);
370 +
371 + /* prepend the 'register address' to the buffer */
372 + tpm_dev.buf[0] = addr;
373 +@@ -207,7 +207,7 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
374 + usleep_range(sleep_low, sleep_hi);
375 + }
376 +
377 +- i2c_unlock_adapter(tpm_dev.client->adapter);
378 ++ i2c_unlock_bus(tpm_dev.client->adapter, I2C_LOCK_SEGMENT);
379 + /* take care of 'guard time' */
380 + usleep_range(SLEEP_DURATION_LOW, SLEEP_DURATION_HI);
381 +
382 +diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
383 +index 01eccb193b5a..950c2d28d81d 100644
384 +--- a/drivers/char/tpm/tpm_tis_spi.c
385 ++++ b/drivers/char/tpm/tpm_tis_spi.c
386 +@@ -189,6 +189,7 @@ static const struct tpm_tis_phy_ops tpm_spi_phy_ops = {
387 + static int tpm_tis_spi_probe(struct spi_device *dev)
388 + {
389 + struct tpm_tis_spi_phy *phy;
390 ++ int irq;
391 +
392 + phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy),
393 + GFP_KERNEL);
394 +@@ -201,7 +202,13 @@ static int tpm_tis_spi_probe(struct spi_device *dev)
395 + if (!phy->iobuf)
396 + return -ENOMEM;
397 +
398 +- return tpm_tis_core_init(&dev->dev, &phy->priv, -1, &tpm_spi_phy_ops,
399 ++ /* If the SPI device has an IRQ then use that */
400 ++ if (dev->irq > 0)
401 ++ irq = dev->irq;
402 ++ else
403 ++ irq = -1;
404 ++
405 ++ return tpm_tis_core_init(&dev->dev, &phy->priv, irq, &tpm_spi_phy_ops,
406 + NULL);
407 + }
408 +
409 +diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
410 +index 796a5a4bc4f5..e9b607417df9 100644
411 +--- a/drivers/gpio/gpio-ml-ioh.c
412 ++++ b/drivers/gpio/gpio-ml-ioh.c
413 +@@ -495,9 +495,10 @@ err_irq_alloc_descs:
414 +
415 + chip = chip_save;
416 + err_gpiochip_add:
417 ++ chip = chip_save;
418 + while (--i >= 0) {
419 +- chip--;
420 + gpiochip_remove(&chip->gpio);
421 ++ chip++;
422 + }
423 + kfree(chip_save);
424 +
425 +diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
426 +index 661b0e34e067..05d3241ad20b 100644
427 +--- a/drivers/gpio/gpio-tegra.c
428 ++++ b/drivers/gpio/gpio-tegra.c
429 +@@ -723,4 +723,4 @@ static int __init tegra_gpio_init(void)
430 + {
431 + return platform_driver_register(&tegra_gpio_driver);
432 + }
433 +-postcore_initcall(tegra_gpio_init);
434 ++subsys_initcall(tegra_gpio_init);
435 +diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
436 +index b32bf7eac3c8..663017f1d078 100644
437 +--- a/drivers/i2c/busses/i2c-i801.c
438 ++++ b/drivers/i2c/busses/i2c-i801.c
439 +@@ -135,6 +135,7 @@
440 +
441 + #define SBREG_BAR 0x10
442 + #define SBREG_SMBCTRL 0xc6000c
443 ++#define SBREG_SMBCTRL_DNV 0xcf000c
444 +
445 + /* Host status bits for SMBPCISTS */
446 + #define SMBPCISTS_INTS 0x08
447 +@@ -1387,7 +1388,11 @@ static void i801_add_tco(struct i801_priv *priv)
448 + spin_unlock(&p2sb_spinlock);
449 +
450 + res = &tco_res[ICH_RES_MEM_OFF];
451 +- res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL;
452 ++ if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS)
453 ++ res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV;
454 ++ else
455 ++ res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL;
456 ++
457 + res->end = res->start + 3;
458 + res->flags = IORESOURCE_MEM;
459 +
460 +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
461 +index 66bce3b311a1..b72cf2f8da5c 100644
462 +--- a/drivers/i2c/busses/i2c-xiic.c
463 ++++ b/drivers/i2c/busses/i2c-xiic.c
464 +@@ -538,6 +538,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
465 + {
466 + u8 rx_watermark;
467 + struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
468 ++ unsigned long flags;
469 +
470 + /* Clear and enable Rx full interrupt. */
471 + xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK);
472 +@@ -553,6 +554,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
473 + rx_watermark = IIC_RX_FIFO_DEPTH;
474 + xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1);
475 +
476 ++ local_irq_save(flags);
477 + if (!(msg->flags & I2C_M_NOSTART))
478 + /* write the address */
479 + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
480 +@@ -563,6 +565,8 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
481 +
482 + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
483 + msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0));
484 ++ local_irq_restore(flags);
485 ++
486 + if (i2c->nmsgs == 1)
487 + /* very last, enable bus not busy as well */
488 + xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK);
489 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
490 +index cbe5324c4331..575afba1056a 100644
491 +--- a/drivers/infiniband/core/cma.c
492 ++++ b/drivers/infiniband/core/cma.c
493 +@@ -1409,9 +1409,16 @@ static bool cma_match_net_dev(const struct rdma_cm_id *id,
494 + (addr->src_addr.ss_family == AF_IB ||
495 + cma_protocol_roce_dev_port(id->device, port_num));
496 +
497 +- return !addr->dev_addr.bound_dev_if ||
498 +- (net_eq(dev_net(net_dev), addr->dev_addr.net) &&
499 +- addr->dev_addr.bound_dev_if == net_dev->ifindex);
500 ++ /*
501 ++ * Net namespaces must match, and if the listner is listening
502 ++ * on a specific netdevice than netdevice must match as well.
503 ++ */
504 ++ if (net_eq(dev_net(net_dev), addr->dev_addr.net) &&
505 ++ (!!addr->dev_addr.bound_dev_if ==
506 ++ (addr->dev_addr.bound_dev_if == net_dev->ifindex)))
507 ++ return true;
508 ++ else
509 ++ return false;
510 + }
511 +
512 + static struct rdma_id_private *cma_find_listener(
513 +diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
514 +index 0d25dc84d294..2152c71a99d3 100644
515 +--- a/drivers/infiniband/sw/rxe/rxe_resp.c
516 ++++ b/drivers/infiniband/sw/rxe/rxe_resp.c
517 +@@ -978,7 +978,9 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
518 + free_rd_atomic_resource(qp, res);
519 + rxe_advance_resp_resource(qp);
520 +
521 +- memcpy(SKB_TO_PKT(skb), &ack_pkt, sizeof(skb->cb));
522 ++ memcpy(SKB_TO_PKT(skb), &ack_pkt, sizeof(ack_pkt));
523 ++ memset((unsigned char *)SKB_TO_PKT(skb) + sizeof(ack_pkt), 0,
524 ++ sizeof(skb->cb) - sizeof(ack_pkt));
525 +
526 + res->type = RXE_ATOMIC_MASK;
527 + res->atomic.skb = skb;
528 +diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
529 +index 26132402fdf9..c2fb0236a47c 100644
530 +--- a/drivers/input/touchscreen/atmel_mxt_ts.c
531 ++++ b/drivers/input/touchscreen/atmel_mxt_ts.c
532 +@@ -1671,10 +1671,11 @@ static int mxt_get_object_table(struct mxt_data *data)
533 + break;
534 + case MXT_TOUCH_MULTI_T9:
535 + data->multitouch = MXT_TOUCH_MULTI_T9;
536 ++ /* Only handle messages from first T9 instance */
537 + data->T9_reportid_min = min_id;
538 +- data->T9_reportid_max = max_id;
539 +- data->num_touchids = object->num_report_ids
540 +- * mxt_obj_instances(object);
541 ++ data->T9_reportid_max = min_id +
542 ++ object->num_report_ids - 1;
543 ++ data->num_touchids = object->num_report_ids;
544 + break;
545 + case MXT_SPT_MESSAGECOUNT_T44:
546 + data->T44_address = object->start_address;
547 +diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
548 +index ace331da6459..85b5e75c7faa 100644
549 +--- a/drivers/iommu/ipmmu-vmsa.c
550 ++++ b/drivers/iommu/ipmmu-vmsa.c
551 +@@ -44,7 +44,7 @@ struct ipmmu_vmsa_domain {
552 + struct io_pgtable_ops *iop;
553 +
554 + unsigned int context_id;
555 +- spinlock_t lock; /* Protects mappings */
556 ++ struct mutex mutex; /* Protects mappings */
557 + };
558 +
559 + struct ipmmu_vmsa_archdata {
560 +@@ -464,7 +464,7 @@ static struct iommu_domain *ipmmu_domain_alloc(unsigned type)
561 + if (!domain)
562 + return NULL;
563 +
564 +- spin_lock_init(&domain->lock);
565 ++ mutex_init(&domain->mutex);
566 +
567 + return &domain->io_domain;
568 + }
569 +@@ -488,7 +488,6 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
570 + struct ipmmu_vmsa_archdata *archdata = dev->archdata.iommu;
571 + struct ipmmu_vmsa_device *mmu = archdata->mmu;
572 + struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);
573 +- unsigned long flags;
574 + unsigned int i;
575 + int ret = 0;
576 +
577 +@@ -497,7 +496,7 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
578 + return -ENXIO;
579 + }
580 +
581 +- spin_lock_irqsave(&domain->lock, flags);
582 ++ mutex_lock(&domain->mutex);
583 +
584 + if (!domain->mmu) {
585 + /* The domain hasn't been used yet, initialize it. */
586 +@@ -513,7 +512,7 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
587 + ret = -EINVAL;
588 + }
589 +
590 +- spin_unlock_irqrestore(&domain->lock, flags);
591 ++ mutex_unlock(&domain->mutex);
592 +
593 + if (ret < 0)
594 + return ret;
595 +diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
596 +index 91081dcdc272..32c696799300 100644
597 +--- a/drivers/macintosh/via-pmu.c
598 ++++ b/drivers/macintosh/via-pmu.c
599 +@@ -531,8 +531,9 @@ init_pmu(void)
600 + int timeout;
601 + struct adb_request req;
602 +
603 +- out_8(&via[B], via[B] | TREQ); /* negate TREQ */
604 +- out_8(&via[DIRB], (via[DIRB] | TREQ) & ~TACK); /* TACK in, TREQ out */
605 ++ /* Negate TREQ. Set TACK to input and TREQ to output. */
606 ++ out_8(&via[B], in_8(&via[B]) | TREQ);
607 ++ out_8(&via[DIRB], (in_8(&via[DIRB]) | TREQ) & ~TACK);
608 +
609 + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
610 + timeout = 100000;
611 +@@ -1454,8 +1455,8 @@ pmu_sr_intr(void)
612 + struct adb_request *req;
613 + int bite = 0;
614 +
615 +- if (via[B] & TREQ) {
616 +- printk(KERN_ERR "PMU: spurious SR intr (%x)\n", via[B]);
617 ++ if (in_8(&via[B]) & TREQ) {
618 ++ printk(KERN_ERR "PMU: spurious SR intr (%x)\n", in_8(&via[B]));
619 + out_8(&via[IFR], SR_INT);
620 + return NULL;
621 + }
622 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
623 +index e43b9f80bb1d..4afc419da60f 100644
624 +--- a/drivers/md/raid5.c
625 ++++ b/drivers/md/raid5.c
626 +@@ -4207,6 +4207,12 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
627 + s->failed++;
628 + if (rdev && !test_bit(Faulty, &rdev->flags))
629 + do_recovery = 1;
630 ++ else if (!rdev) {
631 ++ rdev = rcu_dereference(
632 ++ conf->disks[i].replacement);
633 ++ if (rdev && !test_bit(Faulty, &rdev->flags))
634 ++ do_recovery = 1;
635 ++ }
636 + }
637 + }
638 + if (test_bit(STRIPE_SYNCING, &sh->state)) {
639 +diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c
640 +index e06bcd4b3ddc..800f386f1f3f 100644
641 +--- a/drivers/media/dvb-frontends/helene.c
642 ++++ b/drivers/media/dvb-frontends/helene.c
643 +@@ -898,7 +898,10 @@ static int helene_x_pon(struct helene_priv *priv)
644 + helene_write_regs(priv, 0x99, cdata, sizeof(cdata));
645 +
646 + /* 0x81 - 0x94 */
647 +- data[0] = 0x18; /* xtal 24 MHz */
648 ++ if (priv->xtal == SONY_HELENE_XTAL_16000)
649 ++ data[0] = 0x10; /* xtal 16 MHz */
650 ++ else
651 ++ data[0] = 0x18; /* xtal 24 MHz */
652 + data[1] = (uint8_t)(0x80 | (0x04 & 0x1F)); /* 4 x 25 = 100uA */
653 + data[2] = (uint8_t)(0x80 | (0x26 & 0x7F)); /* 38 x 0.25 = 9.5pF */
654 + data[3] = 0x80; /* REFOUT signal output 500mVpp */
655 +diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
656 +index 7c24da51626c..8051c1345692 100644
657 +--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
658 ++++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
659 +@@ -249,24 +249,24 @@ static void s5p_mfc_handle_frame_all_extracted(struct s5p_mfc_ctx *ctx)
660 + static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
661 + {
662 + struct s5p_mfc_dev *dev = ctx->dev;
663 +- struct s5p_mfc_buf *dst_buf, *src_buf;
664 +- size_t dec_y_addr;
665 ++ struct s5p_mfc_buf *dst_buf, *src_buf;
666 ++ u32 dec_y_addr;
667 + unsigned int frame_type;
668 +
669 + /* Make sure we actually have a new frame before continuing. */
670 + frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_dec_frame_type, dev);
671 + if (frame_type == S5P_FIMV_DECODE_FRAME_SKIPPED)
672 + return;
673 +- dec_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dec_y_adr, dev);
674 ++ dec_y_addr = (u32)s5p_mfc_hw_call(dev->mfc_ops, get_dec_y_adr, dev);
675 +
676 + /* Copy timestamp / timecode from decoded src to dst and set
677 + appropriate flags. */
678 + src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
679 + list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
680 +- if (vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0)
681 +- == dec_y_addr) {
682 +- dst_buf->b->timecode =
683 +- src_buf->b->timecode;
684 ++ u32 addr = (u32)vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0);
685 ++
686 ++ if (addr == dec_y_addr) {
687 ++ dst_buf->b->timecode = src_buf->b->timecode;
688 + dst_buf->b->vb2_buf.timestamp =
689 + src_buf->b->vb2_buf.timestamp;
690 + dst_buf->b->flags &=
691 +@@ -302,10 +302,10 @@ static void s5p_mfc_handle_frame_new(struct s5p_mfc_ctx *ctx, unsigned int err)
692 + {
693 + struct s5p_mfc_dev *dev = ctx->dev;
694 + struct s5p_mfc_buf *dst_buf;
695 +- size_t dspl_y_addr;
696 ++ u32 dspl_y_addr;
697 + unsigned int frame_type;
698 +
699 +- dspl_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dspl_y_adr, dev);
700 ++ dspl_y_addr = (u32)s5p_mfc_hw_call(dev->mfc_ops, get_dspl_y_adr, dev);
701 + if (IS_MFCV6_PLUS(dev))
702 + frame_type = s5p_mfc_hw_call(dev->mfc_ops,
703 + get_disp_frame_type, ctx);
704 +@@ -324,9 +324,10 @@ static void s5p_mfc_handle_frame_new(struct s5p_mfc_ctx *ctx, unsigned int err)
705 + /* The MFC returns address of the buffer, now we have to
706 + * check which videobuf does it correspond to */
707 + list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
708 ++ u32 addr = (u32)vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0);
709 ++
710 + /* Check if this is the buffer we're looking for */
711 +- if (vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0)
712 +- == dspl_y_addr) {
713 ++ if (addr == dspl_y_addr) {
714 + list_del(&dst_buf->list);
715 + ctx->dst_queue_cnt--;
716 + dst_buf->b->sequence = ctx->sequence;
717 +diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
718 +index c8f027b4ea4c..798f0a829637 100644
719 +--- a/drivers/mfd/ti_am335x_tscadc.c
720 ++++ b/drivers/mfd/ti_am335x_tscadc.c
721 +@@ -209,14 +209,13 @@ static int ti_tscadc_probe(struct platform_device *pdev)
722 + * The TSC_ADC_SS controller design assumes the OCP clock is
723 + * at least 6x faster than the ADC clock.
724 + */
725 +- clk = clk_get(&pdev->dev, "adc_tsc_fck");
726 ++ clk = devm_clk_get(&pdev->dev, "adc_tsc_fck");
727 + if (IS_ERR(clk)) {
728 + dev_err(&pdev->dev, "failed to get TSC fck\n");
729 + err = PTR_ERR(clk);
730 + goto err_disable_clk;
731 + }
732 + clock_rate = clk_get_rate(clk);
733 +- clk_put(clk);
734 + tscadc->clk_div = clock_rate / ADC_CLK;
735 +
736 + /* TSCADC_CLKDIV needs to be configured to the value minus 1 */
737 +diff --git a/drivers/misc/mic/scif/scif_api.c b/drivers/misc/mic/scif/scif_api.c
738 +index ddc9e4b08b5c..56efa9d18a9a 100644
739 +--- a/drivers/misc/mic/scif/scif_api.c
740 ++++ b/drivers/misc/mic/scif/scif_api.c
741 +@@ -370,11 +370,10 @@ int scif_bind(scif_epd_t epd, u16 pn)
742 + goto scif_bind_exit;
743 + }
744 + } else {
745 +- pn = scif_get_new_port();
746 +- if (!pn) {
747 +- ret = -ENOSPC;
748 ++ ret = scif_get_new_port();
749 ++ if (ret < 0)
750 + goto scif_bind_exit;
751 +- }
752 ++ pn = ret;
753 + }
754 +
755 + ep->state = SCIFEP_BOUND;
756 +@@ -648,13 +647,12 @@ int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block)
757 + err = -EISCONN;
758 + break;
759 + case SCIFEP_UNBOUND:
760 +- ep->port.port = scif_get_new_port();
761 +- if (!ep->port.port) {
762 +- err = -ENOSPC;
763 +- } else {
764 +- ep->port.node = scif_info.nodeid;
765 +- ep->conn_async_state = ASYNC_CONN_IDLE;
766 +- }
767 ++ err = scif_get_new_port();
768 ++ if (err < 0)
769 ++ break;
770 ++ ep->port.port = err;
771 ++ ep->port.node = scif_info.nodeid;
772 ++ ep->conn_async_state = ASYNC_CONN_IDLE;
773 + /* Fall through */
774 + case SCIFEP_BOUND:
775 + /*
776 +diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
777 +index bf0d7708beac..9be64336461e 100644
778 +--- a/drivers/misc/ti-st/st_kim.c
779 ++++ b/drivers/misc/ti-st/st_kim.c
780 +@@ -756,14 +756,14 @@ static int kim_probe(struct platform_device *pdev)
781 + err = gpio_request(kim_gdata->nshutdown, "kim");
782 + if (unlikely(err)) {
783 + pr_err(" gpio %d request failed ", kim_gdata->nshutdown);
784 +- return err;
785 ++ goto err_sysfs_group;
786 + }
787 +
788 + /* Configure nShutdown GPIO as output=0 */
789 + err = gpio_direction_output(kim_gdata->nshutdown, 0);
790 + if (unlikely(err)) {
791 + pr_err(" unable to configure gpio %d", kim_gdata->nshutdown);
792 +- return err;
793 ++ goto err_sysfs_group;
794 + }
795 + /* get reference of pdev for request_firmware
796 + */
797 +diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
798 +index 23a6986d512b..a8f74d9bba4f 100644
799 +--- a/drivers/mtd/ubi/wl.c
800 ++++ b/drivers/mtd/ubi/wl.c
801 +@@ -1615,8 +1615,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
802 + cond_resched();
803 +
804 + e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
805 +- if (!e)
806 ++ if (!e) {
807 ++ err = -ENOMEM;
808 + goto out_free;
809 ++ }
810 +
811 + e->pnum = aeb->pnum;
812 + e->ec = aeb->ec;
813 +@@ -1635,8 +1637,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
814 + cond_resched();
815 +
816 + e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
817 +- if (!e)
818 ++ if (!e) {
819 ++ err = -ENOMEM;
820 + goto out_free;
821 ++ }
822 +
823 + e->pnum = aeb->pnum;
824 + e->ec = aeb->ec;
825 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
826 +index 17b81780d12f..c92ffdf91065 100644
827 +--- a/drivers/net/ethernet/marvell/mvneta.c
828 ++++ b/drivers/net/ethernet/marvell/mvneta.c
829 +@@ -3117,7 +3117,6 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
830 +
831 + on_each_cpu(mvneta_percpu_enable, pp, true);
832 + mvneta_start_dev(pp);
833 +- mvneta_port_up(pp);
834 +
835 + netdev_update_features(dev);
836 +
837 +diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
838 +index 487bf5b8f545..bd9f9b9853c1 100644
839 +--- a/drivers/net/phy/mdio-mux-bcm-iproc.c
840 ++++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
841 +@@ -22,7 +22,7 @@
842 + #include <linux/mdio-mux.h>
843 + #include <linux/delay.h>
844 +
845 +-#define MDIO_PARAM_OFFSET 0x00
846 ++#define MDIO_PARAM_OFFSET 0x23c
847 + #define MDIO_PARAM_MIIM_CYCLE 29
848 + #define MDIO_PARAM_INTERNAL_SEL 25
849 + #define MDIO_PARAM_BUS_ID 22
850 +@@ -30,20 +30,22 @@
851 + #define MDIO_PARAM_PHY_ID 16
852 + #define MDIO_PARAM_PHY_DATA 0
853 +
854 +-#define MDIO_READ_OFFSET 0x04
855 ++#define MDIO_READ_OFFSET 0x240
856 + #define MDIO_READ_DATA_MASK 0xffff
857 +-#define MDIO_ADDR_OFFSET 0x08
858 ++#define MDIO_ADDR_OFFSET 0x244
859 +
860 +-#define MDIO_CTRL_OFFSET 0x0C
861 ++#define MDIO_CTRL_OFFSET 0x248
862 + #define MDIO_CTRL_WRITE_OP 0x1
863 + #define MDIO_CTRL_READ_OP 0x2
864 +
865 +-#define MDIO_STAT_OFFSET 0x10
866 ++#define MDIO_STAT_OFFSET 0x24c
867 + #define MDIO_STAT_DONE 1
868 +
869 + #define BUS_MAX_ADDR 32
870 + #define EXT_BUS_START_ADDR 16
871 +
872 ++#define MDIO_REG_ADDR_SPACE_SIZE 0x250
873 ++
874 + struct iproc_mdiomux_desc {
875 + void *mux_handle;
876 + void __iomem *base;
877 +@@ -169,6 +171,14 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
878 + md->dev = &pdev->dev;
879 +
880 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
881 ++ if (res->start & 0xfff) {
882 ++ /* For backward compatibility in case the
883 ++ * base address is specified with an offset.
884 ++ */
885 ++ dev_info(&pdev->dev, "fix base address in dt-blob\n");
886 ++ res->start &= ~0xfff;
887 ++ res->end = res->start + MDIO_REG_ADDR_SPACE_SIZE - 1;
888 ++ }
889 + md->base = devm_ioremap_resource(&pdev->dev, res);
890 + if (IS_ERR(md->base)) {
891 + dev_err(&pdev->dev, "failed to ioremap register\n");
892 +diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
893 +index d68f4f2965e0..5fe6841b8889 100644
894 +--- a/drivers/net/wireless/ath/ath10k/mac.c
895 ++++ b/drivers/net/wireless/ath/ath10k/mac.c
896 +@@ -3003,6 +3003,13 @@ static int ath10k_update_channel_list(struct ath10k *ar)
897 + passive = channel->flags & IEEE80211_CHAN_NO_IR;
898 + ch->passive = passive;
899 +
900 ++ /* the firmware is ignoring the "radar" flag of the
901 ++ * channel and is scanning actively using Probe Requests
902 ++ * on "Radar detection"/DFS channels which are not
903 ++ * marked as "available"
904 ++ */
905 ++ ch->passive |= ch->chan_radar;
906 ++
907 + ch->freq = channel->center_freq;
908 + ch->band_center_freq1 = channel->center_freq;
909 + ch->min_power = 0;
910 +diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
911 +index 0e4d49adddd0..f69b98f4276b 100644
912 +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
913 ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
914 +@@ -1451,6 +1451,11 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
915 + cfg->keep_alive_pattern_size = __cpu_to_le32(0);
916 + cfg->max_tdls_concurrent_sleep_sta = __cpu_to_le32(1);
917 + cfg->max_tdls_concurrent_buffer_sta = __cpu_to_le32(1);
918 ++ cfg->wmi_send_separate = __cpu_to_le32(0);
919 ++ cfg->num_ocb_vdevs = __cpu_to_le32(0);
920 ++ cfg->num_ocb_channels = __cpu_to_le32(0);
921 ++ cfg->num_ocb_schedules = __cpu_to_le32(0);
922 ++ cfg->host_capab = __cpu_to_le32(0);
923 +
924 + ath10k_wmi_put_host_mem_chunks(ar, chunks);
925 +
926 +diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
927 +index b8aa6000573c..2c94fe370bb8 100644
928 +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
929 ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
930 +@@ -1227,6 +1227,11 @@ struct wmi_tlv_resource_config {
931 + __le32 keep_alive_pattern_size;
932 + __le32 max_tdls_concurrent_sleep_sta;
933 + __le32 max_tdls_concurrent_buffer_sta;
934 ++ __le32 wmi_send_separate;
935 ++ __le32 num_ocb_vdevs;
936 ++ __le32 num_ocb_channels;
937 ++ __le32 num_ocb_schedules;
938 ++ __le32 host_capab;
939 + } __packed;
940 +
941 + struct wmi_tlv_init_cmd {
942 +diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
943 +index acef4ec928c1..951bac2caf12 100644
944 +--- a/drivers/net/wireless/ath/ath9k/hw.c
945 ++++ b/drivers/net/wireless/ath/ath9k/hw.c
946 +@@ -2915,16 +2915,19 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan,
947 + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
948 + struct ieee80211_channel *channel;
949 + int chan_pwr, new_pwr;
950 ++ u16 ctl = NO_CTL;
951 +
952 + if (!chan)
953 + return;
954 +
955 ++ if (!test)
956 ++ ctl = ath9k_regd_get_ctl(reg, chan);
957 ++
958 + channel = chan->chan;
959 + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
960 + new_pwr = min_t(int, chan_pwr, reg->power_limit);
961 +
962 +- ah->eep_ops->set_txpower(ah, chan,
963 +- ath9k_regd_get_ctl(reg, chan),
964 ++ ah->eep_ops->set_txpower(ah, chan, ctl,
965 + get_antenna_gain(ah, chan), new_pwr, test);
966 + }
967 +
968 +diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
969 +index e47286bf378e..8a504afe667e 100644
970 +--- a/drivers/net/wireless/ath/ath9k/xmit.c
971 ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
972 +@@ -84,7 +84,8 @@ static void ath_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
973 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
974 + struct ieee80211_sta *sta = info->status.status_driver_data[0];
975 +
976 +- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
977 ++ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
978 ++ IEEE80211_TX_STATUS_EOSP)) {
979 + ieee80211_tx_status(hw, skb);
980 + return;
981 + }
982 +diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c
983 +index b9e14045195f..7367f0947825 100644
984 +--- a/drivers/net/wireless/ti/wlcore/rx.c
985 ++++ b/drivers/net/wireless/ti/wlcore/rx.c
986 +@@ -59,7 +59,7 @@ static u32 wlcore_rx_get_align_buf_size(struct wl1271 *wl, u32 pkt_len)
987 + static void wl1271_rx_status(struct wl1271 *wl,
988 + struct wl1271_rx_descriptor *desc,
989 + struct ieee80211_rx_status *status,
990 +- u8 beacon)
991 ++ u8 beacon, u8 probe_rsp)
992 + {
993 + memset(status, 0, sizeof(struct ieee80211_rx_status));
994 +
995 +@@ -106,6 +106,9 @@ static void wl1271_rx_status(struct wl1271 *wl,
996 + }
997 + }
998 +
999 ++ if (beacon || probe_rsp)
1000 ++ status->boottime_ns = ktime_get_boot_ns();
1001 ++
1002 + if (beacon)
1003 + wlcore_set_pending_regdomain_ch(wl, (u16)desc->channel,
1004 + status->band);
1005 +@@ -194,7 +197,8 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
1006 + if (ieee80211_is_data_present(hdr->frame_control))
1007 + is_data = 1;
1008 +
1009 +- wl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon);
1010 ++ wl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon,
1011 ++ ieee80211_is_probe_resp(hdr->frame_control));
1012 + wlcore_hw_set_rx_csum(wl, desc, skb);
1013 +
1014 + seq_num = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
1015 +diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
1016 +index 5466246c69b4..b78a2f3745f2 100644
1017 +--- a/drivers/scsi/3w-9xxx.c
1018 ++++ b/drivers/scsi/3w-9xxx.c
1019 +@@ -2045,6 +2045,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1020 +
1021 + if (twa_initialize_device_extension(tw_dev)) {
1022 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x25, "Failed to initialize device extension");
1023 ++ retval = -ENOMEM;
1024 + goto out_free_device_extension;
1025 + }
1026 +
1027 +@@ -2067,6 +2068,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1028 + tw_dev->base_addr = ioremap(mem_addr, mem_len);
1029 + if (!tw_dev->base_addr) {
1030 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap");
1031 ++ retval = -ENOMEM;
1032 + goto out_release_mem_region;
1033 + }
1034 +
1035 +@@ -2074,8 +2076,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1036 + TW_DISABLE_INTERRUPTS(tw_dev);
1037 +
1038 + /* Initialize the card */
1039 +- if (twa_reset_sequence(tw_dev, 0))
1040 ++ if (twa_reset_sequence(tw_dev, 0)) {
1041 ++ retval = -ENOMEM;
1042 + goto out_iounmap;
1043 ++ }
1044 +
1045 + /* Set host specific parameters */
1046 + if ((pdev->device == PCI_DEVICE_ID_3WARE_9650SE) ||
1047 +diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
1048 +index f8374850f714..f0a5536a9ff5 100644
1049 +--- a/drivers/scsi/3w-sas.c
1050 ++++ b/drivers/scsi/3w-sas.c
1051 +@@ -1600,6 +1600,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1052 +
1053 + if (twl_initialize_device_extension(tw_dev)) {
1054 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Failed to initialize device extension");
1055 ++ retval = -ENOMEM;
1056 + goto out_free_device_extension;
1057 + }
1058 +
1059 +@@ -1614,6 +1615,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1060 + tw_dev->base_addr = pci_iomap(pdev, 1, 0);
1061 + if (!tw_dev->base_addr) {
1062 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to ioremap");
1063 ++ retval = -ENOMEM;
1064 + goto out_release_mem_region;
1065 + }
1066 +
1067 +@@ -1623,6 +1625,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1068 + /* Initialize the card */
1069 + if (twl_reset_sequence(tw_dev, 0)) {
1070 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1d, "Controller reset failed during probe");
1071 ++ retval = -ENOMEM;
1072 + goto out_iounmap;
1073 + }
1074 +
1075 +diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
1076 +index 24ac19e31003..0ee0835d2647 100644
1077 +--- a/drivers/scsi/3w-xxxx.c
1078 ++++ b/drivers/scsi/3w-xxxx.c
1079 +@@ -2281,6 +2281,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1080 +
1081 + if (tw_initialize_device_extension(tw_dev)) {
1082 + printk(KERN_WARNING "3w-xxxx: Failed to initialize device extension.");
1083 ++ retval = -ENOMEM;
1084 + goto out_free_device_extension;
1085 + }
1086 +
1087 +@@ -2295,6 +2296,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1088 + tw_dev->base_addr = pci_resource_start(pdev, 0);
1089 + if (!tw_dev->base_addr) {
1090 + printk(KERN_WARNING "3w-xxxx: Failed to get io address.");
1091 ++ retval = -ENOMEM;
1092 + goto out_release_mem_region;
1093 + }
1094 +
1095 +diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
1096 +index b3790334fd3f..f50076d0fb6c 100644
1097 +--- a/drivers/staging/rts5208/rtsx_scsi.c
1098 ++++ b/drivers/staging/rts5208/rtsx_scsi.c
1099 +@@ -536,7 +536,7 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip)
1100 +
1101 + if (sendbytes > 8) {
1102 + memcpy(buf, inquiry_buf, 8);
1103 +- memcpy(buf + 8, inquiry_string, sendbytes - 8);
1104 ++ strncpy(buf + 8, inquiry_string, sendbytes - 8);
1105 + if (pro_formatter_flag) {
1106 + /* Additional Length */
1107 + buf[4] = 0x33;
1108 +diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
1109 +index 1de02bb98839..647f6beb4c65 100644
1110 +--- a/drivers/staging/rts5208/xd.c
1111 ++++ b/drivers/staging/rts5208/xd.c
1112 +@@ -1247,7 +1247,7 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk,
1113 + reg = 0;
1114 + rtsx_read_register(chip, XD_CTL, &reg);
1115 + if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) {
1116 +- wait_timeout(100);
1117 ++ mdelay(100);
1118 +
1119 + if (detect_card_cd(chip,
1120 + XD_CARD) != STATUS_SUCCESS) {
1121 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
1122 +index 6f3eccf986c7..e738b4621cbb 100644
1123 +--- a/drivers/target/target_core_transport.c
1124 ++++ b/drivers/target/target_core_transport.c
1125 +@@ -316,6 +316,7 @@ void __transport_register_session(
1126 + {
1127 + const struct target_core_fabric_ops *tfo = se_tpg->se_tpg_tfo;
1128 + unsigned char buf[PR_REG_ISID_LEN];
1129 ++ unsigned long flags;
1130 +
1131 + se_sess->se_tpg = se_tpg;
1132 + se_sess->fabric_sess_ptr = fabric_sess_ptr;
1133 +@@ -352,7 +353,7 @@ void __transport_register_session(
1134 + se_sess->sess_bin_isid = get_unaligned_be64(&buf[0]);
1135 + }
1136 +
1137 +- spin_lock_irq(&se_nacl->nacl_sess_lock);
1138 ++ spin_lock_irqsave(&se_nacl->nacl_sess_lock, flags);
1139 + /*
1140 + * The se_nacl->nacl_sess pointer will be set to the
1141 + * last active I_T Nexus for each struct se_node_acl.
1142 +@@ -361,7 +362,7 @@ void __transport_register_session(
1143 +
1144 + list_add_tail(&se_sess->sess_acl_list,
1145 + &se_nacl->acl_sess_list);
1146 +- spin_unlock_irq(&se_nacl->nacl_sess_lock);
1147 ++ spin_unlock_irqrestore(&se_nacl->nacl_sess_lock, flags);
1148 + }
1149 + list_add_tail(&se_sess->sess_list, &se_tpg->tpg_sess_list);
1150 +
1151 +diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
1152 +index b0cc47c77b40..e8e8973939d3 100644
1153 +--- a/drivers/tty/rocket.c
1154 ++++ b/drivers/tty/rocket.c
1155 +@@ -1913,7 +1913,7 @@ static __init int register_PCI(int i, struct pci_dev *dev)
1156 + ByteIO_t UPCIRingInd = 0;
1157 +
1158 + if (!dev || !pci_match_id(rocket_pci_ids, dev) ||
1159 +- pci_enable_device(dev))
1160 ++ pci_enable_device(dev) || i >= NUM_BOARDS)
1161 + return 0;
1162 +
1163 + rcktpt_io_addr[i] = pci_resource_start(dev, 0);
1164 +diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
1165 +index 208bc52fc84d..f0a9ea2740df 100644
1166 +--- a/drivers/uio/uio.c
1167 ++++ b/drivers/uio/uio.c
1168 +@@ -841,8 +841,6 @@ int __uio_register_device(struct module *owner,
1169 + if (ret)
1170 + goto err_uio_dev_add_attributes;
1171 +
1172 +- info->uio_dev = idev;
1173 +-
1174 + if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) {
1175 + /*
1176 + * Note that we deliberately don't use devm_request_irq
1177 +@@ -858,6 +856,7 @@ int __uio_register_device(struct module *owner,
1178 + goto err_request_irq;
1179 + }
1180 +
1181 ++ info->uio_dev = idev;
1182 + return 0;
1183 +
1184 + err_request_irq:
1185 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1186 +index c190fabd1875..e9f5f9c32b49 100644
1187 +--- a/drivers/usb/host/xhci.c
1188 ++++ b/drivers/usb/host/xhci.c
1189 +@@ -3656,6 +3656,9 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
1190 + }
1191 +
1192 + spin_lock_irqsave(&xhci->lock, flags);
1193 ++
1194 ++ virt_dev->udev = NULL;
1195 ++
1196 + /* Don't disable the slot if the host controller is dead. */
1197 + state = readl(&xhci->op_regs->status);
1198 + if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) ||
1199 +diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
1200 +index a1fba4285277..42f863346409 100644
1201 +--- a/fs/autofs4/autofs_i.h
1202 ++++ b/fs/autofs4/autofs_i.h
1203 +@@ -14,6 +14,7 @@
1204 + #include <linux/mutex.h>
1205 + #include <linux/spinlock.h>
1206 + #include <linux/list.h>
1207 ++#include <linux/magic.h>
1208 +
1209 + /* This is the range of ioctl() numbers we claim as ours */
1210 + #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
1211 +@@ -123,7 +124,8 @@ struct autofs_sb_info {
1212 +
1213 + static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
1214 + {
1215 +- return (struct autofs_sb_info *)(sb->s_fs_info);
1216 ++ return sb->s_magic != AUTOFS_SUPER_MAGIC ?
1217 ++ NULL : (struct autofs_sb_info *)(sb->s_fs_info);
1218 + }
1219 +
1220 + static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry)
1221 +diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
1222 +index 438b5bf675b6..ce0c6ea96a87 100644
1223 +--- a/fs/autofs4/inode.c
1224 ++++ b/fs/autofs4/inode.c
1225 +@@ -14,7 +14,6 @@
1226 + #include <linux/pagemap.h>
1227 + #include <linux/parser.h>
1228 + #include <linux/bitops.h>
1229 +-#include <linux/magic.h>
1230 + #include "autofs_i.h"
1231 + #include <linux/module.h>
1232 +
1233 +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
1234 +index 7d0e8d6bf009..594e6e20d6dd 100644
1235 +--- a/fs/f2fs/file.c
1236 ++++ b/fs/f2fs/file.c
1237 +@@ -1665,7 +1665,7 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
1238 + struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
1239 + struct super_block *sb = sbi->sb;
1240 + __u32 in;
1241 +- int ret;
1242 ++ int ret = 0;
1243 +
1244 + if (!capable(CAP_SYS_ADMIN))
1245 + return -EPERM;
1246 +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
1247 +index ad4dfd29d923..759056e776e5 100644
1248 +--- a/fs/f2fs/gc.c
1249 ++++ b/fs/f2fs/gc.c
1250 +@@ -877,7 +877,13 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
1251 + goto next;
1252 +
1253 + sum = page_address(sum_page);
1254 +- f2fs_bug_on(sbi, type != GET_SUM_TYPE((&sum->footer)));
1255 ++ if (type != GET_SUM_TYPE((&sum->footer))) {
1256 ++ f2fs_msg(sbi->sb, KERN_ERR, "Inconsistent segment (%u) "
1257 ++ "type [%d, %d] in SSA and SIT",
1258 ++ segno, type, GET_SUM_TYPE((&sum->footer)));
1259 ++ set_sbi_flag(sbi, SBI_NEED_FSCK);
1260 ++ goto next;
1261 ++ }
1262 +
1263 + /*
1264 + * this is to avoid deadlock:
1265 +diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
1266 +index a21faa1c6817..482888ee8942 100644
1267 +--- a/fs/f2fs/inline.c
1268 ++++ b/fs/f2fs/inline.c
1269 +@@ -124,6 +124,16 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
1270 + if (err)
1271 + return err;
1272 +
1273 ++ if (unlikely(dn->data_blkaddr != NEW_ADDR)) {
1274 ++ f2fs_put_dnode(dn);
1275 ++ set_sbi_flag(fio.sbi, SBI_NEED_FSCK);
1276 ++ f2fs_msg(fio.sbi->sb, KERN_WARNING,
1277 ++ "%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, "
1278 ++ "run fsck to fix.",
1279 ++ __func__, dn->inode->i_ino, dn->data_blkaddr);
1280 ++ return -EINVAL;
1281 ++ }
1282 ++
1283 + f2fs_bug_on(F2FS_P_SB(page), PageWriteback(page));
1284 +
1285 + read_inline_data(page, dn->inode_page);
1286 +@@ -351,6 +361,17 @@ static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage,
1287 + if (err)
1288 + goto out;
1289 +
1290 ++ if (unlikely(dn.data_blkaddr != NEW_ADDR)) {
1291 ++ f2fs_put_dnode(&dn);
1292 ++ set_sbi_flag(F2FS_P_SB(page), SBI_NEED_FSCK);
1293 ++ f2fs_msg(F2FS_P_SB(page)->sb, KERN_WARNING,
1294 ++ "%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, "
1295 ++ "run fsck to fix.",
1296 ++ __func__, dir->i_ino, dn.data_blkaddr);
1297 ++ err = -EINVAL;
1298 ++ goto out;
1299 ++ }
1300 ++
1301 + f2fs_wait_on_page_writeback(page, DATA, true);
1302 + zero_user_segment(page, MAX_INLINE_DATA, PAGE_SIZE);
1303 +
1304 +diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
1305 +index 01177ecdeab8..addff6a3b176 100644
1306 +--- a/fs/f2fs/node.c
1307 ++++ b/fs/f2fs/node.c
1308 +@@ -1463,7 +1463,9 @@ next_step:
1309 + !is_cold_node(page)))
1310 + continue;
1311 + lock_node:
1312 +- if (!trylock_page(page))
1313 ++ if (wbc->sync_mode == WB_SYNC_ALL)
1314 ++ lock_page(page);
1315 ++ else if (!trylock_page(page))
1316 + continue;
1317 +
1318 + if (unlikely(page->mapping != NODE_MAPPING(sbi))) {
1319 +diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
1320 +index b164f8339281..3d9b9e98c4c2 100644
1321 +--- a/fs/f2fs/segment.h
1322 ++++ b/fs/f2fs/segment.h
1323 +@@ -386,6 +386,8 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
1324 + if (test_and_clear_bit(segno, free_i->free_segmap)) {
1325 + free_i->free_segments++;
1326 +
1327 ++ if (IS_CURSEC(sbi, secno))
1328 ++ goto skip_free;
1329 + next = find_next_bit(free_i->free_segmap,
1330 + start_segno + sbi->segs_per_sec, start_segno);
1331 + if (next >= start_segno + sbi->segs_per_sec) {
1332 +@@ -393,6 +395,7 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
1333 + free_i->free_sections++;
1334 + }
1335 + }
1336 ++skip_free:
1337 + spin_unlock(&free_i->segmap_lock);
1338 + }
1339 +
1340 +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
1341 +index e627671f0183..91bf72334722 100644
1342 +--- a/fs/f2fs/super.c
1343 ++++ b/fs/f2fs/super.c
1344 +@@ -1425,12 +1425,17 @@ int sanity_check_ckpt(struct f2fs_sb_info *sbi)
1345 + struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
1346 + struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
1347 + unsigned int main_segs, blocks_per_seg;
1348 ++ unsigned int sit_segs, nat_segs;
1349 ++ unsigned int sit_bitmap_size, nat_bitmap_size;
1350 ++ unsigned int log_blocks_per_seg;
1351 + int i;
1352 +
1353 + total = le32_to_cpu(raw_super->segment_count);
1354 + fsmeta = le32_to_cpu(raw_super->segment_count_ckpt);
1355 +- fsmeta += le32_to_cpu(raw_super->segment_count_sit);
1356 +- fsmeta += le32_to_cpu(raw_super->segment_count_nat);
1357 ++ sit_segs = le32_to_cpu(raw_super->segment_count_sit);
1358 ++ fsmeta += sit_segs;
1359 ++ nat_segs = le32_to_cpu(raw_super->segment_count_nat);
1360 ++ fsmeta += nat_segs;
1361 + fsmeta += le32_to_cpu(ckpt->rsvd_segment_count);
1362 + fsmeta += le32_to_cpu(raw_super->segment_count_ssa);
1363 +
1364 +@@ -1451,6 +1456,18 @@ int sanity_check_ckpt(struct f2fs_sb_info *sbi)
1365 + return 1;
1366 + }
1367 +
1368 ++ sit_bitmap_size = le32_to_cpu(ckpt->sit_ver_bitmap_bytesize);
1369 ++ nat_bitmap_size = le32_to_cpu(ckpt->nat_ver_bitmap_bytesize);
1370 ++ log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg);
1371 ++
1372 ++ if (sit_bitmap_size != ((sit_segs / 2) << log_blocks_per_seg) / 8 ||
1373 ++ nat_bitmap_size != ((nat_segs / 2) << log_blocks_per_seg) / 8) {
1374 ++ f2fs_msg(sbi->sb, KERN_ERR,
1375 ++ "Wrong bitmap size: sit: %u, nat:%u",
1376 ++ sit_bitmap_size, nat_bitmap_size);
1377 ++ return 1;
1378 ++ }
1379 ++
1380 + if (unlikely(f2fs_cp_error(sbi))) {
1381 + f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck");
1382 + return 1;
1383 +diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
1384 +index 2e7ebd9d7168..9d7537446260 100644
1385 +--- a/fs/nfs/callback_proc.c
1386 ++++ b/fs/nfs/callback_proc.c
1387 +@@ -175,9 +175,9 @@ static u32 pnfs_check_callback_stateid(struct pnfs_layout_hdr *lo,
1388 + {
1389 + u32 oldseq, newseq;
1390 +
1391 +- /* Is the stateid still not initialised? */
1392 ++ /* Is the stateid not initialised? */
1393 + if (!pnfs_layout_is_valid(lo))
1394 +- return NFS4ERR_DELAY;
1395 ++ return NFS4ERR_NOMATCHING_LAYOUT;
1396 +
1397 + /* Mismatched stateid? */
1398 + if (!nfs4_stateid_match_other(&lo->plh_stateid, new))
1399 +diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
1400 +index eb094c6011d8..67903eeb2ca4 100644
1401 +--- a/fs/nfs/callback_xdr.c
1402 ++++ b/fs/nfs/callback_xdr.c
1403 +@@ -968,16 +968,21 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
1404 +
1405 + if (hdr_arg.minorversion == 0) {
1406 + cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
1407 +- if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
1408 ++ if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp)) {
1409 ++ if (cps.clp)
1410 ++ nfs_put_client(cps.clp);
1411 + goto out_invalidcred;
1412 ++ }
1413 + }
1414 +
1415 + cps.minorversion = hdr_arg.minorversion;
1416 + hdr_res.taglen = hdr_arg.taglen;
1417 + hdr_res.tag = hdr_arg.tag;
1418 +- if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0)
1419 ++ if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0) {
1420 ++ if (cps.clp)
1421 ++ nfs_put_client(cps.clp);
1422 + return rpc_system_err;
1423 +-
1424 ++ }
1425 + while (status == 0 && nops != hdr_arg.nops) {
1426 + status = process_op(nops, rqstp, &xdr_in,
1427 + argp, &xdr_out, resp, &cps);
1428 +diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
1429 +index e8471c2ca83a..8d6decd50220 100644
1430 +--- a/include/linux/mm_types.h
1431 ++++ b/include/linux/mm_types.h
1432 +@@ -396,7 +396,7 @@ struct kioctx_table;
1433 + struct mm_struct {
1434 + struct vm_area_struct *mmap; /* list of VMAs */
1435 + struct rb_root mm_rb;
1436 +- u32 vmacache_seqnum; /* per-thread vmacache */
1437 ++ u64 vmacache_seqnum; /* per-thread vmacache */
1438 + #ifdef CONFIG_MMU
1439 + unsigned long (*get_unmapped_area) (struct file *filp,
1440 + unsigned long addr, unsigned long len,
1441 +diff --git a/include/linux/sched.h b/include/linux/sched.h
1442 +index 1cc5723a7821..f4a551a5482c 100644
1443 +--- a/include/linux/sched.h
1444 ++++ b/include/linux/sched.h
1445 +@@ -1559,7 +1559,7 @@ struct task_struct {
1446 +
1447 + struct mm_struct *mm, *active_mm;
1448 + /* per-thread vma caching */
1449 +- u32 vmacache_seqnum;
1450 ++ u64 vmacache_seqnum;
1451 + struct vm_area_struct *vmacache[VMACACHE_SIZE];
1452 + #if defined(SPLIT_RSS_COUNTING)
1453 + struct task_rss_stat rss_stat;
1454 +diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
1455 +index 2edb150f1a4d..544cd50fbbd0 100644
1456 +--- a/include/linux/vm_event_item.h
1457 ++++ b/include/linux/vm_event_item.h
1458 +@@ -97,7 +97,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
1459 + #ifdef CONFIG_DEBUG_VM_VMACACHE
1460 + VMACACHE_FIND_CALLS,
1461 + VMACACHE_FIND_HITS,
1462 +- VMACACHE_FULL_FLUSHES,
1463 + #endif
1464 + NR_VM_EVENT_ITEMS
1465 + };
1466 +diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h
1467 +index c3fa0fd43949..4f58ff2dacd6 100644
1468 +--- a/include/linux/vmacache.h
1469 ++++ b/include/linux/vmacache.h
1470 +@@ -15,7 +15,6 @@ static inline void vmacache_flush(struct task_struct *tsk)
1471 + memset(tsk->vmacache, 0, sizeof(tsk->vmacache));
1472 + }
1473 +
1474 +-extern void vmacache_flush_all(struct mm_struct *mm);
1475 + extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma);
1476 + extern struct vm_area_struct *vmacache_find(struct mm_struct *mm,
1477 + unsigned long addr);
1478 +@@ -29,10 +28,6 @@ extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm,
1479 + static inline void vmacache_invalidate(struct mm_struct *mm)
1480 + {
1481 + mm->vmacache_seqnum++;
1482 +-
1483 +- /* deal with overflows */
1484 +- if (unlikely(mm->vmacache_seqnum == 0))
1485 +- vmacache_flush_all(mm);
1486 + }
1487 +
1488 + #endif /* __LINUX_VMACACHE_H */
1489 +diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
1490 +index 5c22e8cab24b..8c5335bde212 100644
1491 +--- a/include/uapi/linux/ethtool.h
1492 ++++ b/include/uapi/linux/ethtool.h
1493 +@@ -882,13 +882,13 @@ struct ethtool_rx_flow_spec {
1494 + static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
1495 + {
1496 + return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
1497 +-};
1498 ++}
1499 +
1500 + static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
1501 + {
1502 + return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
1503 + ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
1504 +-};
1505 ++}
1506 +
1507 + /**
1508 + * struct ethtool_rxnfc - command to get or set RX flow classification rules
1509 +diff --git a/kernel/fork.c b/kernel/fork.c
1510 +index 5d0e2f366766..73beb8dfa9df 100644
1511 +--- a/kernel/fork.c
1512 ++++ b/kernel/fork.c
1513 +@@ -1532,6 +1532,18 @@ static __latent_entropy struct task_struct *copy_process(
1514 + if (!p)
1515 + goto fork_out;
1516 +
1517 ++ /*
1518 ++ * This _must_ happen before we call free_task(), i.e. before we jump
1519 ++ * to any of the bad_fork_* labels. This is to avoid freeing
1520 ++ * p->set_child_tid which is (ab)used as a kthread's data pointer for
1521 ++ * kernel threads (PF_KTHREAD).
1522 ++ */
1523 ++ p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1524 ++ /*
1525 ++ * Clear TID on mm_release()?
1526 ++ */
1527 ++ p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
1528 ++
1529 + ftrace_graph_init_task(p);
1530 +
1531 + rt_mutex_init_task(p);
1532 +@@ -1693,11 +1705,6 @@ static __latent_entropy struct task_struct *copy_process(
1533 + }
1534 + }
1535 +
1536 +- p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1537 +- /*
1538 +- * Clear TID on mm_release()?
1539 +- */
1540 +- p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
1541 + #ifdef CONFIG_BLOCK
1542 + p->plug = NULL;
1543 + #endif
1544 +diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
1545 +index 05a37857ab55..8d7047ecef4e 100644
1546 +--- a/kernel/locking/osq_lock.c
1547 ++++ b/kernel/locking/osq_lock.c
1548 +@@ -104,6 +104,19 @@ bool osq_lock(struct optimistic_spin_queue *lock)
1549 +
1550 + prev = decode_cpu(old);
1551 + node->prev = prev;
1552 ++
1553 ++ /*
1554 ++ * osq_lock() unqueue
1555 ++ *
1556 ++ * node->prev = prev osq_wait_next()
1557 ++ * WMB MB
1558 ++ * prev->next = node next->prev = prev // unqueue-C
1559 ++ *
1560 ++ * Here 'node->prev' and 'next->prev' are the same variable and we need
1561 ++ * to ensure these stores happen in-order to avoid corrupting the list.
1562 ++ */
1563 ++ smp_wmb();
1564 ++
1565 + WRITE_ONCE(prev->next, node);
1566 +
1567 + /*
1568 +diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
1569 +index 2337b4bb2366..a4112dfcd0fb 100644
1570 +--- a/kernel/locking/rwsem-xadd.c
1571 ++++ b/kernel/locking/rwsem-xadd.c
1572 +@@ -573,6 +573,33 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
1573 + unsigned long flags;
1574 + WAKE_Q(wake_q);
1575 +
1576 ++ /*
1577 ++ * __rwsem_down_write_failed_common(sem)
1578 ++ * rwsem_optimistic_spin(sem)
1579 ++ * osq_unlock(sem->osq)
1580 ++ * ...
1581 ++ * atomic_long_add_return(&sem->count)
1582 ++ *
1583 ++ * - VS -
1584 ++ *
1585 ++ * __up_write()
1586 ++ * if (atomic_long_sub_return_release(&sem->count) < 0)
1587 ++ * rwsem_wake(sem)
1588 ++ * osq_is_locked(&sem->osq)
1589 ++ *
1590 ++ * And __up_write() must observe !osq_is_locked() when it observes the
1591 ++ * atomic_long_add_return() in order to not miss a wakeup.
1592 ++ *
1593 ++ * This boils down to:
1594 ++ *
1595 ++ * [S.rel] X = 1 [RmW] r0 = (Y += 0)
1596 ++ * MB RMB
1597 ++ * [RmW] Y += 1 [L] r1 = X
1598 ++ *
1599 ++ * exists (r0=1 /\ r1=0)
1600 ++ */
1601 ++ smp_rmb();
1602 ++
1603 + /*
1604 + * If a spinner is present, it is not necessary to do the wakeup.
1605 + * Try to do wakeup only if the trylock succeeds to minimize
1606 +diff --git a/kernel/time/timer.c b/kernel/time/timer.c
1607 +index 7c477912f36d..b625cc7fcc1c 100644
1608 +--- a/kernel/time/timer.c
1609 ++++ b/kernel/time/timer.c
1610 +@@ -1649,6 +1649,22 @@ static inline void __run_timers(struct timer_base *base)
1611 +
1612 + spin_lock_irq(&base->lock);
1613 +
1614 ++ /*
1615 ++ * timer_base::must_forward_clk must be cleared before running
1616 ++ * timers so that any timer functions that call mod_timer() will
1617 ++ * not try to forward the base. Idle tracking / clock forwarding
1618 ++ * logic is only used with BASE_STD timers.
1619 ++ *
1620 ++ * The must_forward_clk flag is cleared unconditionally also for
1621 ++ * the deferrable base. The deferrable base is not affected by idle
1622 ++ * tracking and never forwarded, so clearing the flag is a NOOP.
1623 ++ *
1624 ++ * The fact that the deferrable base is never forwarded can cause
1625 ++ * large variations in granularity for deferrable timers, but they
1626 ++ * can be deferred for long periods due to idle anyway.
1627 ++ */
1628 ++ base->must_forward_clk = false;
1629 ++
1630 + while (time_after_eq(jiffies, base->clk)) {
1631 +
1632 + levels = collect_expired_timers(base, heads);
1633 +@@ -1668,19 +1684,6 @@ static __latent_entropy void run_timer_softirq(struct softirq_action *h)
1634 + {
1635 + struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
1636 +
1637 +- /*
1638 +- * must_forward_clk must be cleared before running timers so that any
1639 +- * timer functions that call mod_timer will not try to forward the
1640 +- * base. idle trcking / clock forwarding logic is only used with
1641 +- * BASE_STD timers.
1642 +- *
1643 +- * The deferrable base does not do idle tracking at all, so we do
1644 +- * not forward it. This can result in very large variations in
1645 +- * granularity for deferrable timers, but they can be deferred for
1646 +- * long periods due to idle.
1647 +- */
1648 +- base->must_forward_clk = false;
1649 +-
1650 + __run_timers(base);
1651 + if (IS_ENABLED(CONFIG_NO_HZ_COMMON))
1652 + __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF]));
1653 +diff --git a/mm/debug.c b/mm/debug.c
1654 +index 9feb699c5d25..bebe48aece6d 100644
1655 +--- a/mm/debug.c
1656 ++++ b/mm/debug.c
1657 +@@ -95,7 +95,7 @@ EXPORT_SYMBOL(dump_vma);
1658 +
1659 + void dump_mm(const struct mm_struct *mm)
1660 + {
1661 +- pr_emerg("mm %p mmap %p seqnum %d task_size %lu\n"
1662 ++ pr_emerg("mm %p mmap %p seqnum %llu task_size %lu\n"
1663 + #ifdef CONFIG_MMU
1664 + "get_unmapped_area %p\n"
1665 + #endif
1666 +@@ -125,7 +125,7 @@ void dump_mm(const struct mm_struct *mm)
1667 + #endif
1668 + "def_flags: %#lx(%pGv)\n",
1669 +
1670 +- mm, mm->mmap, mm->vmacache_seqnum, mm->task_size,
1671 ++ mm, mm->mmap, (long long) mm->vmacache_seqnum, mm->task_size,
1672 + #ifdef CONFIG_MMU
1673 + mm->get_unmapped_area,
1674 + #endif
1675 +diff --git a/mm/vmacache.c b/mm/vmacache.c
1676 +index 035fdeb35b43..c9ca3dd46b97 100644
1677 +--- a/mm/vmacache.c
1678 ++++ b/mm/vmacache.c
1679 +@@ -5,44 +5,6 @@
1680 + #include <linux/mm.h>
1681 + #include <linux/vmacache.h>
1682 +
1683 +-/*
1684 +- * Flush vma caches for threads that share a given mm.
1685 +- *
1686 +- * The operation is safe because the caller holds the mmap_sem
1687 +- * exclusively and other threads accessing the vma cache will
1688 +- * have mmap_sem held at least for read, so no extra locking
1689 +- * is required to maintain the vma cache.
1690 +- */
1691 +-void vmacache_flush_all(struct mm_struct *mm)
1692 +-{
1693 +- struct task_struct *g, *p;
1694 +-
1695 +- count_vm_vmacache_event(VMACACHE_FULL_FLUSHES);
1696 +-
1697 +- /*
1698 +- * Single threaded tasks need not iterate the entire
1699 +- * list of process. We can avoid the flushing as well
1700 +- * since the mm's seqnum was increased and don't have
1701 +- * to worry about other threads' seqnum. Current's
1702 +- * flush will occur upon the next lookup.
1703 +- */
1704 +- if (atomic_read(&mm->mm_users) == 1)
1705 +- return;
1706 +-
1707 +- rcu_read_lock();
1708 +- for_each_process_thread(g, p) {
1709 +- /*
1710 +- * Only flush the vmacache pointers as the
1711 +- * mm seqnum is already set and curr's will
1712 +- * be set upon invalidation when the next
1713 +- * lookup is done.
1714 +- */
1715 +- if (mm == p->mm)
1716 +- vmacache_flush(p);
1717 +- }
1718 +- rcu_read_unlock();
1719 +-}
1720 +-
1721 + /*
1722 + * This task may be accessing a foreign mm via (for example)
1723 + * get_user_pages()->find_vma(). The vmacache is task-local and this
1724 +diff --git a/mm/vmscan.c b/mm/vmscan.c
1725 +index f03ca5ab86b1..4e5846b8b5eb 100644
1726 +--- a/mm/vmscan.c
1727 ++++ b/mm/vmscan.c
1728 +@@ -3123,6 +3123,7 @@ static bool zone_balanced(struct zone *zone, int order, int classzone_idx)
1729 + */
1730 + clear_bit(PGDAT_CONGESTED, &zone->zone_pgdat->flags);
1731 + clear_bit(PGDAT_DIRTY, &zone->zone_pgdat->flags);
1732 ++ clear_bit(PGDAT_WRITEBACK, &zone->zone_pgdat->flags);
1733 +
1734 + return true;
1735 + }
1736 +@@ -3300,7 +3301,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx)
1737 + * If we're getting trouble reclaiming, start doing writepage
1738 + * even in laptop mode.
1739 + */
1740 +- if (sc.priority < DEF_PRIORITY - 2 || !pgdat_reclaimable(pgdat))
1741 ++ if (sc.priority < DEF_PRIORITY - 2)
1742 + sc.may_writepage = 1;
1743 +
1744 + /* Call soft limit reclaim before calling shrink_node. */
1745 +diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
1746 +index 1811f8e7ddf4..552e00b07196 100644
1747 +--- a/net/bluetooth/hidp/core.c
1748 ++++ b/net/bluetooth/hidp/core.c
1749 +@@ -774,7 +774,7 @@ static int hidp_setup_hid(struct hidp_session *session,
1750 + hid->version = req->version;
1751 + hid->country = req->country;
1752 +
1753 +- strncpy(hid->name, req->name, sizeof(req->name) - 1);
1754 ++ strncpy(hid->name, req->name, sizeof(hid->name));
1755 +
1756 + snprintf(hid->phys, sizeof(hid->phys), "%pMR",
1757 + &l2cap_pi(session->ctrl_sock->sk)->chan->src);
1758 +diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
1759 +index 3202d75329b5..a1116701287f 100644
1760 +--- a/net/dcb/dcbnl.c
1761 ++++ b/net/dcb/dcbnl.c
1762 +@@ -1764,7 +1764,7 @@ static struct dcb_app_type *dcb_app_lookup(const struct dcb_app *app,
1763 + if (itr->app.selector == app->selector &&
1764 + itr->app.protocol == app->protocol &&
1765 + itr->ifindex == ifindex &&
1766 +- (!prio || itr->app.priority == prio))
1767 ++ ((prio == -1) || itr->app.priority == prio))
1768 + return itr;
1769 + }
1770 +
1771 +@@ -1799,7 +1799,8 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)
1772 + u8 prio = 0;
1773 +
1774 + spin_lock_bh(&dcb_lock);
1775 +- if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
1776 ++ itr = dcb_app_lookup(app, dev->ifindex, -1);
1777 ++ if (itr)
1778 + prio = itr->app.priority;
1779 + spin_unlock_bh(&dcb_lock);
1780 +
1781 +@@ -1827,7 +1828,8 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
1782 +
1783 + spin_lock_bh(&dcb_lock);
1784 + /* Search for existing match and replace */
1785 +- if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) {
1786 ++ itr = dcb_app_lookup(new, dev->ifindex, -1);
1787 ++ if (itr) {
1788 + if (new->priority)
1789 + itr->app.priority = new->priority;
1790 + else {
1791 +@@ -1860,7 +1862,8 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app)
1792 + u8 prio = 0;
1793 +
1794 + spin_lock_bh(&dcb_lock);
1795 +- if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
1796 ++ itr = dcb_app_lookup(app, dev->ifindex, -1);
1797 ++ if (itr)
1798 + prio |= 1 << itr->app.priority;
1799 + spin_unlock_bh(&dcb_lock);
1800 +
1801 +diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
1802 +index 59be89813a29..751fec729ffb 100644
1803 +--- a/net/netfilter/x_tables.c
1804 ++++ b/net/netfilter/x_tables.c
1805 +@@ -877,7 +877,7 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
1806 + if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0)
1807 + return ERR_PTR(-EFAULT);
1808 +
1809 +- strlcpy(info->name, compat_tmp.name, sizeof(info->name));
1810 ++ memcpy(info->name, compat_tmp.name, sizeof(info->name) - 1);
1811 + info->num_counters = compat_tmp.num_counters;
1812 + user += sizeof(compat_tmp);
1813 + } else
1814 +@@ -890,9 +890,9 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
1815 + if (copy_from_user(info, user, sizeof(*info)) != 0)
1816 + return ERR_PTR(-EFAULT);
1817 +
1818 +- info->name[sizeof(info->name) - 1] = '\0';
1819 + user += sizeof(*info);
1820 + }
1821 ++ info->name[sizeof(info->name) - 1] = '\0';
1822 +
1823 + size = sizeof(struct xt_counters);
1824 + size *= info->num_counters;
1825 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
1826 +index 146d83785b37..6afac189d20f 100644
1827 +--- a/net/wireless/nl80211.c
1828 ++++ b/net/wireless/nl80211.c
1829 +@@ -9481,6 +9481,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
1830 + if (err)
1831 + return err;
1832 +
1833 ++ if (!setup.chandef.chan)
1834 ++ return -EINVAL;
1835 ++
1836 + err = validate_beacon_tx_rate(rdev, setup.chandef.chan->band,
1837 + &setup.beacon_rate);
1838 + if (err)
1839 +diff --git a/security/selinux/avc.c b/security/selinux/avc.c
1840 +index e60c79de13e1..52f3c550abcc 100644
1841 +--- a/security/selinux/avc.c
1842 ++++ b/security/selinux/avc.c
1843 +@@ -348,27 +348,26 @@ static struct avc_xperms_decision_node
1844 + struct avc_xperms_decision_node *xpd_node;
1845 + struct extended_perms_decision *xpd;
1846 +
1847 +- xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep,
1848 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1849 ++ xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep, GFP_NOWAIT);
1850 + if (!xpd_node)
1851 + return NULL;
1852 +
1853 + xpd = &xpd_node->xpd;
1854 + if (which & XPERMS_ALLOWED) {
1855 + xpd->allowed = kmem_cache_zalloc(avc_xperms_data_cachep,
1856 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1857 ++ GFP_NOWAIT);
1858 + if (!xpd->allowed)
1859 + goto error;
1860 + }
1861 + if (which & XPERMS_AUDITALLOW) {
1862 + xpd->auditallow = kmem_cache_zalloc(avc_xperms_data_cachep,
1863 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1864 ++ GFP_NOWAIT);
1865 + if (!xpd->auditallow)
1866 + goto error;
1867 + }
1868 + if (which & XPERMS_DONTAUDIT) {
1869 + xpd->dontaudit = kmem_cache_zalloc(avc_xperms_data_cachep,
1870 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1871 ++ GFP_NOWAIT);
1872 + if (!xpd->dontaudit)
1873 + goto error;
1874 + }
1875 +@@ -396,8 +395,7 @@ static struct avc_xperms_node *avc_xperms_alloc(void)
1876 + {
1877 + struct avc_xperms_node *xp_node;
1878 +
1879 +- xp_node = kmem_cache_zalloc(avc_xperms_cachep,
1880 +- GFP_ATOMIC|__GFP_NOMEMALLOC);
1881 ++ xp_node = kmem_cache_zalloc(avc_xperms_cachep, GFP_NOWAIT);
1882 + if (!xp_node)
1883 + return xp_node;
1884 + INIT_LIST_HEAD(&xp_node->xpd_head);
1885 +@@ -550,7 +548,7 @@ static struct avc_node *avc_alloc_node(void)
1886 + {
1887 + struct avc_node *node;
1888 +
1889 +- node = kmem_cache_zalloc(avc_node_cachep, GFP_ATOMIC|__GFP_NOMEMALLOC);
1890 ++ node = kmem_cache_zalloc(avc_node_cachep, GFP_NOWAIT);
1891 + if (!node)
1892 + goto out;
1893 +
1894 +diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
1895 +index e46c561a8c90..c6b046ddefdd 100644
1896 +--- a/sound/pci/hda/hda_codec.c
1897 ++++ b/sound/pci/hda/hda_codec.c
1898 +@@ -4025,7 +4025,8 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus)
1899 +
1900 + list_for_each_codec(codec, bus) {
1901 + /* FIXME: maybe a better way needed for forced reset */
1902 +- cancel_delayed_work_sync(&codec->jackpoll_work);
1903 ++ if (current_work() != &codec->jackpoll_work.work)
1904 ++ cancel_delayed_work_sync(&codec->jackpoll_work);
1905 + #ifdef CONFIG_PM
1906 + if (hda_codec_is_power_on(codec)) {
1907 + hda_call_codec_suspend(codec);
1908 +diff --git a/tools/perf/perf.h b/tools/perf/perf.h
1909 +index 9a0236a4cf95..8f8d895d5b74 100644
1910 +--- a/tools/perf/perf.h
1911 ++++ b/tools/perf/perf.h
1912 +@@ -22,7 +22,9 @@ static inline unsigned long long rdclock(void)
1913 + return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
1914 + }
1915 +
1916 ++#ifndef MAX_NR_CPUS
1917 + #define MAX_NR_CPUS 1024
1918 ++#endif
1919 +
1920 + extern const char *input_name;
1921 + extern bool perf_host, perf_guest;