Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.12 commit in: /
Date: Fri, 01 Aug 2014 23:59:30
Message-Id: 1406937556.e1f77829bd6587aaa9afefb2c81e68fd51ff66c2.mpagano@gentoo
1 commit: e1f77829bd6587aaa9afefb2c81e68fd51ff66c2
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 1 23:59:16 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 1 23:59:16 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=e1f77829
7
8 Linux patch 3.12.26
9
10 ---
11 0000_README | 4 +
12 1025_linux-3.12.26.patch | 3381 ++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 3385 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index 76b0ed4..4b58868 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -142,6 +142,10 @@ Patch: 1024_linux-3.12.25.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.12.25
22
23 +Patch: 1025_linux-3.12.26.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.12.26
26 +
27 Patch: 1500_XATTR_USER_PREFIX.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
29 Desc: Support for namespace user.pax.* on tmpfs.
30
31 diff --git a/1025_linux-3.12.26.patch b/1025_linux-3.12.26.patch
32 new file mode 100644
33 index 0000000..4385766
34 --- /dev/null
35 +++ b/1025_linux-3.12.26.patch
36 @@ -0,0 +1,3381 @@
37 +diff --git a/Makefile b/Makefile
38 +index 4d25b56bf81c..647d87ac4a15 100644
39 +--- a/Makefile
40 ++++ b/Makefile
41 +@@ -1,6 +1,6 @@
42 + VERSION = 3
43 + PATCHLEVEL = 12
44 +-SUBLEVEL = 25
45 ++SUBLEVEL = 26
46 + EXTRAVERSION =
47 + NAME = One Giant Leap for Frogkind
48 +
49 +@@ -614,6 +614,8 @@ KBUILD_CFLAGS += -fomit-frame-pointer
50 + endif
51 + endif
52 +
53 ++KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
54 ++
55 + ifdef CONFIG_DEBUG_INFO
56 + KBUILD_CFLAGS += -g
57 + KBUILD_AFLAGS += -gdwarf-2
58 +diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h
59 +index 2618cc13ba75..76a7739aab1c 100644
60 +--- a/arch/arc/include/uapi/asm/ptrace.h
61 ++++ b/arch/arc/include/uapi/asm/ptrace.h
62 +@@ -11,6 +11,7 @@
63 + #ifndef _UAPI__ASM_ARC_PTRACE_H
64 + #define _UAPI__ASM_ARC_PTRACE_H
65 +
66 ++#define PTRACE_GET_THREAD_AREA 25
67 +
68 + #ifndef __ASSEMBLY__
69 + /*
70 +diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
71 +index 5d76706139dd..13b3ffb27a38 100644
72 +--- a/arch/arc/kernel/ptrace.c
73 ++++ b/arch/arc/kernel/ptrace.c
74 +@@ -146,6 +146,10 @@ long arch_ptrace(struct task_struct *child, long request,
75 + pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data);
76 +
77 + switch (request) {
78 ++ case PTRACE_GET_THREAD_AREA:
79 ++ ret = put_user(task_thread_info(child)->thr_ptr,
80 ++ (unsigned long __user *)data);
81 ++ break;
82 + default:
83 + ret = ptrace_request(child, request, addr, data);
84 + break;
85 +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
86 +index e47fcd1e9645..99e1ce978cf9 100644
87 +--- a/arch/arm/Kconfig
88 ++++ b/arch/arm/Kconfig
89 +@@ -5,6 +5,7 @@ config ARM
90 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
91 + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
92 + select ARCH_HAVE_CUSTOM_GPIO_H
93 ++ select ARCH_SUPPORTS_ATOMIC_RMW
94 + select ARCH_WANT_IPC_PARSE_VERSION
95 + select BUILDTIME_EXTABLE_SORT if MMU
96 + select CLONE_BACKWARDS
97 +diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
98 +index 737ed5da8f71..de1611966d8b 100644
99 +--- a/arch/arm/boot/dts/imx25.dtsi
100 ++++ b/arch/arm/boot/dts/imx25.dtsi
101 +@@ -30,6 +30,7 @@
102 + spi2 = &spi3;
103 + usb0 = &usbotg;
104 + usb1 = &usbhost1;
105 ++ ethernet0 = &fec;
106 + };
107 +
108 + cpus {
109 +diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
110 +index b7a1c6d950b9..c07aea4f66cb 100644
111 +--- a/arch/arm/boot/dts/imx27.dtsi
112 ++++ b/arch/arm/boot/dts/imx27.dtsi
113 +@@ -30,6 +30,7 @@
114 + spi0 = &cspi1;
115 + spi1 = &cspi2;
116 + spi2 = &cspi3;
117 ++ ethernet0 = &fec;
118 + };
119 +
120 + aitc: aitc-interrupt-controller@e0000000 {
121 +diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
122 +index 54cee6517902..6d2a5343691f 100644
123 +--- a/arch/arm/boot/dts/imx51.dtsi
124 ++++ b/arch/arm/boot/dts/imx51.dtsi
125 +@@ -27,6 +27,7 @@
126 + spi0 = &ecspi1;
127 + spi1 = &ecspi2;
128 + spi2 = &cspi;
129 ++ ethernet0 = &fec;
130 + };
131 +
132 + tzic: tz-interrupt-controller@e0000000 {
133 +diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
134 +index dc72353de0b3..50eda500f39a 100644
135 +--- a/arch/arm/boot/dts/imx53.dtsi
136 ++++ b/arch/arm/boot/dts/imx53.dtsi
137 +@@ -33,6 +33,7 @@
138 + spi0 = &ecspi1;
139 + spi1 = &ecspi2;
140 + spi2 = &cspi;
141 ++ ethernet0 = &fec;
142 + };
143 +
144 + cpus {
145 +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
146 +index c04454876bcb..fe70eaea0e28 100644
147 +--- a/arch/arm64/Kconfig
148 ++++ b/arch/arm64/Kconfig
149 +@@ -1,6 +1,7 @@
150 + config ARM64
151 + def_bool y
152 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
153 ++ select ARCH_SUPPORTS_ATOMIC_RMW
154 + select ARCH_WANT_OPTIONAL_GPIOLIB
155 + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
156 + select ARCH_WANT_FRAME_POINTERS
157 +diff --git a/arch/parisc/include/uapi/asm/signal.h b/arch/parisc/include/uapi/asm/signal.h
158 +index a2fa297196bc..f5645d6a89f2 100644
159 +--- a/arch/parisc/include/uapi/asm/signal.h
160 ++++ b/arch/parisc/include/uapi/asm/signal.h
161 +@@ -69,8 +69,6 @@
162 + #define SA_NOMASK SA_NODEFER
163 + #define SA_ONESHOT SA_RESETHAND
164 +
165 +-#define SA_RESTORER 0x04000000 /* obsolete -- ignored */
166 +-
167 + #define MINSIGSTKSZ 2048
168 + #define SIGSTKSZ 8192
169 +
170 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
171 +index d5d026b6d237..2e0ddfadc0b9 100644
172 +--- a/arch/powerpc/Kconfig
173 ++++ b/arch/powerpc/Kconfig
174 +@@ -138,6 +138,7 @@ config PPC
175 + select OLD_SIGSUSPEND
176 + select OLD_SIGACTION if PPC32
177 + select HAVE_DEBUG_STACKOVERFLOW
178 ++ select ARCH_SUPPORTS_ATOMIC_RMW
179 +
180 + config EARLY_PRINTK
181 + bool
182 +diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
183 +index 4e5683877b93..d60f34dbae89 100644
184 +--- a/arch/sparc/Kconfig
185 ++++ b/arch/sparc/Kconfig
186 +@@ -75,6 +75,7 @@ config SPARC64
187 + select ARCH_HAVE_NMI_SAFE_CMPXCHG
188 + select HAVE_C_RECORDMCOUNT
189 + select NO_BOOTMEM
190 ++ select ARCH_SUPPORTS_ATOMIC_RMW
191 +
192 + config ARCH_DEFCONFIG
193 + string
194 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
195 +index eb2dfa61eabe..9dc1a24d41b8 100644
196 +--- a/arch/x86/Kconfig
197 ++++ b/arch/x86/Kconfig
198 +@@ -123,6 +123,7 @@ config X86
199 + select COMPAT_OLD_SIGACTION if IA32_EMULATION
200 + select RTC_LIB
201 + select HAVE_DEBUG_STACKOVERFLOW
202 ++ select ARCH_SUPPORTS_ATOMIC_RMW
203 +
204 + config INSTRUCTION_DECODER
205 + def_bool y
206 +diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
207 +index 9ec06a1f6d61..425712462178 100644
208 +--- a/arch/x86/boot/header.S
209 ++++ b/arch/x86/boot/header.S
210 +@@ -91,10 +91,9 @@ bs_die:
211 +
212 + .section ".bsdata", "a"
213 + bugger_off_msg:
214 +- .ascii "Direct floppy boot is not supported. "
215 +- .ascii "Use a boot loader program instead.\r\n"
216 ++ .ascii "Use a boot loader.\r\n"
217 + .ascii "\n"
218 +- .ascii "Remove disk and press any key to reboot ...\r\n"
219 ++ .ascii "Remove disk and press any key to reboot...\r\n"
220 + .byte 0
221 +
222 + #ifdef CONFIG_EFI_STUB
223 +@@ -108,7 +107,7 @@ coff_header:
224 + #else
225 + .word 0x8664 # x86-64
226 + #endif
227 +- .word 3 # nr_sections
228 ++ .word 4 # nr_sections
229 + .long 0 # TimeDateStamp
230 + .long 0 # PointerToSymbolTable
231 + .long 1 # NumberOfSymbols
232 +@@ -250,6 +249,25 @@ section_table:
233 + .word 0 # NumberOfLineNumbers
234 + .long 0x60500020 # Characteristics (section flags)
235 +
236 ++ #
237 ++ # The offset & size fields are filled in by build.c.
238 ++ #
239 ++ .ascii ".bss"
240 ++ .byte 0
241 ++ .byte 0
242 ++ .byte 0
243 ++ .byte 0
244 ++ .long 0
245 ++ .long 0x0
246 ++ .long 0 # Size of initialized data
247 ++ # on disk
248 ++ .long 0x0
249 ++ .long 0 # PointerToRelocations
250 ++ .long 0 # PointerToLineNumbers
251 ++ .word 0 # NumberOfRelocations
252 ++ .word 0 # NumberOfLineNumbers
253 ++ .long 0xc8000080 # Characteristics (section flags)
254 ++
255 + #endif /* CONFIG_EFI_STUB */
256 +
257 + # Kernel attributes; used by setup. This is part 1 of the
258 +diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
259 +index c941d6a8887f..687dd281c23e 100644
260 +--- a/arch/x86/boot/tools/build.c
261 ++++ b/arch/x86/boot/tools/build.c
262 +@@ -141,7 +141,7 @@ static void usage(void)
263 +
264 + #ifdef CONFIG_EFI_STUB
265 +
266 +-static void update_pecoff_section_header(char *section_name, u32 offset, u32 size)
267 ++static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset)
268 + {
269 + unsigned int pe_header;
270 + unsigned short num_sections;
271 +@@ -162,10 +162,10 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz
272 + put_unaligned_le32(size, section + 0x8);
273 +
274 + /* section header vma field */
275 +- put_unaligned_le32(offset, section + 0xc);
276 ++ put_unaligned_le32(vma, section + 0xc);
277 +
278 + /* section header 'size of initialised data' field */
279 +- put_unaligned_le32(size, section + 0x10);
280 ++ put_unaligned_le32(datasz, section + 0x10);
281 +
282 + /* section header 'file offset' field */
283 + put_unaligned_le32(offset, section + 0x14);
284 +@@ -177,6 +177,11 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz
285 + }
286 + }
287 +
288 ++static void update_pecoff_section_header(char *section_name, u32 offset, u32 size)
289 ++{
290 ++ update_pecoff_section_header_fields(section_name, offset, size, size, offset);
291 ++}
292 ++
293 + static void update_pecoff_setup_and_reloc(unsigned int size)
294 + {
295 + u32 setup_offset = 0x200;
296 +@@ -201,9 +206,6 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz)
297 +
298 + pe_header = get_unaligned_le32(&buf[0x3c]);
299 +
300 +- /* Size of image */
301 +- put_unaligned_le32(file_sz, &buf[pe_header + 0x50]);
302 +-
303 + /*
304 + * Size of code: Subtract the size of the first sector (512 bytes)
305 + * which includes the header.
306 +@@ -218,6 +220,22 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz)
307 + update_pecoff_section_header(".text", text_start, text_sz);
308 + }
309 +
310 ++static void update_pecoff_bss(unsigned int file_sz, unsigned int init_sz)
311 ++{
312 ++ unsigned int pe_header;
313 ++ unsigned int bss_sz = init_sz - file_sz;
314 ++
315 ++ pe_header = get_unaligned_le32(&buf[0x3c]);
316 ++
317 ++ /* Size of uninitialized data */
318 ++ put_unaligned_le32(bss_sz, &buf[pe_header + 0x24]);
319 ++
320 ++ /* Size of image */
321 ++ put_unaligned_le32(init_sz, &buf[pe_header + 0x50]);
322 ++
323 ++ update_pecoff_section_header_fields(".bss", file_sz, bss_sz, 0, 0);
324 ++}
325 ++
326 + #endif /* CONFIG_EFI_STUB */
327 +
328 +
329 +@@ -269,6 +287,9 @@ int main(int argc, char ** argv)
330 + int fd;
331 + void *kernel;
332 + u32 crc = 0xffffffffUL;
333 ++#ifdef CONFIG_EFI_STUB
334 ++ unsigned int init_sz;
335 ++#endif
336 +
337 + /* Defaults for old kernel */
338 + #ifdef CONFIG_X86_32
339 +@@ -339,7 +360,9 @@ int main(int argc, char ** argv)
340 + put_unaligned_le32(sys_size, &buf[0x1f4]);
341 +
342 + #ifdef CONFIG_EFI_STUB
343 +- update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz));
344 ++ update_pecoff_text(setup_sectors * 512, i + (sys_size * 16));
345 ++ init_sz = get_unaligned_le32(&buf[0x260]);
346 ++ update_pecoff_bss(i + (sys_size * 16), init_sz);
347 +
348 + #ifdef CONFIG_X86_64 /* Yes, this is really how we defined it :( */
349 + efi_stub_entry -= 0x200;
350 +diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
351 +index f31a1655d1ff..aa4b5c132c66 100644
352 +--- a/arch/x86/kernel/cpu/perf_event_intel.c
353 ++++ b/arch/x86/kernel/cpu/perf_event_intel.c
354 +@@ -1365,6 +1365,15 @@ again:
355 + intel_pmu_lbr_read();
356 +
357 + /*
358 ++ * CondChgd bit 63 doesn't mean any overflow status. Ignore
359 ++ * and clear the bit.
360 ++ */
361 ++ if (__test_and_clear_bit(63, (unsigned long *)&status)) {
362 ++ if (!status)
363 ++ goto done;
364 ++ }
365 ++
366 ++ /*
367 + * PEBS overflow sets bit 62 in the global status register
368 + */
369 + if (__test_and_clear_bit(62, (unsigned long *)&status)) {
370 +diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
371 +index 3308125c90aa..1fc2a347c47c 100644
372 +--- a/arch/x86/kernel/entry_32.S
373 ++++ b/arch/x86/kernel/entry_32.S
374 +@@ -436,8 +436,8 @@ sysenter_do_call:
375 + cmpl $(NR_syscalls), %eax
376 + jae sysenter_badsys
377 + call *sys_call_table(,%eax,4)
378 +- movl %eax,PT_EAX(%esp)
379 + sysenter_after_call:
380 ++ movl %eax,PT_EAX(%esp)
381 + LOCKDEP_SYS_EXIT
382 + DISABLE_INTERRUPTS(CLBR_ANY)
383 + TRACE_IRQS_OFF
384 +@@ -517,6 +517,7 @@ ENTRY(system_call)
385 + jae syscall_badsys
386 + syscall_call:
387 + call *sys_call_table(,%eax,4)
388 ++syscall_after_call:
389 + movl %eax,PT_EAX(%esp) # store the return value
390 + syscall_exit:
391 + LOCKDEP_SYS_EXIT
392 +@@ -686,12 +687,12 @@ syscall_fault:
393 + END(syscall_fault)
394 +
395 + syscall_badsys:
396 +- movl $-ENOSYS,PT_EAX(%esp)
397 +- jmp syscall_exit
398 ++ movl $-ENOSYS,%eax
399 ++ jmp syscall_after_call
400 + END(syscall_badsys)
401 +
402 + sysenter_badsys:
403 +- movl $-ENOSYS,PT_EAX(%esp)
404 ++ movl $-ENOSYS,%eax
405 + jmp sysenter_after_call
406 + END(syscall_badsys)
407 + CFI_ENDPROC
408 +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
409 +index dd0dd2d4ceca..d8f80e733cf8 100644
410 +--- a/block/blk-cgroup.c
411 ++++ b/block/blk-cgroup.c
412 +@@ -859,6 +859,13 @@ void blkcg_drain_queue(struct request_queue *q)
413 + {
414 + lockdep_assert_held(q->queue_lock);
415 +
416 ++ /*
417 ++ * @q could be exiting and already have destroyed all blkgs as
418 ++ * indicated by NULL root_blkg. If so, don't confuse policies.
419 ++ */
420 ++ if (!q->root_blkg)
421 ++ return;
422 ++
423 + blk_throtl_drain(q);
424 + }
425 +
426 +diff --git a/block/blk-tag.c b/block/blk-tag.c
427 +index 3f33d8672268..a185b86741e5 100644
428 +--- a/block/blk-tag.c
429 ++++ b/block/blk-tag.c
430 +@@ -27,18 +27,15 @@ struct request *blk_queue_find_tag(struct request_queue *q, int tag)
431 + EXPORT_SYMBOL(blk_queue_find_tag);
432 +
433 + /**
434 +- * __blk_free_tags - release a given set of tag maintenance info
435 ++ * blk_free_tags - release a given set of tag maintenance info
436 + * @bqt: the tag map to free
437 + *
438 +- * Tries to free the specified @bqt. Returns true if it was
439 +- * actually freed and false if there are still references using it
440 ++ * Drop the reference count on @bqt and frees it when the last reference
441 ++ * is dropped.
442 + */
443 +-static int __blk_free_tags(struct blk_queue_tag *bqt)
444 ++void blk_free_tags(struct blk_queue_tag *bqt)
445 + {
446 +- int retval;
447 +-
448 +- retval = atomic_dec_and_test(&bqt->refcnt);
449 +- if (retval) {
450 ++ if (atomic_dec_and_test(&bqt->refcnt)) {
451 + BUG_ON(find_first_bit(bqt->tag_map, bqt->max_depth) <
452 + bqt->max_depth);
453 +
454 +@@ -50,9 +47,8 @@ static int __blk_free_tags(struct blk_queue_tag *bqt)
455 +
456 + kfree(bqt);
457 + }
458 +-
459 +- return retval;
460 + }
461 ++EXPORT_SYMBOL(blk_free_tags);
462 +
463 + /**
464 + * __blk_queue_free_tags - release tag maintenance info
465 +@@ -69,28 +65,13 @@ void __blk_queue_free_tags(struct request_queue *q)
466 + if (!bqt)
467 + return;
468 +
469 +- __blk_free_tags(bqt);
470 ++ blk_free_tags(bqt);
471 +
472 + q->queue_tags = NULL;
473 + queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q);
474 + }
475 +
476 + /**
477 +- * blk_free_tags - release a given set of tag maintenance info
478 +- * @bqt: the tag map to free
479 +- *
480 +- * For externally managed @bqt frees the map. Callers of this
481 +- * function must guarantee to have released all the queues that
482 +- * might have been using this tag map.
483 +- */
484 +-void blk_free_tags(struct blk_queue_tag *bqt)
485 +-{
486 +- if (unlikely(!__blk_free_tags(bqt)))
487 +- BUG();
488 +-}
489 +-EXPORT_SYMBOL(blk_free_tags);
490 +-
491 +-/**
492 + * blk_queue_free_tags - release tag maintenance info
493 + * @q: the request queue for the device
494 + *
495 +diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
496 +index fbd5a67cb773..a0926a6094b2 100644
497 +--- a/block/compat_ioctl.c
498 ++++ b/block/compat_ioctl.c
499 +@@ -690,6 +690,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
500 + case BLKROSET:
501 + case BLKDISCARD:
502 + case BLKSECDISCARD:
503 ++ case BLKZEROOUT:
504 + /*
505 + * the ones below are implemented in blkdev_locked_ioctl,
506 + * but we call blkdev_ioctl, which gets the lock for us
507 +diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
508 +index 0bdacc5e26a3..2ba8f02ced36 100644
509 +--- a/drivers/acpi/resource.c
510 ++++ b/drivers/acpi/resource.c
511 +@@ -77,7 +77,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res)
512 + switch (ares->type) {
513 + case ACPI_RESOURCE_TYPE_MEMORY24:
514 + memory24 = &ares->data.memory24;
515 +- if (!memory24->address_length)
516 ++ if (!memory24->minimum && !memory24->address_length)
517 + return false;
518 + acpi_dev_get_memresource(res, memory24->minimum,
519 + memory24->address_length,
520 +@@ -85,7 +85,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res)
521 + break;
522 + case ACPI_RESOURCE_TYPE_MEMORY32:
523 + memory32 = &ares->data.memory32;
524 +- if (!memory32->address_length)
525 ++ if (!memory32->minimum && !memory32->address_length)
526 + return false;
527 + acpi_dev_get_memresource(res, memory32->minimum,
528 + memory32->address_length,
529 +@@ -93,7 +93,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res)
530 + break;
531 + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
532 + fixed_memory32 = &ares->data.fixed_memory32;
533 +- if (!fixed_memory32->address_length)
534 ++ if (!fixed_memory32->address && !fixed_memory32->address_length)
535 + return false;
536 + acpi_dev_get_memresource(res, fixed_memory32->address,
537 + fixed_memory32->address_length,
538 +@@ -150,7 +150,7 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res)
539 + switch (ares->type) {
540 + case ACPI_RESOURCE_TYPE_IO:
541 + io = &ares->data.io;
542 +- if (!io->address_length)
543 ++ if (!io->minimum && !io->address_length)
544 + return false;
545 + acpi_dev_get_ioresource(res, io->minimum,
546 + io->address_length,
547 +@@ -158,7 +158,7 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res)
548 + break;
549 + case ACPI_RESOURCE_TYPE_FIXED_IO:
550 + fixed_io = &ares->data.fixed_io;
551 +- if (!fixed_io->address_length)
552 ++ if (!fixed_io->address && !fixed_io->address_length)
553 + return false;
554 + acpi_dev_get_ioresource(res, fixed_io->address,
555 + fixed_io->address_length,
556 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
557 +index 5421a820ec7d..efa328bf6724 100644
558 +--- a/drivers/ata/ahci.c
559 ++++ b/drivers/ata/ahci.c
560 +@@ -455,6 +455,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
561 +
562 + /* Promise */
563 + { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
564 ++ { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */
565 +
566 + /* Asmedia */
567 + { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */
568 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
569 +index d2eb9df3da3d..0d9a2f674819 100644
570 +--- a/drivers/ata/libata-core.c
571 ++++ b/drivers/ata/libata-core.c
572 +@@ -4787,6 +4787,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
573 + * ata_qc_new - Request an available ATA command, for queueing
574 + * @ap: target port
575 + *
576 ++ * Some ATA host controllers may implement a queue depth which is less
577 ++ * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond
578 ++ * the hardware limitation.
579 ++ *
580 + * LOCKING:
581 + * None.
582 + */
583 +@@ -4794,14 +4798,15 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
584 + static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
585 + {
586 + struct ata_queued_cmd *qc = NULL;
587 ++ unsigned int max_queue = ap->host->n_tags;
588 + unsigned int i, tag;
589 +
590 + /* no command while frozen */
591 + if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
592 + return NULL;
593 +
594 +- for (i = 0; i < ATA_MAX_QUEUE; i++) {
595 +- tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE;
596 ++ for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) {
597 ++ tag = tag < max_queue ? tag : 0;
598 +
599 + /* the last tag is reserved for internal command. */
600 + if (tag == ATA_TAG_INTERNAL)
601 +@@ -6103,6 +6108,7 @@ void ata_host_init(struct ata_host *host, struct device *dev,
602 + {
603 + spin_lock_init(&host->lock);
604 + mutex_init(&host->eh_mutex);
605 ++ host->n_tags = ATA_MAX_QUEUE - 1;
606 + host->dev = dev;
607 + host->ops = ops;
608 + }
609 +@@ -6184,6 +6190,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
610 + {
611 + int i, rc;
612 +
613 ++ host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE - 1);
614 ++
615 + /* host must have been started */
616 + if (!(host->flags & ATA_HOST_STARTED)) {
617 + dev_err(host->dev, "BUG: trying to register unstarted host\n");
618 +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
619 +index b6154d5a07a5..db0be2fb05fe 100644
620 +--- a/drivers/bluetooth/hci_h5.c
621 ++++ b/drivers/bluetooth/hci_h5.c
622 +@@ -406,6 +406,7 @@ static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c)
623 + H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) {
624 + BT_ERR("Non-link packet received in non-active state");
625 + h5_reset_rx(h5);
626 ++ return 0;
627 + }
628 +
629 + h5->rx_func = h5_rx_payload;
630 +diff --git a/drivers/gpu/drm/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c
631 +index 21393dc4700a..f4b6b89b98f3 100644
632 +--- a/drivers/gpu/drm/qxl/qxl_irq.c
633 ++++ b/drivers/gpu/drm/qxl/qxl_irq.c
634 +@@ -33,6 +33,9 @@ irqreturn_t qxl_irq_handler(DRM_IRQ_ARGS)
635 +
636 + pending = xchg(&qdev->ram_header->int_pending, 0);
637 +
638 ++ if (!pending)
639 ++ return IRQ_NONE;
640 ++
641 + atomic_inc(&qdev->irq_received);
642 +
643 + if (pending & QXL_INTERRUPT_DISPLAY) {
644 +diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
645 +index 583345636d4b..6a965172d8dd 100644
646 +--- a/drivers/gpu/drm/radeon/atombios_encoders.c
647 ++++ b/drivers/gpu/drm/radeon/atombios_encoders.c
648 +@@ -183,7 +183,6 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
649 + struct backlight_properties props;
650 + struct radeon_backlight_privdata *pdata;
651 + struct radeon_encoder_atom_dig *dig;
652 +- u8 backlight_level;
653 + char bl_name[16];
654 +
655 + /* Mac laptops with multiple GPUs use the gmux driver for backlight
656 +@@ -222,12 +221,17 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
657 +
658 + pdata->encoder = radeon_encoder;
659 +
660 +- backlight_level = radeon_atom_get_backlight_level_from_reg(rdev);
661 +-
662 + dig = radeon_encoder->enc_priv;
663 + dig->bl_dev = bd;
664 +
665 + bd->props.brightness = radeon_atom_backlight_get_brightness(bd);
666 ++ /* Set a reasonable default here if the level is 0 otherwise
667 ++ * fbdev will attempt to turn the backlight on after console
668 ++ * unblanking and it will try and restore 0 which turns the backlight
669 ++ * off again.
670 ++ */
671 ++ if (bd->props.brightness == 0)
672 ++ bd->props.brightness = RADEON_MAX_BL_LEVEL;
673 + bd->props.power = FB_BLANK_UNBLANK;
674 + backlight_update_status(bd);
675 +
676 +diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
677 +index bb7f2ae7683d..14836dfd04e7 100644
678 +--- a/drivers/gpu/drm/radeon/cik.c
679 ++++ b/drivers/gpu/drm/radeon/cik.c
680 +@@ -6554,6 +6554,7 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev)
681 + tmp = RREG32(IH_RB_CNTL);
682 + tmp |= IH_WPTR_OVERFLOW_CLEAR;
683 + WREG32(IH_RB_CNTL, tmp);
684 ++ wptr &= ~RB_OVERFLOW;
685 + }
686 + return (wptr & rdev->ih.ptr_mask);
687 + }
688 +diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
689 +index 4564bb1ab837..7ca58fc7a1c6 100644
690 +--- a/drivers/gpu/drm/radeon/evergreen.c
691 ++++ b/drivers/gpu/drm/radeon/evergreen.c
692 +@@ -4664,6 +4664,7 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
693 + tmp = RREG32(IH_RB_CNTL);
694 + tmp |= IH_WPTR_OVERFLOW_CLEAR;
695 + WREG32(IH_RB_CNTL, tmp);
696 ++ wptr &= ~RB_OVERFLOW;
697 + }
698 + return (wptr & rdev->ih.ptr_mask);
699 + }
700 +diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
701 +index 2c2b91f16ecf..88eb936fbc2f 100644
702 +--- a/drivers/gpu/drm/radeon/r600.c
703 ++++ b/drivers/gpu/drm/radeon/r600.c
704 +@@ -3657,6 +3657,7 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev)
705 + tmp = RREG32(IH_RB_CNTL);
706 + tmp |= IH_WPTR_OVERFLOW_CLEAR;
707 + WREG32(IH_RB_CNTL, tmp);
708 ++ wptr &= ~RB_OVERFLOW;
709 + }
710 + return (wptr & rdev->ih.ptr_mask);
711 + }
712 +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
713 +index 0254a7596a55..9a19a0432f0f 100644
714 +--- a/drivers/gpu/drm/radeon/radeon_display.c
715 ++++ b/drivers/gpu/drm/radeon/radeon_display.c
716 +@@ -708,6 +708,10 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
717 + struct radeon_device *rdev = dev->dev_private;
718 + int ret = 0;
719 +
720 ++ /* don't leak the edid if we already fetched it in detect() */
721 ++ if (radeon_connector->edid)
722 ++ goto got_edid;
723 ++
724 + /* on hw with routers, select right port */
725 + if (radeon_connector->router.ddc_valid)
726 + radeon_router_select_ddc_port(radeon_connector);
727 +@@ -747,6 +751,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
728 + radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev);
729 + }
730 + if (radeon_connector->edid) {
731 ++got_edid:
732 + drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid);
733 + ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid);
734 + drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid);
735 +diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
736 +index c9f9c07f888d..4d41a0dc1796 100644
737 +--- a/drivers/gpu/drm/radeon/si.c
738 ++++ b/drivers/gpu/drm/radeon/si.c
739 +@@ -6041,6 +6041,7 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev)
740 + tmp = RREG32(IH_RB_CNTL);
741 + tmp |= IH_WPTR_OVERFLOW_CLEAR;
742 + WREG32(IH_RB_CNTL, tmp);
743 ++ wptr &= ~RB_OVERFLOW;
744 + }
745 + return (wptr & rdev->ih.ptr_mask);
746 + }
747 +diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
748 +index 09988b289622..816782a65488 100644
749 +--- a/drivers/hv/hv_kvp.c
750 ++++ b/drivers/hv/hv_kvp.c
751 +@@ -127,6 +127,15 @@ kvp_work_func(struct work_struct *dummy)
752 + kvp_respond_to_host(NULL, HV_E_FAIL);
753 + }
754 +
755 ++static void poll_channel(struct vmbus_channel *channel)
756 ++{
757 ++ unsigned long flags;
758 ++
759 ++ spin_lock_irqsave(&channel->inbound_lock, flags);
760 ++ hv_kvp_onchannelcallback(channel);
761 ++ spin_unlock_irqrestore(&channel->inbound_lock, flags);
762 ++}
763 ++
764 + static int kvp_handle_handshake(struct hv_kvp_msg *msg)
765 + {
766 + int ret = 1;
767 +@@ -155,7 +164,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg)
768 + kvp_register(dm_reg_value);
769 + kvp_transaction.active = false;
770 + if (kvp_transaction.kvp_context)
771 +- hv_kvp_onchannelcallback(kvp_transaction.kvp_context);
772 ++ poll_channel(kvp_transaction.kvp_context);
773 + }
774 + return ret;
775 + }
776 +@@ -568,6 +577,7 @@ response_done:
777 +
778 + vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,
779 + VM_PKT_DATA_INBAND, 0);
780 ++ poll_channel(channel);
781 +
782 + }
783 +
784 +@@ -603,7 +613,7 @@ void hv_kvp_onchannelcallback(void *context)
785 + return;
786 + }
787 +
788 +- vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
789 ++ vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,
790 + &requestid);
791 +
792 + if (recvlen > 0) {
793 +diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
794 +index 273e3ddb3a20..665b7dac6b7d 100644
795 +--- a/drivers/hv/hv_util.c
796 ++++ b/drivers/hv/hv_util.c
797 +@@ -312,7 +312,7 @@ static int util_probe(struct hv_device *dev,
798 + (struct hv_util_service *)dev_id->driver_data;
799 + int ret;
800 +
801 +- srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL);
802 ++ srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL);
803 + if (!srv->recv_buffer)
804 + return -ENOMEM;
805 + if (srv->util_init) {
806 +diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
807 +index 0f4dea5ccf17..9ee3913850d6 100644
808 +--- a/drivers/hwmon/adt7470.c
809 ++++ b/drivers/hwmon/adt7470.c
810 +@@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct device *dev,
811 + return -EINVAL;
812 +
813 + temp = DIV_ROUND_CLOSEST(temp, 1000);
814 +- temp = clamp_val(temp, 0, 255);
815 ++ temp = clamp_val(temp, -128, 127);
816 +
817 + mutex_lock(&data->lock);
818 + data->temp_min[attr->index] = temp;
819 +@@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct device *dev,
820 + return -EINVAL;
821 +
822 + temp = DIV_ROUND_CLOSEST(temp, 1000);
823 +- temp = clamp_val(temp, 0, 255);
824 ++ temp = clamp_val(temp, -128, 127);
825 +
826 + mutex_lock(&data->lock);
827 + data->temp_max[attr->index] = temp;
828 +@@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct device *dev,
829 + return -EINVAL;
830 +
831 + temp = DIV_ROUND_CLOSEST(temp, 1000);
832 +- temp = clamp_val(temp, 0, 255);
833 ++ temp = clamp_val(temp, -128, 127);
834 +
835 + mutex_lock(&data->lock);
836 + data->pwm_tmin[attr->index] = temp;
837 +diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c
838 +index 960fac3fb166..48044b044b7a 100644
839 +--- a/drivers/hwmon/da9052-hwmon.c
840 ++++ b/drivers/hwmon/da9052-hwmon.c
841 +@@ -194,7 +194,7 @@ static ssize_t da9052_hwmon_show_name(struct device *dev,
842 + struct device_attribute *devattr,
843 + char *buf)
844 + {
845 +- return sprintf(buf, "da9052-hwmon\n");
846 ++ return sprintf(buf, "da9052\n");
847 + }
848 +
849 + static ssize_t show_label(struct device *dev,
850 +diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
851 +index 029ecabc4380..1b275a2881d6 100644
852 +--- a/drivers/hwmon/da9055-hwmon.c
853 ++++ b/drivers/hwmon/da9055-hwmon.c
854 +@@ -204,7 +204,7 @@ static ssize_t da9055_hwmon_show_name(struct device *dev,
855 + struct device_attribute *devattr,
856 + char *buf)
857 + {
858 +- return sprintf(buf, "da9055-hwmon\n");
859 ++ return sprintf(buf, "da9055\n");
860 + }
861 +
862 + static ssize_t show_label(struct device *dev,
863 +diff --git a/drivers/hwmon/smsc47m192.c b/drivers/hwmon/smsc47m192.c
864 +index efee4c59239f..34b9a601ad07 100644
865 +--- a/drivers/hwmon/smsc47m192.c
866 ++++ b/drivers/hwmon/smsc47m192.c
867 +@@ -86,7 +86,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n)
868 + */
869 + static inline s8 TEMP_TO_REG(int val)
870 + {
871 +- return clamp_val(SCALE(val, 1, 1000), -128000, 127000);
872 ++ return SCALE(clamp_val(val, -128000, 127000), 1, 1000);
873 + }
874 +
875 + static inline int TEMP_FROM_REG(s8 val)
876 +@@ -384,6 +384,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
877 + err = kstrtoul(buf, 10, &val);
878 + if (err)
879 + return err;
880 ++ if (val > 255)
881 ++ return -EINVAL;
882 +
883 + data->vrm = val;
884 + return count;
885 +diff --git a/drivers/input/input.c b/drivers/input/input.c
886 +index 74f47980117b..fcf77af28866 100644
887 +--- a/drivers/input/input.c
888 ++++ b/drivers/input/input.c
889 +@@ -257,9 +257,10 @@ static int input_handle_abs_event(struct input_dev *dev,
890 + }
891 +
892 + static int input_get_disposition(struct input_dev *dev,
893 +- unsigned int type, unsigned int code, int value)
894 ++ unsigned int type, unsigned int code, int *pval)
895 + {
896 + int disposition = INPUT_IGNORE_EVENT;
897 ++ int value = *pval;
898 +
899 + switch (type) {
900 +
901 +@@ -357,6 +358,7 @@ static int input_get_disposition(struct input_dev *dev,
902 + break;
903 + }
904 +
905 ++ *pval = value;
906 + return disposition;
907 + }
908 +
909 +@@ -365,7 +367,7 @@ static void input_handle_event(struct input_dev *dev,
910 + {
911 + int disposition;
912 +
913 +- disposition = input_get_disposition(dev, type, code, value);
914 ++ disposition = input_get_disposition(dev, type, code, &value);
915 +
916 + if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
917 + dev->event(dev, type, code, value);
918 +diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
919 +index 86df97f6fd27..0fcbf921fff3 100644
920 +--- a/drivers/irqchip/irq-gic.c
921 ++++ b/drivers/irqchip/irq-gic.c
922 +@@ -42,6 +42,7 @@
923 + #include <linux/irqchip/chained_irq.h>
924 + #include <linux/irqchip/arm-gic.h>
925 +
926 ++#include <asm/cputype.h>
927 + #include <asm/irq.h>
928 + #include <asm/exception.h>
929 + #include <asm/smp_plat.h>
930 +@@ -760,7 +761,9 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
931 + }
932 +
933 + for_each_possible_cpu(cpu) {
934 +- unsigned long offset = percpu_offset * cpu_logical_map(cpu);
935 ++ u32 mpidr = cpu_logical_map(cpu);
936 ++ u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
937 ++ unsigned long offset = percpu_offset * core_id;
938 + *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset;
939 + *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset;
940 + }
941 +@@ -864,6 +867,7 @@ int __init gic_of_init(struct device_node *node, struct device_node *parent)
942 + }
943 + IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init);
944 + IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init);
945 ++IRQCHIP_DECLARE(cortex_a7_gic, "arm,cortex-a7-gic", gic_of_init);
946 + IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init);
947 + IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init);
948 +
949 +diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
950 +index 1d38019bb022..b564c0610259 100644
951 +--- a/drivers/md/dm-cache-metadata.c
952 ++++ b/drivers/md/dm-cache-metadata.c
953 +@@ -407,6 +407,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd)
954 +
955 + disk_super = dm_block_data(sblock);
956 +
957 ++ /* Verify the data block size hasn't changed */
958 ++ if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) {
959 ++ DMERR("changing the data block size (from %u to %llu) is not supported",
960 ++ le32_to_cpu(disk_super->data_block_size),
961 ++ (unsigned long long)cmd->data_block_size);
962 ++ r = -EINVAL;
963 ++ goto bad;
964 ++ }
965 ++
966 + r = __check_incompat_features(disk_super, cmd);
967 + if (r < 0)
968 + goto bad;
969 +diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
970 +index 07a6ea3a9820..b63095c73b5f 100644
971 +--- a/drivers/md/dm-thin-metadata.c
972 ++++ b/drivers/md/dm-thin-metadata.c
973 +@@ -613,6 +613,15 @@ static int __open_metadata(struct dm_pool_metadata *pmd)
974 +
975 + disk_super = dm_block_data(sblock);
976 +
977 ++ /* Verify the data block size hasn't changed */
978 ++ if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) {
979 ++ DMERR("changing the data block size (from %u to %llu) is not supported",
980 ++ le32_to_cpu(disk_super->data_block_size),
981 ++ (unsigned long long)pmd->data_block_size);
982 ++ r = -EINVAL;
983 ++ goto bad_unlock_sblock;
984 ++ }
985 ++
986 + r = __check_incompat_features(disk_super, pmd);
987 + if (r < 0)
988 + goto bad_unlock_sblock;
989 +diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c
990 +index 8ad3a57cf640..287b977862e2 100644
991 +--- a/drivers/media/dvb-frontends/tda10071.c
992 ++++ b/drivers/media/dvb-frontends/tda10071.c
993 +@@ -667,6 +667,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe)
994 + struct dtv_frontend_properties *c = &fe->dtv_property_cache;
995 + int ret, i;
996 + u8 mode, rolloff, pilot, inversion, div;
997 ++ fe_modulation_t modulation;
998 +
999 + dev_dbg(&priv->i2c->dev, "%s: delivery_system=%d modulation=%d " \
1000 + "frequency=%d symbol_rate=%d inversion=%d pilot=%d " \
1001 +@@ -701,10 +702,13 @@ static int tda10071_set_frontend(struct dvb_frontend *fe)
1002 +
1003 + switch (c->delivery_system) {
1004 + case SYS_DVBS:
1005 ++ modulation = QPSK;
1006 + rolloff = 0;
1007 + pilot = 2;
1008 + break;
1009 + case SYS_DVBS2:
1010 ++ modulation = c->modulation;
1011 ++
1012 + switch (c->rolloff) {
1013 + case ROLLOFF_20:
1014 + rolloff = 2;
1015 +@@ -749,7 +753,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe)
1016 +
1017 + for (i = 0, mode = 0xff; i < ARRAY_SIZE(TDA10071_MODCOD); i++) {
1018 + if (c->delivery_system == TDA10071_MODCOD[i].delivery_system &&
1019 +- c->modulation == TDA10071_MODCOD[i].modulation &&
1020 ++ modulation == TDA10071_MODCOD[i].modulation &&
1021 + c->fec_inner == TDA10071_MODCOD[i].fec) {
1022 + mode = TDA10071_MODCOD[i].val;
1023 + dev_dbg(&priv->i2c->dev, "%s: mode found=%02x\n",
1024 +diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c
1025 +index a91509643563..0d4be1d840ab 100644
1026 +--- a/drivers/media/usb/gspca/pac7302.c
1027 ++++ b/drivers/media/usb/gspca/pac7302.c
1028 +@@ -928,6 +928,7 @@ static const struct usb_device_id device_table[] = {
1029 + {USB_DEVICE(0x093a, 0x2620)},
1030 + {USB_DEVICE(0x093a, 0x2621)},
1031 + {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP},
1032 ++ {USB_DEVICE(0x093a, 0x2623), .driver_info = FL_VFLIP},
1033 + {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP},
1034 + {USB_DEVICE(0x093a, 0x2625)},
1035 + {USB_DEVICE(0x093a, 0x2626)},
1036 +diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
1037 +index 0500c4175d5f..6bce01a674f9 100644
1038 +--- a/drivers/media/usb/hdpvr/hdpvr-video.c
1039 ++++ b/drivers/media/usb/hdpvr/hdpvr-video.c
1040 +@@ -82,7 +82,7 @@ static void hdpvr_read_bulk_callback(struct urb *urb)
1041 + }
1042 +
1043 + /*=========================================================================*/
1044 +-/* bufffer bits */
1045 ++/* buffer bits */
1046 +
1047 + /* function expects dev->io_mutex to be hold by caller */
1048 + int hdpvr_cancel_queue(struct hdpvr_device *dev)
1049 +@@ -926,7 +926,7 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl)
1050 + case V4L2_CID_MPEG_AUDIO_ENCODING:
1051 + if (dev->flags & HDPVR_FLAG_AC3_CAP) {
1052 + opt->audio_codec = ctrl->val;
1053 +- return hdpvr_set_audio(dev, opt->audio_input,
1054 ++ return hdpvr_set_audio(dev, opt->audio_input + 1,
1055 + opt->audio_codec);
1056 + }
1057 + return 0;
1058 +@@ -1198,7 +1198,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,
1059 + v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops,
1060 + V4L2_CID_MPEG_AUDIO_ENCODING,
1061 + ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 : V4L2_MPEG_AUDIO_ENCODING_AAC,
1062 +- 0x7, V4L2_MPEG_AUDIO_ENCODING_AAC);
1063 ++ 0x7, ac3 ? dev->options.audio_codec : V4L2_MPEG_AUDIO_ENCODING_AAC);
1064 + v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops,
1065 + V4L2_CID_MPEG_VIDEO_ENCODING,
1066 + V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3,
1067 +diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
1068 +index c0895f88ce9c..9f2ac588661b 100644
1069 +--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
1070 ++++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
1071 +@@ -594,10 +594,10 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait)
1072 + aspect.denominator = 9;
1073 + } else if (ratio == 34) {
1074 + aspect.numerator = 4;
1075 +- aspect.numerator = 3;
1076 ++ aspect.denominator = 3;
1077 + } else if (ratio == 68) {
1078 + aspect.numerator = 15;
1079 +- aspect.numerator = 9;
1080 ++ aspect.denominator = 9;
1081 + } else {
1082 + aspect.numerator = hor_landscape + 99;
1083 + aspect.denominator = 100;
1084 +diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
1085 +index d1dd6a33a050..3059a7a53bff 100644
1086 +--- a/drivers/mtd/devices/elm.c
1087 ++++ b/drivers/mtd/devices/elm.c
1088 +@@ -428,6 +428,7 @@ static int elm_context_save(struct elm_info *info)
1089 + ELM_SYNDROME_FRAGMENT_1 + offset);
1090 + regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
1091 + ELM_SYNDROME_FRAGMENT_0 + offset);
1092 ++ break;
1093 + default:
1094 + return -EINVAL;
1095 + }
1096 +@@ -466,6 +467,7 @@ static int elm_context_restore(struct elm_info *info)
1097 + regs->elm_syndrome_fragment_1[i]);
1098 + elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
1099 + regs->elm_syndrome_fragment_0[i]);
1100 ++ break;
1101 + default:
1102 + return -EINVAL;
1103 + }
1104 +diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
1105 +index e59c42b446a9..ae148055baa2 100644
1106 +--- a/drivers/net/can/c_can/c_can.c
1107 ++++ b/drivers/net/can/c_can/c_can.c
1108 +@@ -830,9 +830,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
1109 + continue;
1110 + }
1111 +
1112 +- if (msg_ctrl_save & IF_MCONT_EOB)
1113 +- return num_rx_pkts;
1114 +-
1115 + if (!(msg_ctrl_save & IF_MCONT_NEWDAT))
1116 + continue;
1117 +
1118 +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
1119 +index 25377e547f9b..3c28d1f187c0 100644
1120 +--- a/drivers/net/can/slcan.c
1121 ++++ b/drivers/net/can/slcan.c
1122 +@@ -54,6 +54,7 @@
1123 + #include <linux/delay.h>
1124 + #include <linux/init.h>
1125 + #include <linux/kernel.h>
1126 ++#include <linux/workqueue.h>
1127 + #include <linux/can.h>
1128 + #include <linux/can/skb.h>
1129 +
1130 +@@ -87,6 +88,7 @@ struct slcan {
1131 + struct tty_struct *tty; /* ptr to TTY structure */
1132 + struct net_device *dev; /* easy for intr handling */
1133 + spinlock_t lock;
1134 ++ struct work_struct tx_work; /* Flushes transmit buffer */
1135 +
1136 + /* These are pointers to the malloc()ed frame buffers. */
1137 + unsigned char rbuff[SLC_MTU]; /* receiver buffer */
1138 +@@ -311,34 +313,44 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf)
1139 + sl->dev->stats.tx_bytes += cf->can_dlc;
1140 + }
1141 +
1142 +-/*
1143 +- * Called by the driver when there's room for more data. If we have
1144 +- * more packets to send, we send them here.
1145 +- */
1146 +-static void slcan_write_wakeup(struct tty_struct *tty)
1147 ++/* Write out any remaining transmit buffer. Scheduled when tty is writable */
1148 ++static void slcan_transmit(struct work_struct *work)
1149 + {
1150 ++ struct slcan *sl = container_of(work, struct slcan, tx_work);
1151 + int actual;
1152 +- struct slcan *sl = (struct slcan *) tty->disc_data;
1153 +
1154 ++ spin_lock_bh(&sl->lock);
1155 + /* First make sure we're connected. */
1156 +- if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev))
1157 ++ if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) {
1158 ++ spin_unlock_bh(&sl->lock);
1159 + return;
1160 ++ }
1161 +
1162 +- spin_lock(&sl->lock);
1163 + if (sl->xleft <= 0) {
1164 + /* Now serial buffer is almost free & we can start
1165 + * transmission of another packet */
1166 + sl->dev->stats.tx_packets++;
1167 +- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1168 +- spin_unlock(&sl->lock);
1169 ++ clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
1170 ++ spin_unlock_bh(&sl->lock);
1171 + netif_wake_queue(sl->dev);
1172 + return;
1173 + }
1174 +
1175 +- actual = tty->ops->write(tty, sl->xhead, sl->xleft);
1176 ++ actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
1177 + sl->xleft -= actual;
1178 + sl->xhead += actual;
1179 +- spin_unlock(&sl->lock);
1180 ++ spin_unlock_bh(&sl->lock);
1181 ++}
1182 ++
1183 ++/*
1184 ++ * Called by the driver when there's room for more data.
1185 ++ * Schedule the transmit.
1186 ++ */
1187 ++static void slcan_write_wakeup(struct tty_struct *tty)
1188 ++{
1189 ++ struct slcan *sl = tty->disc_data;
1190 ++
1191 ++ schedule_work(&sl->tx_work);
1192 + }
1193 +
1194 + /* Send a can_frame to a TTY queue. */
1195 +@@ -524,6 +536,7 @@ static struct slcan *slc_alloc(dev_t line)
1196 + sl->magic = SLCAN_MAGIC;
1197 + sl->dev = dev;
1198 + spin_lock_init(&sl->lock);
1199 ++ INIT_WORK(&sl->tx_work, slcan_transmit);
1200 + slcan_devs[i] = dev;
1201 +
1202 + return sl;
1203 +@@ -622,8 +635,12 @@ static void slcan_close(struct tty_struct *tty)
1204 + if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty)
1205 + return;
1206 +
1207 ++ spin_lock_bh(&sl->lock);
1208 + tty->disc_data = NULL;
1209 + sl->tty = NULL;
1210 ++ spin_unlock_bh(&sl->lock);
1211 ++
1212 ++ flush_work(&sl->tx_work);
1213 +
1214 + /* Flush network side */
1215 + unregister_netdev(sl->dev);
1216 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1217 +index 0399458e6d44..9846d3e712a1 100644
1218 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1219 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1220 +@@ -755,7 +755,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1221 +
1222 + return;
1223 + }
1224 +- bnx2x_frag_free(fp, new_data);
1225 ++ if (new_data)
1226 ++ bnx2x_frag_free(fp, new_data);
1227 + drop:
1228 + /* drop the packet and keep the buffer in the bin */
1229 + DP(NETIF_MSG_RX_STATUS,
1230 +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
1231 +index 2c38cc402119..5226c99813c7 100644
1232 +--- a/drivers/net/ethernet/emulex/benet/be_main.c
1233 ++++ b/drivers/net/ethernet/emulex/benet/be_main.c
1234 +@@ -2632,7 +2632,7 @@ static int be_open(struct net_device *netdev)
1235 +
1236 + for_all_evt_queues(adapter, eqo, i) {
1237 + napi_enable(&eqo->napi);
1238 +- be_eq_notify(adapter, eqo->q.id, true, false, 0);
1239 ++ be_eq_notify(adapter, eqo->q.id, true, true, 0);
1240 + }
1241 + adapter->flags |= BE_FLAGS_NAPI_ENABLED;
1242 +
1243 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1244 +index 42f0f6717511..70e16f71f574 100644
1245 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
1246 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
1247 +@@ -1374,7 +1374,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
1248 + /* RAR[1-6] are owned by manageability. Skip those and program the
1249 + * next address into the SHRA register array.
1250 + */
1251 +- if (index < (u32)(hw->mac.rar_entry_count - 6)) {
1252 ++ if (index < (u32)(hw->mac.rar_entry_count)) {
1253 + s32 ret_val;
1254 +
1255 + ret_val = e1000_acquire_swflag_ich8lan(hw);
1256 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
1257 +index 217090df33e7..59865695b282 100644
1258 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
1259 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
1260 +@@ -98,7 +98,7 @@
1261 + #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
1262 +
1263 + #define E1000_ICH_RAR_ENTRIES 7
1264 +-#define E1000_PCH2_RAR_ENTRIES 11 /* RAR[0-6], SHRA[0-3] */
1265 ++#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */
1266 + #define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */
1267 +
1268 + #define PHY_PAGE_SHIFT 5
1269 +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
1270 +index 47c2d10df826..974558e36588 100644
1271 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
1272 ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
1273 +@@ -1403,6 +1403,13 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
1274 + s32 ret_val;
1275 + u16 i, rar_count = mac->rar_entry_count;
1276 +
1277 ++ if ((hw->mac.type >= e1000_i210) &&
1278 ++ !(igb_get_flash_presence_i210(hw))) {
1279 ++ ret_val = igb_pll_workaround_i210(hw);
1280 ++ if (ret_val)
1281 ++ return ret_val;
1282 ++ }
1283 ++
1284 + /* Initialize identification LED */
1285 + ret_val = igb_id_led_init(hw);
1286 + if (ret_val) {
1287 +diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
1288 +index 978eca31ceda..956c4c3ae70b 100644
1289 +--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
1290 ++++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
1291 +@@ -46,14 +46,15 @@
1292 + /* Extended Device Control */
1293 + #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Defineable Pin 3 */
1294 + /* Physical Func Reset Done Indication */
1295 +-#define E1000_CTRL_EXT_PFRSTD 0x00004000
1296 +-#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
1297 +-#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
1298 +-#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000
1299 +-#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000
1300 +-#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
1301 +-#define E1000_CTRL_EXT_EIAME 0x01000000
1302 +-#define E1000_CTRL_EXT_IRCA 0x00000001
1303 ++#define E1000_CTRL_EXT_PFRSTD 0x00004000
1304 ++#define E1000_CTRL_EXT_SDLPE 0X00040000 /* SerDes Low Power Enable */
1305 ++#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
1306 ++#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
1307 ++#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000
1308 ++#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000
1309 ++#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
1310 ++#define E1000_CTRL_EXT_EIAME 0x01000000
1311 ++#define E1000_CTRL_EXT_IRCA 0x00000001
1312 + /* Interrupt delay cancellation */
1313 + /* Driver loaded bit for FW */
1314 + #define E1000_CTRL_EXT_DRV_LOAD 0x10000000
1315 +@@ -62,6 +63,7 @@
1316 + /* packet buffer parity error detection enabled */
1317 + /* descriptor FIFO parity error detection enable */
1318 + #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
1319 ++#define E1000_CTRL_EXT_PHYPDEN 0x00100000
1320 + #define E1000_I2CCMD_REG_ADDR_SHIFT 16
1321 + #define E1000_I2CCMD_PHY_ADDR_SHIFT 24
1322 + #define E1000_I2CCMD_OPCODE_READ 0x08000000
1323 +diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
1324 +index 37a9c06a6c68..80f20d1f1cfe 100644
1325 +--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
1326 ++++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
1327 +@@ -569,4 +569,7 @@ extern struct net_device *igb_get_hw_dev(struct e1000_hw *hw);
1328 + /* These functions must be implemented by drivers */
1329 + s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
1330 + s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
1331 ++
1332 ++void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
1333 ++void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
1334 + #endif /* _E1000_HW_H_ */
1335 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
1336 +index 0c0393316a3a..0217d4e229a0 100644
1337 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
1338 ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
1339 +@@ -835,3 +835,69 @@ s32 igb_init_nvm_params_i210(struct e1000_hw *hw)
1340 + }
1341 + return ret_val;
1342 + }
1343 ++
1344 ++/**
1345 ++ * igb_pll_workaround_i210
1346 ++ * @hw: pointer to the HW structure
1347 ++ *
1348 ++ * Works around an errata in the PLL circuit where it occasionally
1349 ++ * provides the wrong clock frequency after power up.
1350 ++ **/
1351 ++s32 igb_pll_workaround_i210(struct e1000_hw *hw)
1352 ++{
1353 ++ s32 ret_val;
1354 ++ u32 wuc, mdicnfg, ctrl, ctrl_ext, reg_val;
1355 ++ u16 nvm_word, phy_word, pci_word, tmp_nvm;
1356 ++ int i;
1357 ++
1358 ++ /* Get and set needed register values */
1359 ++ wuc = rd32(E1000_WUC);
1360 ++ mdicnfg = rd32(E1000_MDICNFG);
1361 ++ reg_val = mdicnfg & ~E1000_MDICNFG_EXT_MDIO;
1362 ++ wr32(E1000_MDICNFG, reg_val);
1363 ++
1364 ++ /* Get data from NVM, or set default */
1365 ++ ret_val = igb_read_invm_word_i210(hw, E1000_INVM_AUTOLOAD,
1366 ++ &nvm_word);
1367 ++ if (ret_val)
1368 ++ nvm_word = E1000_INVM_DEFAULT_AL;
1369 ++ tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
1370 ++ for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
1371 ++ /* check current state directly from internal PHY */
1372 ++ igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE |
1373 ++ E1000_PHY_PLL_FREQ_REG), &phy_word);
1374 ++ if ((phy_word & E1000_PHY_PLL_UNCONF)
1375 ++ != E1000_PHY_PLL_UNCONF) {
1376 ++ ret_val = 0;
1377 ++ break;
1378 ++ } else {
1379 ++ ret_val = -E1000_ERR_PHY;
1380 ++ }
1381 ++ /* directly reset the internal PHY */
1382 ++ ctrl = rd32(E1000_CTRL);
1383 ++ wr32(E1000_CTRL, ctrl|E1000_CTRL_PHY_RST);
1384 ++
1385 ++ ctrl_ext = rd32(E1000_CTRL_EXT);
1386 ++ ctrl_ext |= (E1000_CTRL_EXT_PHYPDEN | E1000_CTRL_EXT_SDLPE);
1387 ++ wr32(E1000_CTRL_EXT, ctrl_ext);
1388 ++
1389 ++ wr32(E1000_WUC, 0);
1390 ++ reg_val = (E1000_INVM_AUTOLOAD << 4) | (tmp_nvm << 16);
1391 ++ wr32(E1000_EEARBC_I210, reg_val);
1392 ++
1393 ++ igb_read_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
1394 ++ pci_word |= E1000_PCI_PMCSR_D3;
1395 ++ igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
1396 ++ usleep_range(1000, 2000);
1397 ++ pci_word &= ~E1000_PCI_PMCSR_D3;
1398 ++ igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
1399 ++ reg_val = (E1000_INVM_AUTOLOAD << 4) | (nvm_word << 16);
1400 ++ wr32(E1000_EEARBC_I210, reg_val);
1401 ++
1402 ++ /* restore WUC register */
1403 ++ wr32(E1000_WUC, wuc);
1404 ++ }
1405 ++ /* restore MDICNFG setting */
1406 ++ wr32(E1000_MDICNFG, mdicnfg);
1407 ++ return ret_val;
1408 ++}
1409 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.h b/drivers/net/ethernet/intel/igb/e1000_i210.h
1410 +index dde3c4b7ea99..99f4611d6f48 100644
1411 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.h
1412 ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.h
1413 +@@ -48,6 +48,7 @@ extern s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr,
1414 + u16 data);
1415 + extern s32 igb_init_nvm_params_i210(struct e1000_hw *hw);
1416 + extern bool igb_get_flash_presence_i210(struct e1000_hw *hw);
1417 ++s32 igb_pll_workaround_i210(struct e1000_hw *hw);
1418 +
1419 + #define E1000_STM_OPCODE 0xDB00
1420 + #define E1000_EEPROM_FLASH_SIZE_WORD 0x11
1421 +@@ -93,4 +94,15 @@ enum E1000_INVM_STRUCTURE_TYPE {
1422 + #define NVM_LED_1_CFG_DEFAULT_I211 0x0184
1423 + #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C
1424 +
1425 ++/* PLL Defines */
1426 ++#define E1000_PCI_PMCSR 0x44
1427 ++#define E1000_PCI_PMCSR_D3 0x03
1428 ++#define E1000_MAX_PLL_TRIES 5
1429 ++#define E1000_PHY_PLL_UNCONF 0xFF
1430 ++#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000
1431 ++#define E1000_PHY_PLL_FREQ_REG 0x000E
1432 ++#define E1000_INVM_DEFAULT_AL 0x202F
1433 ++#define E1000_INVM_AUTOLOAD 0x0A
1434 ++#define E1000_INVM_PLL_WO_VAL 0x0010
1435 ++
1436 + #endif
1437 +diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
1438 +index 82632c6c53af..7156981ec813 100644
1439 +--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
1440 ++++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
1441 +@@ -69,6 +69,7 @@
1442 + #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
1443 + #define E1000_PBS 0x01008 /* Packet Buffer Size */
1444 + #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
1445 ++#define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
1446 + #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
1447 + #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
1448 + #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */
1449 +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
1450 +index 8cf44f2a8ccd..76e43c417a31 100644
1451 +--- a/drivers/net/ethernet/intel/igb/igb_main.c
1452 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
1453 +@@ -6918,6 +6918,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
1454 + }
1455 + }
1456 +
1457 ++void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
1458 ++{
1459 ++ struct igb_adapter *adapter = hw->back;
1460 ++
1461 ++ pci_read_config_word(adapter->pdev, reg, value);
1462 ++}
1463 ++
1464 ++void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
1465 ++{
1466 ++ struct igb_adapter *adapter = hw->back;
1467 ++
1468 ++ pci_write_config_word(adapter->pdev, reg, *value);
1469 ++}
1470 ++
1471 + s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
1472 + {
1473 + struct igb_adapter *adapter = hw->back;
1474 +@@ -7281,6 +7295,8 @@ static int igb_sriov_reinit(struct pci_dev *dev)
1475 +
1476 + if (netif_running(netdev))
1477 + igb_close(netdev);
1478 ++ else
1479 ++ igb_reset(adapter);
1480 +
1481 + igb_clear_interrupt_scheme(adapter);
1482 +
1483 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
1484 +index 5cdd2b2f18c5..fabdda91fd0e 100644
1485 +--- a/drivers/net/ethernet/marvell/mvneta.c
1486 ++++ b/drivers/net/ethernet/marvell/mvneta.c
1487 +@@ -2358,7 +2358,7 @@ static void mvneta_adjust_link(struct net_device *ndev)
1488 +
1489 + if (phydev->speed == SPEED_1000)
1490 + val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
1491 +- else
1492 ++ else if (phydev->speed == SPEED_100)
1493 + val |= MVNETA_GMAC_CONFIG_MII_SPEED;
1494 +
1495 + mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
1496 +diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
1497 +index 3df56840a3b9..398faff8be7a 100644
1498 +--- a/drivers/net/ethernet/sun/sunvnet.c
1499 ++++ b/drivers/net/ethernet/sun/sunvnet.c
1500 +@@ -1083,6 +1083,24 @@ static struct vnet *vnet_find_or_create(const u64 *local_mac)
1501 + return vp;
1502 + }
1503 +
1504 ++static void vnet_cleanup(void)
1505 ++{
1506 ++ struct vnet *vp;
1507 ++ struct net_device *dev;
1508 ++
1509 ++ mutex_lock(&vnet_list_mutex);
1510 ++ while (!list_empty(&vnet_list)) {
1511 ++ vp = list_first_entry(&vnet_list, struct vnet, list);
1512 ++ list_del(&vp->list);
1513 ++ dev = vp->dev;
1514 ++ /* vio_unregister_driver() should have cleaned up port_list */
1515 ++ BUG_ON(!list_empty(&vp->port_list));
1516 ++ unregister_netdev(dev);
1517 ++ free_netdev(dev);
1518 ++ }
1519 ++ mutex_unlock(&vnet_list_mutex);
1520 ++}
1521 ++
1522 + static const char *local_mac_prop = "local-mac-address";
1523 +
1524 + static struct vnet *vnet_find_parent(struct mdesc_handle *hp,
1525 +@@ -1240,7 +1258,6 @@ static int vnet_port_remove(struct vio_dev *vdev)
1526 +
1527 + kfree(port);
1528 +
1529 +- unregister_netdev(vp->dev);
1530 + }
1531 + return 0;
1532 + }
1533 +@@ -1268,6 +1285,7 @@ static int __init vnet_init(void)
1534 + static void __exit vnet_exit(void)
1535 + {
1536 + vio_unregister_driver(&vnet_port_driver);
1537 ++ vnet_cleanup();
1538 + }
1539 +
1540 + module_init(vnet_init);
1541 +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
1542 +index 82ee6ed954cb..addd23246eb6 100644
1543 +--- a/drivers/net/ppp/pppoe.c
1544 ++++ b/drivers/net/ppp/pppoe.c
1545 +@@ -675,7 +675,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
1546 + po->chan.hdrlen = (sizeof(struct pppoe_hdr) +
1547 + dev->hard_header_len);
1548 +
1549 +- po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr);
1550 ++ po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2;
1551 + po->chan.private = sk;
1552 + po->chan.ops = &pppoe_chan_ops;
1553 +
1554 +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
1555 +index ad4a94e9ff57..87526443841f 100644
1556 +--- a/drivers/net/slip/slip.c
1557 ++++ b/drivers/net/slip/slip.c
1558 +@@ -83,6 +83,7 @@
1559 + #include <linux/delay.h>
1560 + #include <linux/init.h>
1561 + #include <linux/slab.h>
1562 ++#include <linux/workqueue.h>
1563 + #include "slip.h"
1564 + #ifdef CONFIG_INET
1565 + #include <linux/ip.h>
1566 +@@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
1567 + #endif
1568 + }
1569 +
1570 +-/*
1571 +- * Called by the driver when there's room for more data. If we have
1572 +- * more packets to send, we send them here.
1573 +- */
1574 +-static void slip_write_wakeup(struct tty_struct *tty)
1575 ++/* Write out any remaining transmit buffer. Scheduled when tty is writable */
1576 ++static void slip_transmit(struct work_struct *work)
1577 + {
1578 ++ struct slip *sl = container_of(work, struct slip, tx_work);
1579 + int actual;
1580 +- struct slip *sl = tty->disc_data;
1581 +
1582 ++ spin_lock_bh(&sl->lock);
1583 + /* First make sure we're connected. */
1584 +- if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
1585 ++ if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) {
1586 ++ spin_unlock_bh(&sl->lock);
1587 + return;
1588 ++ }
1589 +
1590 +- spin_lock_bh(&sl->lock);
1591 + if (sl->xleft <= 0) {
1592 + /* Now serial buffer is almost free & we can start
1593 + * transmission of another packet */
1594 + sl->dev->stats.tx_packets++;
1595 +- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1596 ++ clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
1597 + spin_unlock_bh(&sl->lock);
1598 + sl_unlock(sl);
1599 + return;
1600 + }
1601 +
1602 +- actual = tty->ops->write(tty, sl->xhead, sl->xleft);
1603 ++ actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
1604 + sl->xleft -= actual;
1605 + sl->xhead += actual;
1606 + spin_unlock_bh(&sl->lock);
1607 + }
1608 +
1609 ++/*
1610 ++ * Called by the driver when there's room for more data.
1611 ++ * Schedule the transmit.
1612 ++ */
1613 ++static void slip_write_wakeup(struct tty_struct *tty)
1614 ++{
1615 ++ struct slip *sl = tty->disc_data;
1616 ++
1617 ++ schedule_work(&sl->tx_work);
1618 ++}
1619 ++
1620 + static void sl_tx_timeout(struct net_device *dev)
1621 + {
1622 + struct slip *sl = netdev_priv(dev);
1623 +@@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line)
1624 + sl->magic = SLIP_MAGIC;
1625 + sl->dev = dev;
1626 + spin_lock_init(&sl->lock);
1627 ++ INIT_WORK(&sl->tx_work, slip_transmit);
1628 + sl->mode = SL_MODE_DEFAULT;
1629 + #ifdef CONFIG_SLIP_SMART
1630 + /* initialize timer_list struct */
1631 +@@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty)
1632 + if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty)
1633 + return;
1634 +
1635 ++ spin_lock_bh(&sl->lock);
1636 + tty->disc_data = NULL;
1637 + sl->tty = NULL;
1638 ++ spin_unlock_bh(&sl->lock);
1639 ++
1640 ++ flush_work(&sl->tx_work);
1641 +
1642 + /* VSV = very important to remove timers */
1643 + #ifdef CONFIG_SLIP_SMART
1644 +diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h
1645 +index 67673cf1266b..cf32aadf508f 100644
1646 +--- a/drivers/net/slip/slip.h
1647 ++++ b/drivers/net/slip/slip.h
1648 +@@ -53,6 +53,7 @@ struct slip {
1649 + struct tty_struct *tty; /* ptr to TTY structure */
1650 + struct net_device *dev; /* easy for intr handling */
1651 + spinlock_t lock;
1652 ++ struct work_struct tx_work; /* Flushes transmit buffer */
1653 +
1654 + #ifdef SL_INCLUDE_CSLIP
1655 + struct slcompress *slcomp; /* for header compression */
1656 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1657 +index 135fb3ac330f..2d8bf4232502 100644
1658 +--- a/drivers/net/usb/qmi_wwan.c
1659 ++++ b/drivers/net/usb/qmi_wwan.c
1660 +@@ -647,6 +647,7 @@ static const struct usb_device_id products[] = {
1661 + {QMI_FIXED_INTF(0x05c6, 0x9084, 4)},
1662 + {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
1663 + {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
1664 ++ {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
1665 + {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
1666 + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
1667 + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
1668 +@@ -721,6 +722,7 @@ static const struct usb_device_id products[] = {
1669 + {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
1670 + {QMI_FIXED_INTF(0x19d2, 0x1425, 2)},
1671 + {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */
1672 ++ {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */
1673 + {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
1674 + {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
1675 + {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1676 +@@ -733,6 +735,7 @@ static const struct usb_device_id products[] = {
1677 + {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
1678 + {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
1679 + {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */
1680 ++ {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
1681 + {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
1682 + {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
1683 + {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
1684 +diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
1685 +index d7ce2f12a907..6a5b7593ea42 100644
1686 +--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
1687 ++++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
1688 +@@ -1068,13 +1068,6 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1689 + /* recalculate basic rates */
1690 + iwl_calc_basic_rates(priv, ctx);
1691 +
1692 +- /*
1693 +- * force CTS-to-self frames protection if RTS-CTS is not preferred
1694 +- * one aggregation protection method
1695 +- */
1696 +- if (!priv->hw_params.use_rts_for_aggregation)
1697 +- ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1698 +-
1699 + if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
1700 + !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
1701 + ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
1702 +@@ -1480,11 +1473,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1703 + else
1704 + ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
1705 +
1706 +- if (bss_conf->use_cts_prot)
1707 +- ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1708 +- else
1709 +- ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN;
1710 +-
1711 + memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
1712 +
1713 + if (vif->type == NL80211_IFTYPE_AP ||
1714 +diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
1715 +index c2b91f566e05..edf5239d93df 100644
1716 +--- a/drivers/net/wireless/mwifiex/main.c
1717 ++++ b/drivers/net/wireless/mwifiex/main.c
1718 +@@ -654,6 +654,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1719 + }
1720 +
1721 + tx_info = MWIFIEX_SKB_TXCB(skb);
1722 ++ memset(tx_info, 0, sizeof(*tx_info));
1723 + tx_info->bss_num = priv->bss_num;
1724 + tx_info->bss_type = priv->bss_type;
1725 +
1726 +diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
1727 +index 6904818d3424..25aecf0fa339 100644
1728 +--- a/drivers/tty/serial/sirfsoc_uart.c
1729 ++++ b/drivers/tty/serial/sirfsoc_uart.c
1730 +@@ -359,9 +359,11 @@ static irqreturn_t sirfsoc_uart_usp_cts_handler(int irq, void *dev_id)
1731 + {
1732 + struct sirfsoc_uart_port *sirfport = (struct sirfsoc_uart_port *)dev_id;
1733 + struct uart_port *port = &sirfport->port;
1734 ++ spin_lock(&port->lock);
1735 + if (gpio_is_valid(sirfport->cts_gpio) && sirfport->ms_enabled)
1736 + uart_handle_cts_change(port,
1737 + !gpio_get_value(sirfport->cts_gpio));
1738 ++ spin_unlock(&port->lock);
1739 + return IRQ_HANDLED;
1740 + }
1741 +
1742 +@@ -429,10 +431,6 @@ sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count)
1743 + sirfport->rx_io_count += rx_count;
1744 + port->icount.rx += rx_count;
1745 +
1746 +- spin_unlock(&port->lock);
1747 +- tty_flip_buffer_push(&port->state->port);
1748 +- spin_lock(&port->lock);
1749 +-
1750 + return rx_count;
1751 + }
1752 +
1753 +@@ -466,6 +464,7 @@ static void sirfsoc_uart_tx_dma_complete_callback(void *param)
1754 + struct circ_buf *xmit = &port->state->xmit;
1755 + unsigned long flags;
1756 +
1757 ++ spin_lock_irqsave(&port->lock, flags);
1758 + xmit->tail = (xmit->tail + sirfport->transfer_size) &
1759 + (UART_XMIT_SIZE - 1);
1760 + port->icount.tx += sirfport->transfer_size;
1761 +@@ -474,10 +473,9 @@ static void sirfsoc_uart_tx_dma_complete_callback(void *param)
1762 + if (sirfport->tx_dma_addr)
1763 + dma_unmap_single(port->dev, sirfport->tx_dma_addr,
1764 + sirfport->transfer_size, DMA_TO_DEVICE);
1765 +- spin_lock_irqsave(&sirfport->tx_lock, flags);
1766 + sirfport->tx_dma_state = TX_DMA_IDLE;
1767 + sirfsoc_uart_tx_with_dma(sirfport);
1768 +- spin_unlock_irqrestore(&sirfport->tx_lock, flags);
1769 ++ spin_unlock_irqrestore(&port->lock, flags);
1770 + }
1771 +
1772 + static void sirfsoc_uart_insert_rx_buf_to_tty(
1773 +@@ -490,7 +488,6 @@ static void sirfsoc_uart_insert_rx_buf_to_tty(
1774 + inserted = tty_insert_flip_string(tport,
1775 + sirfport->rx_dma_items[sirfport->rx_completed].xmit.buf, count);
1776 + port->icount.rx += inserted;
1777 +- tty_flip_buffer_push(tport);
1778 + }
1779 +
1780 + static void sirfsoc_rx_submit_one_dma_desc(struct uart_port *port, int index)
1781 +@@ -525,7 +522,7 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param)
1782 + unsigned int count;
1783 + unsigned long flags;
1784 +
1785 +- spin_lock_irqsave(&sirfport->rx_lock, flags);
1786 ++ spin_lock_irqsave(&port->lock, flags);
1787 + while (sirfport->rx_completed != sirfport->rx_issued) {
1788 + sirfsoc_uart_insert_rx_buf_to_tty(sirfport,
1789 + SIRFSOC_RX_DMA_BUF_SIZE);
1790 +@@ -540,12 +537,8 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param)
1791 + wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl,
1792 + rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) |
1793 + SIRFUART_IO_MODE);
1794 +- spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1795 +- spin_lock(&port->lock);
1796 + sirfsoc_uart_pio_rx_chars(port, 4 - sirfport->rx_io_count);
1797 +- spin_unlock(&port->lock);
1798 + if (sirfport->rx_io_count == 4) {
1799 +- spin_lock_irqsave(&sirfport->rx_lock, flags);
1800 + sirfport->rx_io_count = 0;
1801 + wr_regl(port, ureg->sirfsoc_int_st_reg,
1802 + uint_st->sirfsoc_rx_done);
1803 +@@ -556,11 +549,8 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param)
1804 + else
1805 + wr_regl(port, SIRFUART_INT_EN_CLR,
1806 + uint_en->sirfsoc_rx_done_en);
1807 +- spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1808 +-
1809 + sirfsoc_uart_start_next_rx_dma(port);
1810 + } else {
1811 +- spin_lock_irqsave(&sirfport->rx_lock, flags);
1812 + wr_regl(port, ureg->sirfsoc_int_st_reg,
1813 + uint_st->sirfsoc_rx_done);
1814 + if (!sirfport->is_marco)
1815 +@@ -570,8 +560,9 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param)
1816 + else
1817 + wr_regl(port, ureg->sirfsoc_int_en_reg,
1818 + uint_en->sirfsoc_rx_done_en);
1819 +- spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1820 + }
1821 ++ spin_unlock_irqrestore(&port->lock, flags);
1822 ++ tty_flip_buffer_push(&port->state->port);
1823 + }
1824 +
1825 + static void sirfsoc_uart_handle_rx_tmo(struct sirfsoc_uart_port *sirfport)
1826 +@@ -580,8 +571,6 @@ static void sirfsoc_uart_handle_rx_tmo(struct sirfsoc_uart_port *sirfport)
1827 + struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
1828 + struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
1829 + struct dma_tx_state tx_state;
1830 +- spin_lock(&sirfport->rx_lock);
1831 +-
1832 + dmaengine_tx_status(sirfport->rx_dma_chan,
1833 + sirfport->rx_dma_items[sirfport->rx_issued].cookie, &tx_state);
1834 + dmaengine_terminate_all(sirfport->rx_dma_chan);
1835 +@@ -594,7 +583,6 @@ static void sirfsoc_uart_handle_rx_tmo(struct sirfsoc_uart_port *sirfport)
1836 + else
1837 + wr_regl(port, SIRFUART_INT_EN_CLR,
1838 + uint_en->sirfsoc_rx_timeout_en);
1839 +- spin_unlock(&sirfport->rx_lock);
1840 + tasklet_schedule(&sirfport->rx_tmo_process_tasklet);
1841 + }
1842 +
1843 +@@ -658,7 +646,6 @@ static irqreturn_t sirfsoc_uart_isr(int irq, void *dev_id)
1844 + intr_status &= port->read_status_mask;
1845 + uart_insert_char(port, intr_status,
1846 + uint_en->sirfsoc_rx_oflow_en, 0, flag);
1847 +- tty_flip_buffer_push(&state->port);
1848 + }
1849 + recv_char:
1850 + if ((sirfport->uart_reg->uart_type == SIRF_REAL_UART) &&
1851 +@@ -683,6 +670,9 @@ recv_char:
1852 + sirfsoc_uart_pio_rx_chars(port,
1853 + SIRFSOC_UART_IO_RX_MAX_CNT);
1854 + }
1855 ++ spin_unlock(&port->lock);
1856 ++ tty_flip_buffer_push(&state->port);
1857 ++ spin_lock(&port->lock);
1858 + if (intr_status & uint_st->sirfsoc_txfifo_empty) {
1859 + if (IS_DMA_CHAN_VALID(sirfport->tx_dma_no))
1860 + sirfsoc_uart_tx_with_dma(sirfport);
1861 +@@ -701,6 +691,7 @@ recv_char:
1862 + }
1863 + }
1864 + spin_unlock(&port->lock);
1865 ++
1866 + return IRQ_HANDLED;
1867 + }
1868 +
1869 +@@ -709,24 +700,27 @@ static void sirfsoc_uart_rx_dma_complete_tl(unsigned long param)
1870 + struct sirfsoc_uart_port *sirfport = (struct sirfsoc_uart_port *)param;
1871 + struct uart_port *port = &sirfport->port;
1872 + unsigned long flags;
1873 +- spin_lock_irqsave(&sirfport->rx_lock, flags);
1874 ++ spin_lock_irqsave(&port->lock, flags);
1875 + while (sirfport->rx_completed != sirfport->rx_issued) {
1876 + sirfsoc_uart_insert_rx_buf_to_tty(sirfport,
1877 + SIRFSOC_RX_DMA_BUF_SIZE);
1878 + sirfsoc_rx_submit_one_dma_desc(port, sirfport->rx_completed++);
1879 + sirfport->rx_completed %= SIRFSOC_RX_LOOP_BUF_CNT;
1880 + }
1881 +- spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1882 ++ spin_unlock_irqrestore(&port->lock, flags);
1883 ++ tty_flip_buffer_push(&port->state->port);
1884 + }
1885 +
1886 + static void sirfsoc_uart_rx_dma_complete_callback(void *param)
1887 + {
1888 + struct sirfsoc_uart_port *sirfport = (struct sirfsoc_uart_port *)param;
1889 +- spin_lock(&sirfport->rx_lock);
1890 ++ unsigned long flags;
1891 ++
1892 ++ spin_lock_irqsave(&sirfport->port.lock, flags);
1893 + sirfport->rx_issued++;
1894 + sirfport->rx_issued %= SIRFSOC_RX_LOOP_BUF_CNT;
1895 +- spin_unlock(&sirfport->rx_lock);
1896 + tasklet_schedule(&sirfport->rx_dma_complete_tasklet);
1897 ++ spin_unlock_irqrestore(&sirfport->port.lock, flags);
1898 + }
1899 +
1900 + /* submit rx dma task into dmaengine */
1901 +@@ -735,18 +729,14 @@ static void sirfsoc_uart_start_next_rx_dma(struct uart_port *port)
1902 + struct sirfsoc_uart_port *sirfport = to_sirfport(port);
1903 + struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
1904 + struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
1905 +- unsigned long flags;
1906 + int i;
1907 +- spin_lock_irqsave(&sirfport->rx_lock, flags);
1908 + sirfport->rx_io_count = 0;
1909 + wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl,
1910 + rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl) &
1911 + ~SIRFUART_IO_MODE);
1912 +- spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1913 + for (i = 0; i < SIRFSOC_RX_LOOP_BUF_CNT; i++)
1914 + sirfsoc_rx_submit_one_dma_desc(port, i);
1915 + sirfport->rx_completed = sirfport->rx_issued = 0;
1916 +- spin_lock_irqsave(&sirfport->rx_lock, flags);
1917 + if (!sirfport->is_marco)
1918 + wr_regl(port, ureg->sirfsoc_int_en_reg,
1919 + rd_regl(port, ureg->sirfsoc_int_en_reg) |
1920 +@@ -754,7 +744,6 @@ static void sirfsoc_uart_start_next_rx_dma(struct uart_port *port)
1921 + else
1922 + wr_regl(port, ureg->sirfsoc_int_en_reg,
1923 + SIRFUART_RX_DMA_INT_EN(port, uint_en));
1924 +- spin_unlock_irqrestore(&sirfport->rx_lock, flags);
1925 + }
1926 +
1927 + static void sirfsoc_uart_start_rx(struct uart_port *port)
1928 +@@ -1455,8 +1444,6 @@ usp_no_flow_control:
1929 + ret = -EFAULT;
1930 + goto err;
1931 + }
1932 +- spin_lock_init(&sirfport->rx_lock);
1933 +- spin_lock_init(&sirfport->tx_lock);
1934 + tasklet_init(&sirfport->rx_dma_complete_tasklet,
1935 + sirfsoc_uart_rx_dma_complete_tl, (unsigned long)sirfport);
1936 + tasklet_init(&sirfport->rx_tmo_process_tasklet,
1937 +diff --git a/drivers/tty/serial/sirfsoc_uart.h b/drivers/tty/serial/sirfsoc_uart.h
1938 +index fb8d0a002607..38cb159138f1 100644
1939 +--- a/drivers/tty/serial/sirfsoc_uart.h
1940 ++++ b/drivers/tty/serial/sirfsoc_uart.h
1941 +@@ -438,8 +438,6 @@ struct sirfsoc_uart_port {
1942 + struct dma_chan *tx_dma_chan;
1943 + dma_addr_t tx_dma_addr;
1944 + struct dma_async_tx_descriptor *tx_dma_desc;
1945 +- spinlock_t rx_lock;
1946 +- spinlock_t tx_lock;
1947 + struct tasklet_struct rx_dma_complete_tasklet;
1948 + struct tasklet_struct rx_tmo_process_tasklet;
1949 + unsigned int rx_io_count;
1950 +diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
1951 +index a18c2cfafe6d..455e4e6b9926 100644
1952 +--- a/drivers/usb/chipidea/udc.c
1953 ++++ b/drivers/usb/chipidea/udc.c
1954 +@@ -1178,8 +1178,8 @@ static int ep_enable(struct usb_ep *ep,
1955 +
1956 + if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
1957 + cap |= QH_IOS;
1958 +- if (hwep->num)
1959 +- cap |= QH_ZLT;
1960 ++
1961 ++ cap |= QH_ZLT;
1962 + cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
1963 + /*
1964 + * For ISO-TX, we set mult at QH as the largest value, and use
1965 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1966 +index 60a1f13db296..9c63a76cfedd 100644
1967 +--- a/drivers/usb/core/hub.c
1968 ++++ b/drivers/usb/core/hub.c
1969 +@@ -891,6 +891,25 @@ static int hub_usb3_port_disable(struct usb_hub *hub, int port1)
1970 + if (!hub_is_superspeed(hub->hdev))
1971 + return -EINVAL;
1972 +
1973 ++ ret = hub_port_status(hub, port1, &portstatus, &portchange);
1974 ++ if (ret < 0)
1975 ++ return ret;
1976 ++
1977 ++ /*
1978 ++ * USB controller Advanced Micro Devices, Inc. [AMD] FCH USB XHCI
1979 ++ * Controller [1022:7814] will have spurious result making the following
1980 ++ * usb 3.0 device hotplugging route to the 2.0 root hub and recognized
1981 ++ * as high-speed device if we set the usb 3.0 port link state to
1982 ++ * Disabled. Since it's already in USB_SS_PORT_LS_RX_DETECT state, we
1983 ++ * check the state here to avoid the bug.
1984 ++ */
1985 ++ if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
1986 ++ USB_SS_PORT_LS_RX_DETECT) {
1987 ++ dev_dbg(&hub->ports[port1 - 1]->dev,
1988 ++ "Not disabling port; link state is RxDetect\n");
1989 ++ return ret;
1990 ++ }
1991 ++
1992 + ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
1993 + if (ret)
1994 + return ret;
1995 +diff --git a/fs/aio.c b/fs/aio.c
1996 +index e609e15f36b9..6d68e01dc7ca 100644
1997 +--- a/fs/aio.c
1998 ++++ b/fs/aio.c
1999 +@@ -830,16 +830,20 @@ void exit_aio(struct mm_struct *mm)
2000 + static void put_reqs_available(struct kioctx *ctx, unsigned nr)
2001 + {
2002 + struct kioctx_cpu *kcpu;
2003 ++ unsigned long flags;
2004 +
2005 + preempt_disable();
2006 + kcpu = this_cpu_ptr(ctx->cpu);
2007 +
2008 ++ local_irq_save(flags);
2009 + kcpu->reqs_available += nr;
2010 ++
2011 + while (kcpu->reqs_available >= ctx->req_batch * 2) {
2012 + kcpu->reqs_available -= ctx->req_batch;
2013 + atomic_add(ctx->req_batch, &ctx->reqs_available);
2014 + }
2015 +
2016 ++ local_irq_restore(flags);
2017 + preempt_enable();
2018 + }
2019 +
2020 +@@ -847,10 +851,12 @@ static bool get_reqs_available(struct kioctx *ctx)
2021 + {
2022 + struct kioctx_cpu *kcpu;
2023 + bool ret = false;
2024 ++ unsigned long flags;
2025 +
2026 + preempt_disable();
2027 + kcpu = this_cpu_ptr(ctx->cpu);
2028 +
2029 ++ local_irq_save(flags);
2030 + if (!kcpu->reqs_available) {
2031 + int old, avail = atomic_read(&ctx->reqs_available);
2032 +
2033 +@@ -869,6 +875,7 @@ static bool get_reqs_available(struct kioctx *ctx)
2034 + ret = true;
2035 + kcpu->reqs_available--;
2036 + out:
2037 ++ local_irq_restore(flags);
2038 + preempt_enable();
2039 + return ret;
2040 + }
2041 +diff --git a/fs/coredump.c b/fs/coredump.c
2042 +index 02db009d1531..88adbdd15193 100644
2043 +--- a/fs/coredump.c
2044 ++++ b/fs/coredump.c
2045 +@@ -307,7 +307,7 @@ static int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
2046 + if (unlikely(nr < 0))
2047 + return nr;
2048 +
2049 +- tsk->flags = PF_DUMPCORE;
2050 ++ tsk->flags |= PF_DUMPCORE;
2051 + if (atomic_read(&mm->mm_users) == nr + 1)
2052 + goto done;
2053 + /*
2054 +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
2055 +index b7989f2ab4c4..936d40400c56 100644
2056 +--- a/fs/fuse/dir.c
2057 ++++ b/fs/fuse/dir.c
2058 +@@ -188,7 +188,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
2059 + inode = ACCESS_ONCE(entry->d_inode);
2060 + if (inode && is_bad_inode(inode))
2061 + goto invalid;
2062 +- else if (fuse_dentry_time(entry) < get_jiffies_64()) {
2063 ++ else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
2064 ++ (flags & LOOKUP_REVAL)) {
2065 + int err;
2066 + struct fuse_entry_out outarg;
2067 + struct fuse_req *req;
2068 +@@ -945,7 +946,7 @@ int fuse_update_attributes(struct inode *inode, struct kstat *stat,
2069 + int err;
2070 + bool r;
2071 +
2072 +- if (fi->i_time < get_jiffies_64()) {
2073 ++ if (time_before64(fi->i_time, get_jiffies_64())) {
2074 + r = true;
2075 + err = fuse_do_getattr(inode, stat, file);
2076 + } else {
2077 +@@ -1131,7 +1132,7 @@ static int fuse_permission(struct inode *inode, int mask)
2078 + ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
2079 + struct fuse_inode *fi = get_fuse_inode(inode);
2080 +
2081 +- if (fi->i_time < get_jiffies_64()) {
2082 ++ if (time_before64(fi->i_time, get_jiffies_64())) {
2083 + refreshed = true;
2084 +
2085 + err = fuse_perm_getattr(inode, mask);
2086 +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
2087 +index a8ce6dab60a0..4937d4b51253 100644
2088 +--- a/fs/fuse/inode.c
2089 ++++ b/fs/fuse/inode.c
2090 +@@ -461,6 +461,17 @@ static const match_table_t tokens = {
2091 + {OPT_ERR, NULL}
2092 + };
2093 +
2094 ++static int fuse_match_uint(substring_t *s, unsigned int *res)
2095 ++{
2096 ++ int err = -ENOMEM;
2097 ++ char *buf = match_strdup(s);
2098 ++ if (buf) {
2099 ++ err = kstrtouint(buf, 10, res);
2100 ++ kfree(buf);
2101 ++ }
2102 ++ return err;
2103 ++}
2104 ++
2105 + static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
2106 + {
2107 + char *p;
2108 +@@ -471,6 +482,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
2109 + while ((p = strsep(&opt, ",")) != NULL) {
2110 + int token;
2111 + int value;
2112 ++ unsigned uv;
2113 + substring_t args[MAX_OPT_ARGS];
2114 + if (!*p)
2115 + continue;
2116 +@@ -494,18 +506,18 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
2117 + break;
2118 +
2119 + case OPT_USER_ID:
2120 +- if (match_int(&args[0], &value))
2121 ++ if (fuse_match_uint(&args[0], &uv))
2122 + return 0;
2123 +- d->user_id = make_kuid(current_user_ns(), value);
2124 ++ d->user_id = make_kuid(current_user_ns(), uv);
2125 + if (!uid_valid(d->user_id))
2126 + return 0;
2127 + d->user_id_present = 1;
2128 + break;
2129 +
2130 + case OPT_GROUP_ID:
2131 +- if (match_int(&args[0], &value))
2132 ++ if (fuse_match_uint(&args[0], &uv))
2133 + return 0;
2134 +- d->group_id = make_kgid(current_user_ns(), value);
2135 ++ d->group_id = make_kgid(current_user_ns(), uv);
2136 + if (!gid_valid(d->group_id))
2137 + return 0;
2138 + d->group_id_present = 1;
2139 +diff --git a/fs/namei.c b/fs/namei.c
2140 +index 338d08b7eae2..e3249d565c95 100644
2141 +--- a/fs/namei.c
2142 ++++ b/fs/namei.c
2143 +@@ -2281,9 +2281,10 @@ done:
2144 + goto out;
2145 + }
2146 + path->dentry = dentry;
2147 +- path->mnt = mntget(nd->path.mnt);
2148 ++ path->mnt = nd->path.mnt;
2149 + if (should_follow_link(dentry->d_inode, nd->flags & LOOKUP_FOLLOW))
2150 + return 1;
2151 ++ mntget(path->mnt);
2152 + follow_mount(path);
2153 + error = 0;
2154 + out:
2155 +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
2156 +index 9cd5f63715c0..7f30bdc57d13 100644
2157 +--- a/fs/quota/dquot.c
2158 ++++ b/fs/quota/dquot.c
2159 +@@ -702,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
2160 + struct dquot *dquot;
2161 + unsigned long freed = 0;
2162 +
2163 ++ spin_lock(&dq_list_lock);
2164 + head = free_dquots.prev;
2165 + while (head != &free_dquots && sc->nr_to_scan) {
2166 + dquot = list_entry(head, struct dquot, dq_free);
2167 +@@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
2168 + freed++;
2169 + head = free_dquots.prev;
2170 + }
2171 ++ spin_unlock(&dq_list_lock);
2172 + return freed;
2173 + }
2174 +
2175 +diff --git a/include/linux/libata.h b/include/linux/libata.h
2176 +index 3fee55e73e5e..e13b3aef0b0c 100644
2177 +--- a/include/linux/libata.h
2178 ++++ b/include/linux/libata.h
2179 +@@ -593,6 +593,7 @@ struct ata_host {
2180 + struct device *dev;
2181 + void __iomem * const *iomap;
2182 + unsigned int n_ports;
2183 ++ unsigned int n_tags; /* nr of NCQ tags */
2184 + void *private_data;
2185 + struct ata_port_operations *ops;
2186 + unsigned long flags;
2187 +diff --git a/include/net/sock.h b/include/net/sock.h
2188 +index 4aa873a6267f..def541a583de 100644
2189 +--- a/include/net/sock.h
2190 ++++ b/include/net/sock.h
2191 +@@ -1749,8 +1749,8 @@ sk_dst_get(struct sock *sk)
2192 +
2193 + rcu_read_lock();
2194 + dst = rcu_dereference(sk->sk_dst_cache);
2195 +- if (dst)
2196 +- dst_hold(dst);
2197 ++ if (dst && !atomic_inc_not_zero(&dst->__refcnt))
2198 ++ dst = NULL;
2199 + rcu_read_unlock();
2200 + return dst;
2201 + }
2202 +@@ -1789,9 +1789,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
2203 + static inline void
2204 + sk_dst_set(struct sock *sk, struct dst_entry *dst)
2205 + {
2206 +- spin_lock(&sk->sk_dst_lock);
2207 +- __sk_dst_set(sk, dst);
2208 +- spin_unlock(&sk->sk_dst_lock);
2209 ++ struct dst_entry *old_dst;
2210 ++
2211 ++ sk_tx_queue_clear(sk);
2212 ++ old_dst = xchg(&sk->sk_dst_cache, dst);
2213 ++ dst_release(old_dst);
2214 + }
2215 +
2216 + static inline void
2217 +@@ -1803,9 +1805,7 @@ __sk_dst_reset(struct sock *sk)
2218 + static inline void
2219 + sk_dst_reset(struct sock *sk)
2220 + {
2221 +- spin_lock(&sk->sk_dst_lock);
2222 +- __sk_dst_reset(sk);
2223 +- spin_unlock(&sk->sk_dst_lock);
2224 ++ sk_dst_set(sk, NULL);
2225 + }
2226 +
2227 + extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
2228 +diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
2229 +index d2b32ac27a39..ecee67a00f5f 100644
2230 +--- a/kernel/Kconfig.locks
2231 ++++ b/kernel/Kconfig.locks
2232 +@@ -220,6 +220,9 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE
2233 +
2234 + endif
2235 +
2236 ++config ARCH_SUPPORTS_ATOMIC_RMW
2237 ++ bool
2238 ++
2239 + config MUTEX_SPIN_ON_OWNER
2240 + def_bool y
2241 +- depends on SMP && !DEBUG_MUTEXES
2242 ++ depends on SMP && !DEBUG_MUTEXES && ARCH_SUPPORTS_ATOMIC_RMW
2243 +diff --git a/kernel/power/process.c b/kernel/power/process.c
2244 +index 06ec8869dbf1..14f9a8d4725d 100644
2245 +--- a/kernel/power/process.c
2246 ++++ b/kernel/power/process.c
2247 +@@ -184,6 +184,7 @@ void thaw_processes(void)
2248 +
2249 + printk("Restarting tasks ... ");
2250 +
2251 ++ __usermodehelper_set_disable_depth(UMH_FREEZING);
2252 + thaw_workqueues();
2253 +
2254 + read_lock(&tasklist_lock);
2255 +diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
2256 +index fd9ca1de7559..0efe4a27540b 100644
2257 +--- a/kernel/sched/debug.c
2258 ++++ b/kernel/sched/debug.c
2259 +@@ -554,7 +554,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
2260 +
2261 + avg_atom = p->se.sum_exec_runtime;
2262 + if (nr_switches)
2263 +- do_div(avg_atom, nr_switches);
2264 ++ avg_atom = div64_ul(avg_atom, nr_switches);
2265 + else
2266 + avg_atom = -1LL;
2267 +
2268 +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
2269 +index 88c9c65a430d..fe75444ae7ec 100644
2270 +--- a/kernel/time/alarmtimer.c
2271 ++++ b/kernel/time/alarmtimer.c
2272 +@@ -585,9 +585,14 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
2273 + struct itimerspec *new_setting,
2274 + struct itimerspec *old_setting)
2275 + {
2276 ++ ktime_t exp;
2277 ++
2278 + if (!rtcdev)
2279 + return -ENOTSUPP;
2280 +
2281 ++ if (flags & ~TIMER_ABSTIME)
2282 ++ return -EINVAL;
2283 ++
2284 + if (old_setting)
2285 + alarm_timer_get(timr, old_setting);
2286 +
2287 +@@ -597,8 +602,16 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
2288 +
2289 + /* start the timer */
2290 + timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval);
2291 +- alarm_start(&timr->it.alarm.alarmtimer,
2292 +- timespec_to_ktime(new_setting->it_value));
2293 ++ exp = timespec_to_ktime(new_setting->it_value);
2294 ++ /* Convert (if necessary) to absolute time */
2295 ++ if (flags != TIMER_ABSTIME) {
2296 ++ ktime_t now;
2297 ++
2298 ++ now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();
2299 ++ exp = ktime_add(now, exp);
2300 ++ }
2301 ++
2302 ++ alarm_start(&timr->it.alarm.alarmtimer, exp);
2303 + return 0;
2304 + }
2305 +
2306 +@@ -730,6 +743,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
2307 + if (!alarmtimer_get_rtcdev())
2308 + return -ENOTSUPP;
2309 +
2310 ++ if (flags & ~TIMER_ABSTIME)
2311 ++ return -EINVAL;
2312 ++
2313 + if (!capable(CAP_WAKE_ALARM))
2314 + return -EPERM;
2315 +
2316 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
2317 +index a8642bac843e..d2ab10b3a30e 100644
2318 +--- a/kernel/trace/ftrace.c
2319 ++++ b/kernel/trace/ftrace.c
2320 +@@ -331,12 +331,12 @@ static void update_ftrace_function(void)
2321 + func = ftrace_ops_list_func;
2322 + }
2323 +
2324 ++ update_function_graph_func();
2325 ++
2326 + /* If there's no change, then do nothing more here */
2327 + if (ftrace_trace_function == func)
2328 + return;
2329 +
2330 +- update_function_graph_func();
2331 +-
2332 + /*
2333 + * If we are using the list function, it doesn't care
2334 + * about the function_trace_ops.
2335 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
2336 +index 15c4ae203885..a758ec217bc0 100644
2337 +--- a/kernel/trace/ring_buffer.c
2338 ++++ b/kernel/trace/ring_buffer.c
2339 +@@ -616,10 +616,6 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
2340 + struct ring_buffer_per_cpu *cpu_buffer;
2341 + struct rb_irq_work *work;
2342 +
2343 +- if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) ||
2344 +- (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu)))
2345 +- return POLLIN | POLLRDNORM;
2346 +-
2347 + if (cpu == RING_BUFFER_ALL_CPUS)
2348 + work = &buffer->irq_work;
2349 + else {
2350 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
2351 +index 5e9cb157d31e..dcdf4e682dd4 100644
2352 +--- a/kernel/trace/trace.c
2353 ++++ b/kernel/trace/trace.c
2354 +@@ -434,6 +434,12 @@ int __trace_puts(unsigned long ip, const char *str, int size)
2355 + struct print_entry *entry;
2356 + unsigned long irq_flags;
2357 + int alloc;
2358 ++ int pc;
2359 ++
2360 ++ if (!(trace_flags & TRACE_ITER_PRINTK))
2361 ++ return 0;
2362 ++
2363 ++ pc = preempt_count();
2364 +
2365 + if (unlikely(tracing_selftest_running || tracing_disabled))
2366 + return 0;
2367 +@@ -443,7 +449,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
2368 + local_save_flags(irq_flags);
2369 + buffer = global_trace.trace_buffer.buffer;
2370 + event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
2371 +- irq_flags, preempt_count());
2372 ++ irq_flags, pc);
2373 + if (!event)
2374 + return 0;
2375 +
2376 +@@ -460,6 +466,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
2377 + entry->buf[size] = '\0';
2378 +
2379 + __buffer_unlock_commit(buffer, event);
2380 ++ ftrace_trace_stack(buffer, irq_flags, 4, pc);
2381 +
2382 + return size;
2383 + }
2384 +@@ -477,6 +484,12 @@ int __trace_bputs(unsigned long ip, const char *str)
2385 + struct bputs_entry *entry;
2386 + unsigned long irq_flags;
2387 + int size = sizeof(struct bputs_entry);
2388 ++ int pc;
2389 ++
2390 ++ if (!(trace_flags & TRACE_ITER_PRINTK))
2391 ++ return 0;
2392 ++
2393 ++ pc = preempt_count();
2394 +
2395 + if (unlikely(tracing_selftest_running || tracing_disabled))
2396 + return 0;
2397 +@@ -484,7 +497,7 @@ int __trace_bputs(unsigned long ip, const char *str)
2398 + local_save_flags(irq_flags);
2399 + buffer = global_trace.trace_buffer.buffer;
2400 + event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
2401 +- irq_flags, preempt_count());
2402 ++ irq_flags, pc);
2403 + if (!event)
2404 + return 0;
2405 +
2406 +@@ -493,6 +506,7 @@ int __trace_bputs(unsigned long ip, const char *str)
2407 + entry->str = str;
2408 +
2409 + __buffer_unlock_commit(buffer, event);
2410 ++ ftrace_trace_stack(buffer, irq_flags, 4, pc);
2411 +
2412 + return 1;
2413 + }
2414 +@@ -750,7 +764,7 @@ static struct {
2415 + { trace_clock_local, "local", 1 },
2416 + { trace_clock_global, "global", 1 },
2417 + { trace_clock_counter, "counter", 0 },
2418 +- { trace_clock_jiffies, "uptime", 1 },
2419 ++ { trace_clock_jiffies, "uptime", 0 },
2420 + { trace_clock, "perf", 1 },
2421 + ARCH_TRACE_CLOCKS
2422 + };
2423 +diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
2424 +index 26dc348332b7..57b67b1f24d1 100644
2425 +--- a/kernel/trace/trace_clock.c
2426 ++++ b/kernel/trace/trace_clock.c
2427 +@@ -59,13 +59,14 @@ u64 notrace trace_clock(void)
2428 +
2429 + /*
2430 + * trace_jiffy_clock(): Simply use jiffies as a clock counter.
2431 ++ * Note that this use of jiffies_64 is not completely safe on
2432 ++ * 32-bit systems. But the window is tiny, and the effect if
2433 ++ * we are affected is that we will have an obviously bogus
2434 ++ * timestamp on a trace event - i.e. not life threatening.
2435 + */
2436 + u64 notrace trace_clock_jiffies(void)
2437 + {
2438 +- u64 jiffy = jiffies - INITIAL_JIFFIES;
2439 +-
2440 +- /* Return nsecs */
2441 +- return (u64)jiffies_to_usecs(jiffy) * 1000ULL;
2442 ++ return jiffies_64_to_clock_t(jiffies_64 - INITIAL_JIFFIES);
2443 + }
2444 +
2445 + /*
2446 +diff --git a/mm/kmemleak.c b/mm/kmemleak.c
2447 +index e126b0ef9ad2..31f01c5011e5 100644
2448 +--- a/mm/kmemleak.c
2449 ++++ b/mm/kmemleak.c
2450 +@@ -753,7 +753,9 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp)
2451 + }
2452 +
2453 + spin_lock_irqsave(&object->lock, flags);
2454 +- if (ptr + size > object->pointer + object->size) {
2455 ++ if (size == SIZE_MAX) {
2456 ++ size = object->pointer + object->size - ptr;
2457 ++ } else if (ptr + size > object->pointer + object->size) {
2458 + kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr);
2459 + dump_object_info(object);
2460 + kmem_cache_free(scan_area_cache, area);
2461 +diff --git a/mm/shmem.c b/mm/shmem.c
2462 +index 8297623fcaed..0da81aaeb4cc 100644
2463 +--- a/mm/shmem.c
2464 ++++ b/mm/shmem.c
2465 +@@ -80,11 +80,12 @@ static struct vfsmount *shm_mnt;
2466 + #define SHORT_SYMLINK_LEN 128
2467 +
2468 + /*
2469 +- * shmem_fallocate and shmem_writepage communicate via inode->i_private
2470 +- * (with i_mutex making sure that it has only one user at a time):
2471 +- * we would prefer not to enlarge the shmem inode just for that.
2472 ++ * shmem_fallocate communicates with shmem_fault or shmem_writepage via
2473 ++ * inode->i_private (with i_mutex making sure that it has only one user at
2474 ++ * a time): we would prefer not to enlarge the shmem inode just for that.
2475 + */
2476 + struct shmem_falloc {
2477 ++ wait_queue_head_t *waitq; /* faults into hole wait for punch to end */
2478 + pgoff_t start; /* start of range currently being fallocated */
2479 + pgoff_t next; /* the next page offset to be fallocated */
2480 + pgoff_t nr_falloced; /* how many new pages have been fallocated */
2481 +@@ -533,22 +534,19 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
2482 + return;
2483 +
2484 + index = start;
2485 +- for ( ; ; ) {
2486 ++ while (index < end) {
2487 + cond_resched();
2488 + pvec.nr = shmem_find_get_pages_and_swap(mapping, index,
2489 + min(end - index, (pgoff_t)PAGEVEC_SIZE),
2490 + pvec.pages, indices);
2491 + if (!pvec.nr) {
2492 +- if (index == start || unfalloc)
2493 ++ /* If all gone or hole-punch or unfalloc, we're done */
2494 ++ if (index == start || end != -1)
2495 + break;
2496 ++ /* But if truncating, restart to make sure all gone */
2497 + index = start;
2498 + continue;
2499 + }
2500 +- if ((index == start || unfalloc) && indices[0] >= end) {
2501 +- shmem_deswap_pagevec(&pvec);
2502 +- pagevec_release(&pvec);
2503 +- break;
2504 +- }
2505 + mem_cgroup_uncharge_start();
2506 + for (i = 0; i < pagevec_count(&pvec); i++) {
2507 + struct page *page = pvec.pages[i];
2508 +@@ -560,8 +558,12 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
2509 + if (radix_tree_exceptional_entry(page)) {
2510 + if (unfalloc)
2511 + continue;
2512 +- nr_swaps_freed += !shmem_free_swap(mapping,
2513 +- index, page);
2514 ++ if (shmem_free_swap(mapping, index, page)) {
2515 ++ /* Swap was replaced by page: retry */
2516 ++ index--;
2517 ++ break;
2518 ++ }
2519 ++ nr_swaps_freed++;
2520 + continue;
2521 + }
2522 +
2523 +@@ -570,6 +572,11 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
2524 + if (page->mapping == mapping) {
2525 + VM_BUG_ON(PageWriteback(page));
2526 + truncate_inode_page(mapping, page);
2527 ++ } else {
2528 ++ /* Page was replaced by swap: retry */
2529 ++ unlock_page(page);
2530 ++ index--;
2531 ++ break;
2532 + }
2533 + }
2534 + unlock_page(page);
2535 +@@ -826,6 +833,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
2536 + spin_lock(&inode->i_lock);
2537 + shmem_falloc = inode->i_private;
2538 + if (shmem_falloc &&
2539 ++ !shmem_falloc->waitq &&
2540 + index >= shmem_falloc->start &&
2541 + index < shmem_falloc->next)
2542 + shmem_falloc->nr_unswapped++;
2543 +@@ -1300,6 +1308,64 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
2544 + int error;
2545 + int ret = VM_FAULT_LOCKED;
2546 +
2547 ++ /*
2548 ++ * Trinity finds that probing a hole which tmpfs is punching can
2549 ++ * prevent the hole-punch from ever completing: which in turn
2550 ++ * locks writers out with its hold on i_mutex. So refrain from
2551 ++ * faulting pages into the hole while it's being punched. Although
2552 ++ * shmem_undo_range() does remove the additions, it may be unable to
2553 ++ * keep up, as each new page needs its own unmap_mapping_range() call,
2554 ++ * and the i_mmap tree grows ever slower to scan if new vmas are added.
2555 ++ *
2556 ++ * It does not matter if we sometimes reach this check just before the
2557 ++ * hole-punch begins, so that one fault then races with the punch:
2558 ++ * we just need to make racing faults a rare case.
2559 ++ *
2560 ++ * The implementation below would be much simpler if we just used a
2561 ++ * standard mutex or completion: but we cannot take i_mutex in fault,
2562 ++ * and bloating every shmem inode for this unlikely case would be sad.
2563 ++ */
2564 ++ if (unlikely(inode->i_private)) {
2565 ++ struct shmem_falloc *shmem_falloc;
2566 ++
2567 ++ spin_lock(&inode->i_lock);
2568 ++ shmem_falloc = inode->i_private;
2569 ++ if (shmem_falloc &&
2570 ++ shmem_falloc->waitq &&
2571 ++ vmf->pgoff >= shmem_falloc->start &&
2572 ++ vmf->pgoff < shmem_falloc->next) {
2573 ++ wait_queue_head_t *shmem_falloc_waitq;
2574 ++ DEFINE_WAIT(shmem_fault_wait);
2575 ++
2576 ++ ret = VM_FAULT_NOPAGE;
2577 ++ if ((vmf->flags & FAULT_FLAG_ALLOW_RETRY) &&
2578 ++ !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
2579 ++ /* It's polite to up mmap_sem if we can */
2580 ++ up_read(&vma->vm_mm->mmap_sem);
2581 ++ ret = VM_FAULT_RETRY;
2582 ++ }
2583 ++
2584 ++ shmem_falloc_waitq = shmem_falloc->waitq;
2585 ++ prepare_to_wait(shmem_falloc_waitq, &shmem_fault_wait,
2586 ++ TASK_UNINTERRUPTIBLE);
2587 ++ spin_unlock(&inode->i_lock);
2588 ++ schedule();
2589 ++
2590 ++ /*
2591 ++ * shmem_falloc_waitq points into the shmem_fallocate()
2592 ++ * stack of the hole-punching task: shmem_falloc_waitq
2593 ++ * is usually invalid by the time we reach here, but
2594 ++ * finish_wait() does not dereference it in that case;
2595 ++ * though i_lock needed lest racing with wake_up_all().
2596 ++ */
2597 ++ spin_lock(&inode->i_lock);
2598 ++ finish_wait(shmem_falloc_waitq, &shmem_fault_wait);
2599 ++ spin_unlock(&inode->i_lock);
2600 ++ return ret;
2601 ++ }
2602 ++ spin_unlock(&inode->i_lock);
2603 ++ }
2604 ++
2605 + error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret);
2606 + if (error)
2607 + return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS);
2608 +@@ -1819,12 +1885,25 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
2609 + struct address_space *mapping = file->f_mapping;
2610 + loff_t unmap_start = round_up(offset, PAGE_SIZE);
2611 + loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1;
2612 ++ DECLARE_WAIT_QUEUE_HEAD_ONSTACK(shmem_falloc_waitq);
2613 ++
2614 ++ shmem_falloc.waitq = &shmem_falloc_waitq;
2615 ++ shmem_falloc.start = unmap_start >> PAGE_SHIFT;
2616 ++ shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT;
2617 ++ spin_lock(&inode->i_lock);
2618 ++ inode->i_private = &shmem_falloc;
2619 ++ spin_unlock(&inode->i_lock);
2620 +
2621 + if ((u64)unmap_end > (u64)unmap_start)
2622 + unmap_mapping_range(mapping, unmap_start,
2623 + 1 + unmap_end - unmap_start, 0);
2624 + shmem_truncate_range(inode, offset, offset + len - 1);
2625 + /* No need to unmap again: hole-punching leaves COWed pages */
2626 ++
2627 ++ spin_lock(&inode->i_lock);
2628 ++ inode->i_private = NULL;
2629 ++ wake_up_all(&shmem_falloc_waitq);
2630 ++ spin_unlock(&inode->i_lock);
2631 + error = 0;
2632 + goto out;
2633 + }
2634 +@@ -1842,6 +1921,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
2635 + goto out;
2636 + }
2637 +
2638 ++ shmem_falloc.waitq = NULL;
2639 + shmem_falloc.start = start;
2640 + shmem_falloc.next = start;
2641 + shmem_falloc.nr_falloced = 0;
2642 +diff --git a/mm/slab_common.c b/mm/slab_common.c
2643 +index e2e98af703ea..97e5f5eeca12 100644
2644 +--- a/mm/slab_common.c
2645 ++++ b/mm/slab_common.c
2646 +@@ -56,7 +56,7 @@ static int kmem_cache_sanity_check(struct mem_cgroup *memcg, const char *name,
2647 + continue;
2648 + }
2649 +
2650 +-#if !defined(CONFIG_SLUB) || !defined(CONFIG_SLUB_DEBUG_ON)
2651 ++#if !defined(CONFIG_SLUB)
2652 + /*
2653 + * For simplicity, we won't check this in the list of memcg
2654 + * caches. We have control over memcg naming, and if there
2655 +diff --git a/mm/vmalloc.c b/mm/vmalloc.c
2656 +index 107454312d5e..e2be0f802ccf 100644
2657 +--- a/mm/vmalloc.c
2658 ++++ b/mm/vmalloc.c
2659 +@@ -359,6 +359,12 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
2660 + if (unlikely(!va))
2661 + return ERR_PTR(-ENOMEM);
2662 +
2663 ++ /*
2664 ++ * Only scan the relevant parts containing pointers to other objects
2665 ++ * to avoid false negatives.
2666 ++ */
2667 ++ kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask & GFP_RECLAIM_MASK);
2668 ++
2669 + retry:
2670 + spin_lock(&vmap_area_lock);
2671 + /*
2672 +@@ -1646,11 +1652,11 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
2673 + clear_vm_uninitialized_flag(area);
2674 +
2675 + /*
2676 +- * A ref_count = 3 is needed because the vm_struct and vmap_area
2677 +- * structures allocated in the __get_vm_area_node() function contain
2678 +- * references to the virtual address of the vmalloc'ed block.
2679 ++ * A ref_count = 2 is needed because vm_struct allocated in
2680 ++ * __get_vm_area_node() contains a reference to the virtual address of
2681 ++ * the vmalloc'ed block.
2682 + */
2683 +- kmemleak_alloc(addr, real_size, 3, gfp_mask);
2684 ++ kmemleak_alloc(addr, real_size, 2, gfp_mask);
2685 +
2686 + return addr;
2687 +
2688 +diff --git a/mm/vmscan.c b/mm/vmscan.c
2689 +index 1d891f49587b..5ad29b2925a0 100644
2690 +--- a/mm/vmscan.c
2691 ++++ b/mm/vmscan.c
2692 +@@ -1522,19 +1522,18 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
2693 + * If dirty pages are scanned that are not queued for IO, it
2694 + * implies that flushers are not keeping up. In this case, flag
2695 + * the zone ZONE_TAIL_LRU_DIRTY and kswapd will start writing
2696 +- * pages from reclaim context. It will forcibly stall in the
2697 +- * next check.
2698 ++ * pages from reclaim context.
2699 + */
2700 + if (nr_unqueued_dirty == nr_taken)
2701 + zone_set_flag(zone, ZONE_TAIL_LRU_DIRTY);
2702 +
2703 + /*
2704 +- * In addition, if kswapd scans pages marked marked for
2705 +- * immediate reclaim and under writeback (nr_immediate), it
2706 +- * implies that pages are cycling through the LRU faster than
2707 ++ * If kswapd scans pages marked marked for immediate
2708 ++ * reclaim and under writeback (nr_immediate), it implies
2709 ++ * that pages are cycling through the LRU faster than
2710 + * they are written so also forcibly stall.
2711 + */
2712 +- if (nr_unqueued_dirty == nr_taken || nr_immediate)
2713 ++ if (nr_immediate)
2714 + congestion_wait(BLK_RW_ASYNC, HZ/10);
2715 + }
2716 +
2717 +diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
2718 +index 6ee48aac776f..7e57135c7cc4 100644
2719 +--- a/net/8021q/vlan_core.c
2720 ++++ b/net/8021q/vlan_core.c
2721 +@@ -108,8 +108,11 @@ EXPORT_SYMBOL(vlan_dev_vlan_id);
2722 +
2723 + static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
2724 + {
2725 +- if (skb_cow(skb, skb_headroom(skb)) < 0)
2726 ++ if (skb_cow(skb, skb_headroom(skb)) < 0) {
2727 ++ kfree_skb(skb);
2728 + return NULL;
2729 ++ }
2730 ++
2731 + memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
2732 + skb->mac_header += VLAN_HLEN;
2733 + return skb;
2734 +diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
2735 +index 7d424ac6e760..43e875c84429 100644
2736 +--- a/net/appletalk/ddp.c
2737 ++++ b/net/appletalk/ddp.c
2738 +@@ -1489,8 +1489,6 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
2739 + goto drop;
2740 +
2741 + /* Queue packet (standard) */
2742 +- skb->sk = sock;
2743 +-
2744 + if (sock_queue_rcv_skb(sock, skb) < 0)
2745 + goto drop;
2746 +
2747 +@@ -1644,7 +1642,6 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
2748 + if (!skb)
2749 + goto out;
2750 +
2751 +- skb->sk = sk;
2752 + skb_reserve(skb, ddp_dl->header_length);
2753 + skb_reserve(skb, dev->hard_header_len);
2754 + skb->dev = dev;
2755 +diff --git a/net/core/dev.c b/net/core/dev.c
2756 +index 704c0c5bed1f..ef2f239cc322 100644
2757 +--- a/net/core/dev.c
2758 ++++ b/net/core/dev.c
2759 +@@ -1202,7 +1202,11 @@ EXPORT_SYMBOL(netdev_features_change);
2760 + void netdev_state_change(struct net_device *dev)
2761 + {
2762 + if (dev->flags & IFF_UP) {
2763 +- call_netdevice_notifiers(NETDEV_CHANGE, dev);
2764 ++ struct netdev_notifier_change_info change_info;
2765 ++
2766 ++ change_info.flags_changed = 0;
2767 ++ call_netdevice_notifiers_info(NETDEV_CHANGE, dev,
2768 ++ &change_info.info);
2769 + rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
2770 + }
2771 + }
2772 +diff --git a/net/core/dst.c b/net/core/dst.c
2773 +index ca4231ec7347..15b6792e6ebb 100644
2774 +--- a/net/core/dst.c
2775 ++++ b/net/core/dst.c
2776 +@@ -267,6 +267,15 @@ again:
2777 + }
2778 + EXPORT_SYMBOL(dst_destroy);
2779 +
2780 ++static void dst_destroy_rcu(struct rcu_head *head)
2781 ++{
2782 ++ struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head);
2783 ++
2784 ++ dst = dst_destroy(dst);
2785 ++ if (dst)
2786 ++ __dst_free(dst);
2787 ++}
2788 ++
2789 + void dst_release(struct dst_entry *dst)
2790 + {
2791 + if (dst) {
2792 +@@ -274,11 +283,8 @@ void dst_release(struct dst_entry *dst)
2793 +
2794 + newrefcnt = atomic_dec_return(&dst->__refcnt);
2795 + WARN_ON(newrefcnt < 0);
2796 +- if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) {
2797 +- dst = dst_destroy(dst);
2798 +- if (dst)
2799 +- __dst_free(dst);
2800 +- }
2801 ++ if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
2802 ++ call_rcu(&dst->rcu_head, dst_destroy_rcu);
2803 + }
2804 + }
2805 + EXPORT_SYMBOL(dst_release);
2806 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
2807 +index 5a60953e6f39..aeb870c5c134 100644
2808 +--- a/net/core/skbuff.c
2809 ++++ b/net/core/skbuff.c
2810 +@@ -2744,12 +2744,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
2811 + int i = 0;
2812 + int pos;
2813 +
2814 ++ __skb_push(head_skb, doffset);
2815 + proto = skb_network_protocol(head_skb);
2816 + if (unlikely(!proto))
2817 + return ERR_PTR(-EINVAL);
2818 +
2819 + csum = !!can_checksum_protocol(features, proto);
2820 +- __skb_push(head_skb, doffset);
2821 ++
2822 + headroom = skb_headroom(head_skb);
2823 + pos = skb_headlen(head_skb);
2824 +
2825 +diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
2826 +index c32be292c7e3..ede0e2d7412e 100644
2827 +--- a/net/dns_resolver/dns_query.c
2828 ++++ b/net/dns_resolver/dns_query.c
2829 +@@ -150,7 +150,9 @@ int dns_query(const char *type, const char *name, size_t namelen,
2830 + if (!*_result)
2831 + goto put;
2832 +
2833 +- memcpy(*_result, upayload->data, len + 1);
2834 ++ memcpy(*_result, upayload->data, len);
2835 ++ *_result[len] = '\0';
2836 ++
2837 + if (_expiry)
2838 + *_expiry = rkey->expiry;
2839 +
2840 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2841 +index 5f7d11a45871..ff670cab5af5 100644
2842 +--- a/net/ipv4/icmp.c
2843 ++++ b/net/ipv4/icmp.c
2844 +@@ -705,8 +705,6 @@ static void icmp_unreach(struct sk_buff *skb)
2845 + &iph->daddr);
2846 + } else {
2847 + info = ntohs(icmph->un.frag.mtu);
2848 +- if (!info)
2849 +- goto out;
2850 + }
2851 + break;
2852 + case ICMP_SR_FAILED:
2853 +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
2854 +index 7defdc9ba167..9fa5c0908ce3 100644
2855 +--- a/net/ipv4/igmp.c
2856 ++++ b/net/ipv4/igmp.c
2857 +@@ -1952,6 +1952,10 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
2858 +
2859 + rtnl_lock();
2860 + in_dev = ip_mc_find_dev(net, imr);
2861 ++ if (!in_dev) {
2862 ++ ret = -ENODEV;
2863 ++ goto out;
2864 ++ }
2865 + ifindex = imr->imr_ifindex;
2866 + for (imlp = &inet->mc_list;
2867 + (iml = rtnl_dereference(*imlp)) != NULL;
2868 +@@ -1969,16 +1973,14 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
2869 +
2870 + *imlp = iml->next_rcu;
2871 +
2872 +- if (in_dev)
2873 +- ip_mc_dec_group(in_dev, group);
2874 ++ ip_mc_dec_group(in_dev, group);
2875 + rtnl_unlock();
2876 + /* decrease mem now to avoid the memleak warning */
2877 + atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
2878 + kfree_rcu(iml, rcu);
2879 + return 0;
2880 + }
2881 +- if (!in_dev)
2882 +- ret = -ENODEV;
2883 ++out:
2884 + rtnl_unlock();
2885 + return ret;
2886 + }
2887 +diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
2888 +index ec7264514a82..089ed81d1878 100644
2889 +--- a/net/ipv4/ip_options.c
2890 ++++ b/net/ipv4/ip_options.c
2891 +@@ -288,6 +288,10 @@ int ip_options_compile(struct net *net,
2892 + optptr++;
2893 + continue;
2894 + }
2895 ++ if (unlikely(l < 2)) {
2896 ++ pp_ptr = optptr;
2897 ++ goto error;
2898 ++ }
2899 + optlen = optptr[1];
2900 + if (optlen<2 || optlen>l) {
2901 + pp_ptr = optptr;
2902 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
2903 +index d9dbe0f78612..edd5a8171357 100644
2904 +--- a/net/ipv4/ip_tunnel.c
2905 ++++ b/net/ipv4/ip_tunnel.c
2906 +@@ -166,6 +166,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2907 +
2908 + hlist_for_each_entry_rcu(t, head, hash_node) {
2909 + if (remote != t->parms.iph.daddr ||
2910 ++ t->parms.iph.saddr != 0 ||
2911 + !(t->dev->flags & IFF_UP))
2912 + continue;
2913 +
2914 +@@ -182,10 +183,11 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2915 + head = &itn->tunnels[hash];
2916 +
2917 + hlist_for_each_entry_rcu(t, head, hash_node) {
2918 +- if ((local != t->parms.iph.saddr &&
2919 +- (local != t->parms.iph.daddr ||
2920 +- !ipv4_is_multicast(local))) ||
2921 +- !(t->dev->flags & IFF_UP))
2922 ++ if ((local != t->parms.iph.saddr || t->parms.iph.daddr != 0) &&
2923 ++ (local != t->parms.iph.daddr || !ipv4_is_multicast(local)))
2924 ++ continue;
2925 ++
2926 ++ if (!(t->dev->flags & IFF_UP))
2927 + continue;
2928 +
2929 + if (!ip_tunnel_key_match(&t->parms, flags, key))
2930 +@@ -202,6 +204,8 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2931 +
2932 + hlist_for_each_entry_rcu(t, head, hash_node) {
2933 + if (t->parms.i_key != key ||
2934 ++ t->parms.iph.saddr != 0 ||
2935 ++ t->parms.iph.daddr != 0 ||
2936 + !(t->dev->flags & IFF_UP))
2937 + continue;
2938 +
2939 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
2940 +index 2b681867164d..310963d7c028 100644
2941 +--- a/net/ipv4/route.c
2942 ++++ b/net/ipv4/route.c
2943 +@@ -1032,20 +1032,21 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2944 + const struct iphdr *iph = (const struct iphdr *) skb->data;
2945 + struct flowi4 fl4;
2946 + struct rtable *rt;
2947 +- struct dst_entry *dst;
2948 ++ struct dst_entry *odst = NULL;
2949 + bool new = false;
2950 +
2951 + bh_lock_sock(sk);
2952 +- rt = (struct rtable *) __sk_dst_get(sk);
2953 ++ odst = sk_dst_get(sk);
2954 +
2955 +- if (sock_owned_by_user(sk) || !rt) {
2956 ++ if (sock_owned_by_user(sk) || !odst) {
2957 + __ipv4_sk_update_pmtu(skb, sk, mtu);
2958 + goto out;
2959 + }
2960 +
2961 + __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
2962 +
2963 +- if (!__sk_dst_check(sk, 0)) {
2964 ++ rt = (struct rtable *)odst;
2965 ++ if (odst->obsolete && odst->ops->check(odst, 0) == NULL) {
2966 + rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
2967 + if (IS_ERR(rt))
2968 + goto out;
2969 +@@ -1055,8 +1056,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2970 +
2971 + __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu);
2972 +
2973 +- dst = dst_check(&rt->dst, 0);
2974 +- if (!dst) {
2975 ++ if (!dst_check(&rt->dst, 0)) {
2976 + if (new)
2977 + dst_release(&rt->dst);
2978 +
2979 +@@ -1068,10 +1068,11 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2980 + }
2981 +
2982 + if (new)
2983 +- __sk_dst_set(sk, &rt->dst);
2984 ++ sk_dst_set(sk, &rt->dst);
2985 +
2986 + out:
2987 + bh_unlock_sock(sk);
2988 ++ dst_release(odst);
2989 + }
2990 + EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu);
2991 +
2992 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
2993 +index 531ab5721d79..cbe5adaad338 100644
2994 +--- a/net/ipv4/tcp.c
2995 ++++ b/net/ipv4/tcp.c
2996 +@@ -1064,7 +1064,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
2997 + if (unlikely(tp->repair)) {
2998 + if (tp->repair_queue == TCP_RECV_QUEUE) {
2999 + copied = tcp_send_rcvq(sk, msg, size);
3000 +- goto out;
3001 ++ goto out_nopush;
3002 + }
3003 +
3004 + err = -EINVAL;
3005 +@@ -1237,6 +1237,7 @@ wait_for_memory:
3006 + out:
3007 + if (copied)
3008 + tcp_push(sk, flags, mss_now, tp->nonagle);
3009 ++out_nopush:
3010 + release_sock(sk);
3011 + return copied + copied_syn;
3012 +
3013 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
3014 +index 0e8af08a98fc..95f67671f56e 100644
3015 +--- a/net/ipv4/tcp_input.c
3016 ++++ b/net/ipv4/tcp_input.c
3017 +@@ -1064,7 +1064,7 @@ static bool tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb,
3018 + }
3019 +
3020 + /* D-SACK for already forgotten data... Do dumb counting. */
3021 +- if (dup_sack && tp->undo_marker && tp->undo_retrans &&
3022 ++ if (dup_sack && tp->undo_marker && tp->undo_retrans > 0 &&
3023 + !after(end_seq_0, prior_snd_una) &&
3024 + after(end_seq_0, tp->undo_marker))
3025 + tp->undo_retrans--;
3026 +@@ -1120,7 +1120,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb,
3027 + unsigned int new_len = (pkt_len / mss) * mss;
3028 + if (!in_sack && new_len < pkt_len) {
3029 + new_len += mss;
3030 +- if (new_len > skb->len)
3031 ++ if (new_len >= skb->len)
3032 + return 0;
3033 + }
3034 + pkt_len = new_len;
3035 +@@ -1144,7 +1144,7 @@ static u8 tcp_sacktag_one(struct sock *sk,
3036 +
3037 + /* Account D-SACK for retransmitted packet. */
3038 + if (dup_sack && (sacked & TCPCB_RETRANS)) {
3039 +- if (tp->undo_marker && tp->undo_retrans &&
3040 ++ if (tp->undo_marker && tp->undo_retrans > 0 &&
3041 + after(end_seq, tp->undo_marker))
3042 + tp->undo_retrans--;
3043 + if (sacked & TCPCB_SACKED_ACKED)
3044 +@@ -1845,7 +1845,7 @@ static void tcp_clear_retrans_partial(struct tcp_sock *tp)
3045 + tp->lost_out = 0;
3046 +
3047 + tp->undo_marker = 0;
3048 +- tp->undo_retrans = 0;
3049 ++ tp->undo_retrans = -1;
3050 + }
3051 +
3052 + void tcp_clear_retrans(struct tcp_sock *tp)
3053 +@@ -2613,7 +2613,7 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)
3054 +
3055 + tp->prior_ssthresh = 0;
3056 + tp->undo_marker = tp->snd_una;
3057 +- tp->undo_retrans = tp->retrans_out;
3058 ++ tp->undo_retrans = tp->retrans_out ? : -1;
3059 +
3060 + if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
3061 + if (!ece_ack)
3062 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
3063 +index 826fc6fab576..0cce660cf7dd 100644
3064 +--- a/net/ipv4/tcp_output.c
3065 ++++ b/net/ipv4/tcp_output.c
3066 +@@ -2437,8 +2437,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
3067 + if (!tp->retrans_stamp)
3068 + tp->retrans_stamp = TCP_SKB_CB(skb)->when;
3069 +
3070 +- tp->undo_retrans += tcp_skb_pcount(skb);
3071 +-
3072 + /* snd_nxt is stored to detect loss of retransmitted segment,
3073 + * see tcp_input.c tcp_sacktag_write_queue().
3074 + */
3075 +@@ -2446,6 +2444,10 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
3076 + } else {
3077 + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);
3078 + }
3079 ++
3080 ++ if (tp->undo_retrans < 0)
3081 ++ tp->undo_retrans = 0;
3082 ++ tp->undo_retrans += tcp_skb_pcount(skb);
3083 + return err;
3084 + }
3085 +
3086 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
3087 +index e6d457c4a4e4..d9a2598a5190 100644
3088 +--- a/net/netlink/af_netlink.c
3089 ++++ b/net/netlink/af_netlink.c
3090 +@@ -628,7 +628,7 @@ static unsigned int netlink_poll(struct file *file, struct socket *sock,
3091 + while (nlk->cb_running && netlink_dump_space(nlk)) {
3092 + err = netlink_dump(sk);
3093 + if (err < 0) {
3094 +- sk->sk_err = err;
3095 ++ sk->sk_err = -err;
3096 + sk->sk_error_report(sk);
3097 + break;
3098 + }
3099 +@@ -2440,7 +2440,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
3100 + atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
3101 + ret = netlink_dump(sk);
3102 + if (ret) {
3103 +- sk->sk_err = ret;
3104 ++ sk->sk_err = -ret;
3105 + sk->sk_error_report(sk);
3106 + }
3107 + }
3108 +diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
3109 +index 3e5ac1948607..968355f0de60 100644
3110 +--- a/net/sctp/sysctl.c
3111 ++++ b/net/sctp/sysctl.c
3112 +@@ -303,41 +303,40 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl,
3113 + loff_t *ppos)
3114 + {
3115 + struct net *net = current->nsproxy->net_ns;
3116 +- char tmp[8];
3117 + struct ctl_table tbl;
3118 +- int ret;
3119 +- int changed = 0;
3120 ++ bool changed = false;
3121 + char *none = "none";
3122 ++ char tmp[8];
3123 ++ int ret;
3124 +
3125 + memset(&tbl, 0, sizeof(struct ctl_table));
3126 +
3127 + if (write) {
3128 + tbl.data = tmp;
3129 +- tbl.maxlen = 8;
3130 ++ tbl.maxlen = sizeof(tmp);
3131 + } else {
3132 + tbl.data = net->sctp.sctp_hmac_alg ? : none;
3133 + tbl.maxlen = strlen(tbl.data);
3134 + }
3135 +- ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
3136 +
3137 +- if (write) {
3138 ++ ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
3139 ++ if (write && ret == 0) {
3140 + #ifdef CONFIG_CRYPTO_MD5
3141 + if (!strncmp(tmp, "md5", 3)) {
3142 + net->sctp.sctp_hmac_alg = "md5";
3143 +- changed = 1;
3144 ++ changed = true;
3145 + }
3146 + #endif
3147 + #ifdef CONFIG_CRYPTO_SHA1
3148 + if (!strncmp(tmp, "sha1", 4)) {
3149 + net->sctp.sctp_hmac_alg = "sha1";
3150 +- changed = 1;
3151 ++ changed = true;
3152 + }
3153 + #endif
3154 + if (!strncmp(tmp, "none", 4)) {
3155 + net->sctp.sctp_hmac_alg = NULL;
3156 +- changed = 1;
3157 ++ changed = true;
3158 + }
3159 +-
3160 + if (!changed)
3161 + ret = -EINVAL;
3162 + }
3163 +@@ -362,8 +361,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
3164 + tbl.data = &net->sctp.auth_enable;
3165 +
3166 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
3167 +-
3168 +- if (write) {
3169 ++ if (write && ret == 0) {
3170 + struct sock *sk = net->sctp.ctl_sock;
3171 +
3172 + net->sctp.auth_enable = new_value;
3173 +diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
3174 +index 81089ed65456..12c37cee80e5 100644
3175 +--- a/net/sctp/ulpevent.c
3176 ++++ b/net/sctp/ulpevent.c
3177 +@@ -367,9 +367,10 @@ fail:
3178 + * specification [SCTP] and any extensions for a list of possible
3179 + * error formats.
3180 + */
3181 +-struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
3182 +- const struct sctp_association *asoc, struct sctp_chunk *chunk,
3183 +- __u16 flags, gfp_t gfp)
3184 ++struct sctp_ulpevent *
3185 ++sctp_ulpevent_make_remote_error(const struct sctp_association *asoc,
3186 ++ struct sctp_chunk *chunk, __u16 flags,
3187 ++ gfp_t gfp)
3188 + {
3189 + struct sctp_ulpevent *event;
3190 + struct sctp_remote_error *sre;
3191 +@@ -388,8 +389,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
3192 + /* Copy the skb to a new skb with room for us to prepend
3193 + * notification with.
3194 + */
3195 +- skb = skb_copy_expand(chunk->skb, sizeof(struct sctp_remote_error),
3196 +- 0, gfp);
3197 ++ skb = skb_copy_expand(chunk->skb, sizeof(*sre), 0, gfp);
3198 +
3199 + /* Pull off the rest of the cause TLV from the chunk. */
3200 + skb_pull(chunk->skb, elen);
3201 +@@ -400,62 +400,21 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
3202 + event = sctp_skb2event(skb);
3203 + sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
3204 +
3205 +- sre = (struct sctp_remote_error *)
3206 +- skb_push(skb, sizeof(struct sctp_remote_error));
3207 ++ sre = (struct sctp_remote_error *) skb_push(skb, sizeof(*sre));
3208 +
3209 + /* Trim the buffer to the right length. */
3210 +- skb_trim(skb, sizeof(struct sctp_remote_error) + elen);
3211 ++ skb_trim(skb, sizeof(*sre) + elen);
3212 +
3213 +- /* Socket Extensions for SCTP
3214 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3215 +- *
3216 +- * sre_type:
3217 +- * It should be SCTP_REMOTE_ERROR.
3218 +- */
3219 ++ /* RFC6458, Section 6.1.3. SCTP_REMOTE_ERROR */
3220 ++ memset(sre, 0, sizeof(*sre));
3221 + sre->sre_type = SCTP_REMOTE_ERROR;
3222 +-
3223 +- /*
3224 +- * Socket Extensions for SCTP
3225 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3226 +- *
3227 +- * sre_flags: 16 bits (unsigned integer)
3228 +- * Currently unused.
3229 +- */
3230 + sre->sre_flags = 0;
3231 +-
3232 +- /* Socket Extensions for SCTP
3233 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3234 +- *
3235 +- * sre_length: sizeof (__u32)
3236 +- *
3237 +- * This field is the total length of the notification data,
3238 +- * including the notification header.
3239 +- */
3240 + sre->sre_length = skb->len;
3241 +-
3242 +- /* Socket Extensions for SCTP
3243 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3244 +- *
3245 +- * sre_error: 16 bits (unsigned integer)
3246 +- * This value represents one of the Operational Error causes defined in
3247 +- * the SCTP specification, in network byte order.
3248 +- */
3249 + sre->sre_error = cause;
3250 +-
3251 +- /* Socket Extensions for SCTP
3252 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3253 +- *
3254 +- * sre_assoc_id: sizeof (sctp_assoc_t)
3255 +- *
3256 +- * The association id field, holds the identifier for the association.
3257 +- * All notifications for a given association have the same association
3258 +- * identifier. For TCP style socket, this field is ignored.
3259 +- */
3260 + sctp_ulpevent_set_owner(event, asoc);
3261 + sre->sre_assoc_id = sctp_assoc2id(asoc);
3262 +
3263 + return event;
3264 +-
3265 + fail:
3266 + return NULL;
3267 + }
3268 +@@ -900,7 +859,9 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
3269 + return notification->sn_header.sn_type;
3270 + }
3271 +
3272 +-/* Copy out the sndrcvinfo into a msghdr. */
3273 ++/* RFC6458, Section 5.3.2. SCTP Header Information Structure
3274 ++ * (SCTP_SNDRCV, DEPRECATED)
3275 ++ */
3276 + void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
3277 + struct msghdr *msghdr)
3278 + {
3279 +@@ -909,74 +870,21 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
3280 + if (sctp_ulpevent_is_notification(event))
3281 + return;
3282 +
3283 +- /* Sockets API Extensions for SCTP
3284 +- * Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
3285 +- *
3286 +- * sinfo_stream: 16 bits (unsigned integer)
3287 +- *
3288 +- * For recvmsg() the SCTP stack places the message's stream number in
3289 +- * this value.
3290 +- */
3291 ++ memset(&sinfo, 0, sizeof(sinfo));
3292 + sinfo.sinfo_stream = event->stream;
3293 +- /* sinfo_ssn: 16 bits (unsigned integer)
3294 +- *
3295 +- * For recvmsg() this value contains the stream sequence number that
3296 +- * the remote endpoint placed in the DATA chunk. For fragmented
3297 +- * messages this is the same number for all deliveries of the message
3298 +- * (if more than one recvmsg() is needed to read the message).
3299 +- */
3300 + sinfo.sinfo_ssn = event->ssn;
3301 +- /* sinfo_ppid: 32 bits (unsigned integer)
3302 +- *
3303 +- * In recvmsg() this value is
3304 +- * the same information that was passed by the upper layer in the peer
3305 +- * application. Please note that byte order issues are NOT accounted
3306 +- * for and this information is passed opaquely by the SCTP stack from
3307 +- * one end to the other.
3308 +- */
3309 + sinfo.sinfo_ppid = event->ppid;
3310 +- /* sinfo_flags: 16 bits (unsigned integer)
3311 +- *
3312 +- * This field may contain any of the following flags and is composed of
3313 +- * a bitwise OR of these values.
3314 +- *
3315 +- * recvmsg() flags:
3316 +- *
3317 +- * SCTP_UNORDERED - This flag is present when the message was sent
3318 +- * non-ordered.
3319 +- */
3320 + sinfo.sinfo_flags = event->flags;
3321 +- /* sinfo_tsn: 32 bit (unsigned integer)
3322 +- *
3323 +- * For the receiving side, this field holds a TSN that was
3324 +- * assigned to one of the SCTP Data Chunks.
3325 +- */
3326 + sinfo.sinfo_tsn = event->tsn;
3327 +- /* sinfo_cumtsn: 32 bit (unsigned integer)
3328 +- *
3329 +- * This field will hold the current cumulative TSN as
3330 +- * known by the underlying SCTP layer. Note this field is
3331 +- * ignored when sending and only valid for a receive
3332 +- * operation when sinfo_flags are set to SCTP_UNORDERED.
3333 +- */
3334 + sinfo.sinfo_cumtsn = event->cumtsn;
3335 +- /* sinfo_assoc_id: sizeof (sctp_assoc_t)
3336 +- *
3337 +- * The association handle field, sinfo_assoc_id, holds the identifier
3338 +- * for the association announced in the COMMUNICATION_UP notification.
3339 +- * All notifications for a given association have the same identifier.
3340 +- * Ignored for one-to-one style sockets.
3341 +- */
3342 + sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc);
3343 +-
3344 +- /* context value that is set via SCTP_CONTEXT socket option. */
3345 ++ /* Context value that is set via SCTP_CONTEXT socket option. */
3346 + sinfo.sinfo_context = event->asoc->default_rcv_context;
3347 +-
3348 + /* These fields are not used while receiving. */
3349 + sinfo.sinfo_timetolive = 0;
3350 +
3351 + put_cmsg(msghdr, IPPROTO_SCTP, SCTP_SNDRCV,
3352 +- sizeof(struct sctp_sndrcvinfo), (void *)&sinfo);
3353 ++ sizeof(sinfo), &sinfo);
3354 + }
3355 +
3356 + /* Do accounting for bytes received and hold a reference to the association
3357 +diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
3358 +index 716de1ac6cb5..6ef89256b2fb 100644
3359 +--- a/net/tipc/bcast.c
3360 ++++ b/net/tipc/bcast.c
3361 +@@ -531,6 +531,7 @@ receive:
3362 +
3363 + buf = node->bclink.deferred_head;
3364 + node->bclink.deferred_head = buf->next;
3365 ++ buf->next = NULL;
3366 + node->bclink.deferred_size--;
3367 + goto receive;
3368 + }
3369 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3370 +index ee1a6ff120a2..37806a97c878 100644
3371 +--- a/sound/pci/hda/hda_intel.c
3372 ++++ b/sound/pci/hda/hda_intel.c
3373 +@@ -2917,7 +2917,7 @@ static int azx_suspend(struct device *dev)
3374 + struct azx *chip = card->private_data;
3375 + struct azx_pcm *p;
3376 +
3377 +- if (chip->disabled)
3378 ++ if (chip->disabled || chip->init_failed)
3379 + return 0;
3380 +
3381 + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
3382 +@@ -2948,7 +2948,7 @@ static int azx_resume(struct device *dev)
3383 + struct snd_card *card = dev_get_drvdata(dev);
3384 + struct azx *chip = card->private_data;
3385 +
3386 +- if (chip->disabled)
3387 ++ if (chip->disabled || chip->init_failed)
3388 + return 0;
3389 +
3390 + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
3391 +@@ -2983,7 +2983,7 @@ static int azx_runtime_suspend(struct device *dev)
3392 + struct snd_card *card = dev_get_drvdata(dev);
3393 + struct azx *chip = card->private_data;
3394 +
3395 +- if (chip->disabled)
3396 ++ if (chip->disabled || chip->init_failed)
3397 + return 0;
3398 +
3399 + if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
3400 +@@ -3009,7 +3009,7 @@ static int azx_runtime_resume(struct device *dev)
3401 + struct hda_codec *codec;
3402 + int status;
3403 +
3404 +- if (chip->disabled)
3405 ++ if (chip->disabled || chip->init_failed)
3406 + return 0;
3407 +
3408 + if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
3409 +@@ -3044,7 +3044,7 @@ static int azx_runtime_idle(struct device *dev)
3410 + struct snd_card *card = dev_get_drvdata(dev);
3411 + struct azx *chip = card->private_data;
3412 +
3413 +- if (chip->disabled)
3414 ++ if (chip->disabled || chip->init_failed)
3415 + return 0;
3416 +
3417 + if (!power_save_controller ||