Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.15 commit in: /
Date: Mon, 28 Jul 2014 19:52:47
Message-Id: 1406577151.94a9a7887bfaf98b5d92f0975c2c2d250427ef14.mpagano@gentoo
1 commit: 94a9a7887bfaf98b5d92f0975c2c2d250427ef14
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 28 19:52:31 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 28 19:52:31 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=94a9a788
7
8 Linux patch 3.15.7
9
10 ---
11 0000_README | 4 +
12 1006_linux-3.15.7.patch | 3766 +++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 3770 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index 69ec900..afe4465 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -67,6 +67,10 @@ Patch: 1005_linux-3.15.6.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.15.6
22
23 +Patch: 1006_linux-3.15.7.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.15.7
26 +
27 Patch: 1700_enable-thinkpad-micled.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=449248
29 Desc: Enable mic mute led in thinkpads
30
31 diff --git a/1006_linux-3.15.7.patch b/1006_linux-3.15.7.patch
32 new file mode 100644
33 index 0000000..272a4cd
34 --- /dev/null
35 +++ b/1006_linux-3.15.7.patch
36 @@ -0,0 +1,3766 @@
37 +diff --git a/Makefile b/Makefile
38 +index fefa0237c2d1..833f67f3f80f 100644
39 +--- a/Makefile
40 ++++ b/Makefile
41 +@@ -1,6 +1,6 @@
42 + VERSION = 3
43 + PATCHLEVEL = 15
44 +-SUBLEVEL = 6
45 ++SUBLEVEL = 7
46 + EXTRAVERSION =
47 + NAME = Shuffling Zombie Juror
48 +
49 +diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h
50 +index 2618cc13ba75..76a7739aab1c 100644
51 +--- a/arch/arc/include/uapi/asm/ptrace.h
52 ++++ b/arch/arc/include/uapi/asm/ptrace.h
53 +@@ -11,6 +11,7 @@
54 + #ifndef _UAPI__ASM_ARC_PTRACE_H
55 + #define _UAPI__ASM_ARC_PTRACE_H
56 +
57 ++#define PTRACE_GET_THREAD_AREA 25
58 +
59 + #ifndef __ASSEMBLY__
60 + /*
61 +diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
62 +index 5d76706139dd..13b3ffb27a38 100644
63 +--- a/arch/arc/kernel/ptrace.c
64 ++++ b/arch/arc/kernel/ptrace.c
65 +@@ -146,6 +146,10 @@ long arch_ptrace(struct task_struct *child, long request,
66 + pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data);
67 +
68 + switch (request) {
69 ++ case PTRACE_GET_THREAD_AREA:
70 ++ ret = put_user(task_thread_info(child)->thr_ptr,
71 ++ (unsigned long __user *)data);
72 ++ break;
73 + default:
74 + ret = ptrace_request(child, request, addr, data);
75 + break;
76 +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
77 +index db3c5414223e..34c7a24714a7 100644
78 +--- a/arch/arm/Kconfig
79 ++++ b/arch/arm/Kconfig
80 +@@ -6,6 +6,7 @@ config ARM
81 + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
82 + select ARCH_HAVE_CUSTOM_GPIO_H
83 + select ARCH_MIGHT_HAVE_PC_PARPORT
84 ++ select ARCH_SUPPORTS_ATOMIC_RMW
85 + select ARCH_USE_BUILTIN_BSWAP
86 + select ARCH_USE_CMPXCHG_LOCKREF
87 + select ARCH_WANT_IPC_PARSE_VERSION
88 +diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
89 +index ea323f09dc78..413d8f0594cb 100644
90 +--- a/arch/arm/boot/dts/imx25.dtsi
91 ++++ b/arch/arm/boot/dts/imx25.dtsi
92 +@@ -14,6 +14,7 @@
93 +
94 + / {
95 + aliases {
96 ++ ethernet0 = &fec;
97 + gpio0 = &gpio1;
98 + gpio1 = &gpio2;
99 + gpio2 = &gpio3;
100 +diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
101 +index 137e010eab35..00cf66c1b8f3 100644
102 +--- a/arch/arm/boot/dts/imx27.dtsi
103 ++++ b/arch/arm/boot/dts/imx27.dtsi
104 +@@ -16,6 +16,7 @@
105 +
106 + / {
107 + aliases {
108 ++ ethernet0 = &fec;
109 + gpio0 = &gpio1;
110 + gpio1 = &gpio2;
111 + gpio2 = &gpio3;
112 +diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
113 +index 88b218f8f810..e59ccb4d98e3 100644
114 +--- a/arch/arm/boot/dts/imx35.dtsi
115 ++++ b/arch/arm/boot/dts/imx35.dtsi
116 +@@ -13,6 +13,7 @@
117 +
118 + / {
119 + aliases {
120 ++ ethernet0 = &fec;
121 + gpio0 = &gpio1;
122 + gpio1 = &gpio2;
123 + gpio2 = &gpio3;
124 +diff --git a/arch/arm/boot/dts/imx50.dtsi b/arch/arm/boot/dts/imx50.dtsi
125 +index 9c89d1ca97c2..6a201cf54366 100644
126 +--- a/arch/arm/boot/dts/imx50.dtsi
127 ++++ b/arch/arm/boot/dts/imx50.dtsi
128 +@@ -17,6 +17,7 @@
129 +
130 + / {
131 + aliases {
132 ++ ethernet0 = &fec;
133 + gpio0 = &gpio1;
134 + gpio1 = &gpio2;
135 + gpio2 = &gpio3;
136 +diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
137 +index 150bb4e2f744..51b86700cd88 100644
138 +--- a/arch/arm/boot/dts/imx51.dtsi
139 ++++ b/arch/arm/boot/dts/imx51.dtsi
140 +@@ -19,6 +19,7 @@
141 +
142 + / {
143 + aliases {
144 ++ ethernet0 = &fec;
145 + gpio0 = &gpio1;
146 + gpio1 = &gpio2;
147 + gpio2 = &gpio3;
148 +diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
149 +index 6a1bf4ff83d5..eaa627fa82ba 100644
150 +--- a/arch/arm/boot/dts/imx53.dtsi
151 ++++ b/arch/arm/boot/dts/imx53.dtsi
152 +@@ -18,6 +18,7 @@
153 +
154 + / {
155 + aliases {
156 ++ ethernet0 = &fec;
157 + gpio0 = &gpio1;
158 + gpio1 = &gpio2;
159 + gpio2 = &gpio3;
160 +diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
161 +index eca0971d4db1..02a6afca7530 100644
162 +--- a/arch/arm/boot/dts/imx6qdl.dtsi
163 ++++ b/arch/arm/boot/dts/imx6qdl.dtsi
164 +@@ -16,6 +16,7 @@
165 +
166 + / {
167 + aliases {
168 ++ ethernet0 = &fec;
169 + can0 = &can1;
170 + can1 = &can2;
171 + gpio0 = &gpio1;
172 +diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
173 +index d26b099260a3..2d4e5285f3f3 100644
174 +--- a/arch/arm/boot/dts/imx6sl.dtsi
175 ++++ b/arch/arm/boot/dts/imx6sl.dtsi
176 +@@ -14,6 +14,7 @@
177 +
178 + / {
179 + aliases {
180 ++ ethernet0 = &fec;
181 + gpio0 = &gpio1;
182 + gpio1 = &gpio2;
183 + gpio2 = &gpio3;
184 +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
185 +index e759af5d7098..6376a39b767e 100644
186 +--- a/arch/arm64/Kconfig
187 ++++ b/arch/arm64/Kconfig
188 +@@ -2,6 +2,7 @@ config ARM64
189 + def_bool y
190 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
191 + select ARCH_USE_CMPXCHG_LOCKREF
192 ++ select ARCH_SUPPORTS_ATOMIC_RMW
193 + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
194 + select ARCH_WANT_OPTIONAL_GPIOLIB
195 + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
196 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
197 +index c95c4b8c3e74..004851f3d841 100644
198 +--- a/arch/powerpc/Kconfig
199 ++++ b/arch/powerpc/Kconfig
200 +@@ -145,6 +145,7 @@ config PPC
201 + select HAVE_IRQ_EXIT_ON_IRQ_STACK
202 + select ARCH_USE_CMPXCHG_LOCKREF if PPC64
203 + select HAVE_ARCH_AUDITSYSCALL
204 ++ select ARCH_SUPPORTS_ATOMIC_RMW
205 +
206 + config GENERIC_CSUM
207 + def_bool CPU_LITTLE_ENDIAN
208 +diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
209 +index 29f2e988c56a..407c87d9879a 100644
210 +--- a/arch/sparc/Kconfig
211 ++++ b/arch/sparc/Kconfig
212 +@@ -78,6 +78,7 @@ config SPARC64
213 + select HAVE_C_RECORDMCOUNT
214 + select NO_BOOTMEM
215 + select HAVE_ARCH_AUDITSYSCALL
216 ++ select ARCH_SUPPORTS_ATOMIC_RMW
217 +
218 + config ARCH_DEFCONFIG
219 + string
220 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
221 +index 6b8b429c832f..512e45f0c204 100644
222 +--- a/arch/x86/Kconfig
223 ++++ b/arch/x86/Kconfig
224 +@@ -130,6 +130,7 @@ config X86
225 + select HAVE_CC_STACKPROTECTOR
226 + select GENERIC_CPU_AUTOPROBE
227 + select HAVE_ARCH_AUDITSYSCALL
228 ++ select ARCH_SUPPORTS_ATOMIC_RMW
229 +
230 + config INSTRUCTION_DECODER
231 + def_bool y
232 +diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
233 +index 84c223479e3c..7a6d43a554d7 100644
234 +--- a/arch/x86/boot/header.S
235 ++++ b/arch/x86/boot/header.S
236 +@@ -91,10 +91,9 @@ bs_die:
237 +
238 + .section ".bsdata", "a"
239 + bugger_off_msg:
240 +- .ascii "Direct floppy boot is not supported. "
241 +- .ascii "Use a boot loader program instead.\r\n"
242 ++ .ascii "Use a boot loader.\r\n"
243 + .ascii "\n"
244 +- .ascii "Remove disk and press any key to reboot ...\r\n"
245 ++ .ascii "Remove disk and press any key to reboot...\r\n"
246 + .byte 0
247 +
248 + #ifdef CONFIG_EFI_STUB
249 +@@ -108,7 +107,7 @@ coff_header:
250 + #else
251 + .word 0x8664 # x86-64
252 + #endif
253 +- .word 3 # nr_sections
254 ++ .word 4 # nr_sections
255 + .long 0 # TimeDateStamp
256 + .long 0 # PointerToSymbolTable
257 + .long 1 # NumberOfSymbols
258 +@@ -250,6 +249,25 @@ section_table:
259 + .word 0 # NumberOfLineNumbers
260 + .long 0x60500020 # Characteristics (section flags)
261 +
262 ++ #
263 ++ # The offset & size fields are filled in by build.c.
264 ++ #
265 ++ .ascii ".bss"
266 ++ .byte 0
267 ++ .byte 0
268 ++ .byte 0
269 ++ .byte 0
270 ++ .long 0
271 ++ .long 0x0
272 ++ .long 0 # Size of initialized data
273 ++ # on disk
274 ++ .long 0x0
275 ++ .long 0 # PointerToRelocations
276 ++ .long 0 # PointerToLineNumbers
277 ++ .word 0 # NumberOfRelocations
278 ++ .word 0 # NumberOfLineNumbers
279 ++ .long 0xc8000080 # Characteristics (section flags)
280 ++
281 + #endif /* CONFIG_EFI_STUB */
282 +
283 + # Kernel attributes; used by setup. This is part 1 of the
284 +diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
285 +index 1a2f2121cada..a7661c430cd9 100644
286 +--- a/arch/x86/boot/tools/build.c
287 ++++ b/arch/x86/boot/tools/build.c
288 +@@ -143,7 +143,7 @@ static void usage(void)
289 +
290 + #ifdef CONFIG_EFI_STUB
291 +
292 +-static void update_pecoff_section_header(char *section_name, u32 offset, u32 size)
293 ++static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset)
294 + {
295 + unsigned int pe_header;
296 + unsigned short num_sections;
297 +@@ -164,10 +164,10 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz
298 + put_unaligned_le32(size, section + 0x8);
299 +
300 + /* section header vma field */
301 +- put_unaligned_le32(offset, section + 0xc);
302 ++ put_unaligned_le32(vma, section + 0xc);
303 +
304 + /* section header 'size of initialised data' field */
305 +- put_unaligned_le32(size, section + 0x10);
306 ++ put_unaligned_le32(datasz, section + 0x10);
307 +
308 + /* section header 'file offset' field */
309 + put_unaligned_le32(offset, section + 0x14);
310 +@@ -179,6 +179,11 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz
311 + }
312 + }
313 +
314 ++static void update_pecoff_section_header(char *section_name, u32 offset, u32 size)
315 ++{
316 ++ update_pecoff_section_header_fields(section_name, offset, size, size, offset);
317 ++}
318 ++
319 + static void update_pecoff_setup_and_reloc(unsigned int size)
320 + {
321 + u32 setup_offset = 0x200;
322 +@@ -203,9 +208,6 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz)
323 +
324 + pe_header = get_unaligned_le32(&buf[0x3c]);
325 +
326 +- /* Size of image */
327 +- put_unaligned_le32(file_sz, &buf[pe_header + 0x50]);
328 +-
329 + /*
330 + * Size of code: Subtract the size of the first sector (512 bytes)
331 + * which includes the header.
332 +@@ -220,6 +222,22 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz)
333 + update_pecoff_section_header(".text", text_start, text_sz);
334 + }
335 +
336 ++static void update_pecoff_bss(unsigned int file_sz, unsigned int init_sz)
337 ++{
338 ++ unsigned int pe_header;
339 ++ unsigned int bss_sz = init_sz - file_sz;
340 ++
341 ++ pe_header = get_unaligned_le32(&buf[0x3c]);
342 ++
343 ++ /* Size of uninitialized data */
344 ++ put_unaligned_le32(bss_sz, &buf[pe_header + 0x24]);
345 ++
346 ++ /* Size of image */
347 ++ put_unaligned_le32(init_sz, &buf[pe_header + 0x50]);
348 ++
349 ++ update_pecoff_section_header_fields(".bss", file_sz, bss_sz, 0, 0);
350 ++}
351 ++
352 + static int reserve_pecoff_reloc_section(int c)
353 + {
354 + /* Reserve 0x20 bytes for .reloc section */
355 +@@ -259,6 +277,8 @@ static void efi_stub_entry_update(void)
356 + static inline void update_pecoff_setup_and_reloc(unsigned int size) {}
357 + static inline void update_pecoff_text(unsigned int text_start,
358 + unsigned int file_sz) {}
359 ++static inline void update_pecoff_bss(unsigned int file_sz,
360 ++ unsigned int init_sz) {}
361 + static inline void efi_stub_defaults(void) {}
362 + static inline void efi_stub_entry_update(void) {}
363 +
364 +@@ -310,7 +330,7 @@ static void parse_zoffset(char *fname)
365 +
366 + int main(int argc, char ** argv)
367 + {
368 +- unsigned int i, sz, setup_sectors;
369 ++ unsigned int i, sz, setup_sectors, init_sz;
370 + int c;
371 + u32 sys_size;
372 + struct stat sb;
373 +@@ -376,7 +396,9 @@ int main(int argc, char ** argv)
374 + buf[0x1f1] = setup_sectors-1;
375 + put_unaligned_le32(sys_size, &buf[0x1f4]);
376 +
377 +- update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz));
378 ++ update_pecoff_text(setup_sectors * 512, i + (sys_size * 16));
379 ++ init_sz = get_unaligned_le32(&buf[0x260]);
380 ++ update_pecoff_bss(i + (sys_size * 16), init_sz);
381 +
382 + efi_stub_entry_update();
383 +
384 +diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
385 +index adb02aa62af5..07846d738bdb 100644
386 +--- a/arch/x86/kernel/cpu/perf_event_intel.c
387 ++++ b/arch/x86/kernel/cpu/perf_event_intel.c
388 +@@ -1382,6 +1382,15 @@ again:
389 + intel_pmu_lbr_read();
390 +
391 + /*
392 ++ * CondChgd bit 63 doesn't mean any overflow status. Ignore
393 ++ * and clear the bit.
394 ++ */
395 ++ if (__test_and_clear_bit(63, (unsigned long *)&status)) {
396 ++ if (!status)
397 ++ goto done;
398 ++ }
399 ++
400 ++ /*
401 + * PEBS overflow sets bit 62 in the global status register
402 + */
403 + if (__test_and_clear_bit(62, (unsigned long *)&status)) {
404 +diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
405 +index 57e5ce126d5a..ea030319b321 100644
406 +--- a/arch/x86/kernel/tsc.c
407 ++++ b/arch/x86/kernel/tsc.c
408 +@@ -920,9 +920,9 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
409 + tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
410 + if (!(freq->flags & CPUFREQ_CONST_LOOPS))
411 + mark_tsc_unstable("cpufreq changes");
412 +- }
413 +
414 +- set_cyc2ns_scale(tsc_khz, freq->cpu);
415 ++ set_cyc2ns_scale(tsc_khz, freq->cpu);
416 ++ }
417 +
418 + return 0;
419 + }
420 +diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
421 +index a83b57e57b63..e625969bb921 100644
422 +--- a/drivers/bluetooth/ath3k.c
423 ++++ b/drivers/bluetooth/ath3k.c
424 +@@ -90,7 +90,6 @@ static const struct usb_device_id ath3k_table[] = {
425 + { USB_DEVICE(0x0b05, 0x17d0) },
426 + { USB_DEVICE(0x0CF3, 0x0036) },
427 + { USB_DEVICE(0x0CF3, 0x3004) },
428 +- { USB_DEVICE(0x0CF3, 0x3005) },
429 + { USB_DEVICE(0x0CF3, 0x3008) },
430 + { USB_DEVICE(0x0CF3, 0x311D) },
431 + { USB_DEVICE(0x0CF3, 0x311E) },
432 +@@ -140,7 +139,6 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
433 + { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
434 + { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
435 + { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
436 +- { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 },
437 + { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
438 + { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
439 + { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 },
440 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
441 +index a7dfbf9a3afb..55cee1d67681 100644
442 +--- a/drivers/bluetooth/btusb.c
443 ++++ b/drivers/bluetooth/btusb.c
444 +@@ -160,7 +160,6 @@ static const struct usb_device_id blacklist_table[] = {
445 + { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
446 + { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
447 + { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
448 +- { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 },
449 + { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
450 + { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
451 + { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 },
452 +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
453 +index 04680ead9275..fede8ca7147c 100644
454 +--- a/drivers/bluetooth/hci_h5.c
455 ++++ b/drivers/bluetooth/hci_h5.c
456 +@@ -406,6 +406,7 @@ static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c)
457 + H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) {
458 + BT_ERR("Non-link packet received in non-active state");
459 + h5_reset_rx(h5);
460 ++ return 0;
461 + }
462 +
463 + h5->rx_func = h5_rx_payload;
464 +diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
465 +index 334601cc81cf..2a451b14b3cc 100644
466 +--- a/drivers/char/hw_random/core.c
467 ++++ b/drivers/char/hw_random/core.c
468 +@@ -55,16 +55,35 @@ static DEFINE_MUTEX(rng_mutex);
469 + static int data_avail;
470 + static u8 *rng_buffer;
471 +
472 ++static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,
473 ++ int wait);
474 ++
475 + static size_t rng_buffer_size(void)
476 + {
477 + return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES;
478 + }
479 +
480 ++static void add_early_randomness(struct hwrng *rng)
481 ++{
482 ++ unsigned char bytes[16];
483 ++ int bytes_read;
484 ++
485 ++ bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
486 ++ if (bytes_read > 0)
487 ++ add_device_randomness(bytes, bytes_read);
488 ++}
489 ++
490 + static inline int hwrng_init(struct hwrng *rng)
491 + {
492 +- if (!rng->init)
493 +- return 0;
494 +- return rng->init(rng);
495 ++ if (rng->init) {
496 ++ int ret;
497 ++
498 ++ ret = rng->init(rng);
499 ++ if (ret)
500 ++ return ret;
501 ++ }
502 ++ add_early_randomness(rng);
503 ++ return 0;
504 + }
505 +
506 + static inline void hwrng_cleanup(struct hwrng *rng)
507 +@@ -304,8 +323,6 @@ int hwrng_register(struct hwrng *rng)
508 + {
509 + int err = -EINVAL;
510 + struct hwrng *old_rng, *tmp;
511 +- unsigned char bytes[16];
512 +- int bytes_read;
513 +
514 + if (rng->name == NULL ||
515 + (rng->data_read == NULL && rng->read == NULL))
516 +@@ -347,9 +364,17 @@ int hwrng_register(struct hwrng *rng)
517 + INIT_LIST_HEAD(&rng->list);
518 + list_add_tail(&rng->list, &rng_list);
519 +
520 +- bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
521 +- if (bytes_read > 0)
522 +- add_device_randomness(bytes, bytes_read);
523 ++ if (old_rng && !rng->init) {
524 ++ /*
525 ++ * Use a new device's input to add some randomness to
526 ++ * the system. If this rng device isn't going to be
527 ++ * used right away, its init function hasn't been
528 ++ * called yet; so only use the randomness from devices
529 ++ * that don't need an init callback.
530 ++ */
531 ++ add_early_randomness(rng);
532 ++ }
533 ++
534 + out_unlock:
535 + mutex_unlock(&rng_mutex);
536 + out:
537 +diff --git a/drivers/char/random.c b/drivers/char/random.c
538 +index 2b6e4cd8de8e..18ec40459598 100644
539 +--- a/drivers/char/random.c
540 ++++ b/drivers/char/random.c
541 +@@ -641,7 +641,7 @@ retry:
542 + } while (unlikely(entropy_count < pool_size-2 && pnfrac));
543 + }
544 +
545 +- if (entropy_count < 0) {
546 ++ if (unlikely(entropy_count < 0)) {
547 + pr_warn("random: negative entropy/overflow: pool %s count %d\n",
548 + r->name, entropy_count);
549 + WARN_ON(1);
550 +@@ -980,7 +980,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
551 + int reserved)
552 + {
553 + int entropy_count, orig;
554 +- size_t ibytes;
555 ++ size_t ibytes, nfrac;
556 +
557 + BUG_ON(r->entropy_count > r->poolinfo->poolfracbits);
558 +
559 +@@ -998,7 +998,17 @@ retry:
560 + }
561 + if (ibytes < min)
562 + ibytes = 0;
563 +- if ((entropy_count -= ibytes << (ENTROPY_SHIFT + 3)) < 0)
564 ++
565 ++ if (unlikely(entropy_count < 0)) {
566 ++ pr_warn("random: negative entropy count: pool %s count %d\n",
567 ++ r->name, entropy_count);
568 ++ WARN_ON(1);
569 ++ entropy_count = 0;
570 ++ }
571 ++ nfrac = ibytes << (ENTROPY_SHIFT + 3);
572 ++ if ((size_t) entropy_count > nfrac)
573 ++ entropy_count -= nfrac;
574 ++ else
575 + entropy_count = 0;
576 +
577 + if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
578 +@@ -1375,6 +1385,7 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
579 + "with %d bits of entropy available\n",
580 + current->comm, nonblocking_pool.entropy_total);
581 +
582 ++ nbytes = min_t(size_t, nbytes, INT_MAX >> (ENTROPY_SHIFT + 3));
583 + ret = extract_entropy_user(&nonblocking_pool, buf, nbytes);
584 +
585 + trace_urandom_read(8 * nbytes, ENTROPY_BITS(&nonblocking_pool),
586 +diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
587 +index 558224cf55bf..dcac12dc6803 100644
588 +--- a/drivers/cpufreq/cpufreq.c
589 ++++ b/drivers/cpufreq/cpufreq.c
590 +@@ -1139,10 +1139,12 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
591 + * the creation of a brand new one. So we need to perform this update
592 + * by invoking update_policy_cpu().
593 + */
594 +- if (recover_policy && cpu != policy->cpu)
595 ++ if (recover_policy && cpu != policy->cpu) {
596 + update_policy_cpu(policy, cpu);
597 +- else
598 ++ WARN_ON(kobject_move(&policy->kobj, &dev->kobj));
599 ++ } else {
600 + policy->cpu = cpu;
601 ++ }
602 +
603 + cpumask_copy(policy->cpus, cpumask_of(cpu));
604 +
605 +diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
606 +index ed5711f77e2d..4d25a06bb45e 100644
607 +--- a/drivers/gpio/gpio-dwapb.c
608 ++++ b/drivers/gpio/gpio-dwapb.c
609 +@@ -260,9 +260,6 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
610 + ct->regs.ack = GPIO_PORTA_EOI;
611 + ct->regs.mask = GPIO_INTMASK;
612 +
613 +- irq_setup_generic_chip(irq_gc, IRQ_MSK(port->bgc.gc.ngpio),
614 +- IRQ_GC_INIT_NESTED_LOCK, IRQ_NOREQUEST, 0);
615 +-
616 + irq_set_chained_handler(irq, dwapb_irq_handler);
617 + irq_set_handler_data(irq, gpio);
618 +
619 +diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
620 +index 2a00cb828d20..61963d3acce2 100644
621 +--- a/drivers/gpu/drm/i915/intel_dp.c
622 ++++ b/drivers/gpu/drm/i915/intel_dp.c
623 +@@ -833,8 +833,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
624 + mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
625 + bpp);
626 +
627 +- for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) {
628 +- for (clock = min_clock; clock <= max_clock; clock++) {
629 ++ for (clock = min_clock; clock <= max_clock; clock++) {
630 ++ for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) {
631 + link_clock = drm_dp_bw_code_to_link_rate(bws[clock]);
632 + link_avail = intel_dp_max_data_rate(link_clock,
633 + lane_count);
634 +diff --git a/drivers/gpu/drm/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c
635 +index 28f84b4fce32..3485bdccf8b8 100644
636 +--- a/drivers/gpu/drm/qxl/qxl_irq.c
637 ++++ b/drivers/gpu/drm/qxl/qxl_irq.c
638 +@@ -33,6 +33,9 @@ irqreturn_t qxl_irq_handler(int irq, void *arg)
639 +
640 + pending = xchg(&qdev->ram_header->int_pending, 0);
641 +
642 ++ if (!pending)
643 ++ return IRQ_NONE;
644 ++
645 + atomic_inc(&qdev->irq_received);
646 +
647 + if (pending & QXL_INTERRUPT_DISPLAY) {
648 +diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
649 +index 2b2908440644..7d68203a3737 100644
650 +--- a/drivers/gpu/drm/radeon/atombios_encoders.c
651 ++++ b/drivers/gpu/drm/radeon/atombios_encoders.c
652 +@@ -183,7 +183,6 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
653 + struct backlight_properties props;
654 + struct radeon_backlight_privdata *pdata;
655 + struct radeon_encoder_atom_dig *dig;
656 +- u8 backlight_level;
657 + char bl_name[16];
658 +
659 + /* Mac laptops with multiple GPUs use the gmux driver for backlight
660 +@@ -222,12 +221,17 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
661 +
662 + pdata->encoder = radeon_encoder;
663 +
664 +- backlight_level = radeon_atom_get_backlight_level_from_reg(rdev);
665 +-
666 + dig = radeon_encoder->enc_priv;
667 + dig->bl_dev = bd;
668 +
669 + bd->props.brightness = radeon_atom_backlight_get_brightness(bd);
670 ++ /* Set a reasonable default here if the level is 0 otherwise
671 ++ * fbdev will attempt to turn the backlight on after console
672 ++ * unblanking and it will try and restore 0 which turns the backlight
673 ++ * off again.
674 ++ */
675 ++ if (bd->props.brightness == 0)
676 ++ bd->props.brightness = RADEON_MAX_BL_LEVEL;
677 + bd->props.power = FB_BLANK_UNBLANK;
678 + backlight_update_status(bd);
679 +
680 +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
681 +index 356b733caafe..9445db514de0 100644
682 +--- a/drivers/gpu/drm/radeon/radeon_display.c
683 ++++ b/drivers/gpu/drm/radeon/radeon_display.c
684 +@@ -757,6 +757,10 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
685 + struct radeon_device *rdev = dev->dev_private;
686 + int ret = 0;
687 +
688 ++ /* don't leak the edid if we already fetched it in detect() */
689 ++ if (radeon_connector->edid)
690 ++ goto got_edid;
691 ++
692 + /* on hw with routers, select right port */
693 + if (radeon_connector->router.ddc_valid)
694 + radeon_router_select_ddc_port(radeon_connector);
695 +@@ -795,6 +799,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
696 + radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev);
697 + }
698 + if (radeon_connector->edid) {
699 ++got_edid:
700 + drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid);
701 + ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid);
702 + drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid);
703 +diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c
704 +index eaaa3d843b80..23b2ce294c4c 100644
705 +--- a/drivers/hv/hv_fcopy.c
706 ++++ b/drivers/hv/hv_fcopy.c
707 +@@ -246,8 +246,8 @@ void hv_fcopy_onchannelcallback(void *context)
708 + /*
709 + * Send the information to the user-level daemon.
710 + */
711 +- fcopy_send_data();
712 + schedule_delayed_work(&fcopy_work, 5*HZ);
713 ++ fcopy_send_data();
714 + return;
715 + }
716 + icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;
717 +diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
718 +index ea852537307e..2b931feb5131 100644
719 +--- a/drivers/hv/hv_kvp.c
720 ++++ b/drivers/hv/hv_kvp.c
721 +@@ -127,6 +127,15 @@ kvp_work_func(struct work_struct *dummy)
722 + kvp_respond_to_host(NULL, HV_E_FAIL);
723 + }
724 +
725 ++static void poll_channel(struct vmbus_channel *channel)
726 ++{
727 ++ unsigned long flags;
728 ++
729 ++ spin_lock_irqsave(&channel->inbound_lock, flags);
730 ++ hv_kvp_onchannelcallback(channel);
731 ++ spin_unlock_irqrestore(&channel->inbound_lock, flags);
732 ++}
733 ++
734 + static int kvp_handle_handshake(struct hv_kvp_msg *msg)
735 + {
736 + int ret = 1;
737 +@@ -155,7 +164,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg)
738 + kvp_register(dm_reg_value);
739 + kvp_transaction.active = false;
740 + if (kvp_transaction.kvp_context)
741 +- hv_kvp_onchannelcallback(kvp_transaction.kvp_context);
742 ++ poll_channel(kvp_transaction.kvp_context);
743 + }
744 + return ret;
745 + }
746 +@@ -568,6 +577,7 @@ response_done:
747 +
748 + vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,
749 + VM_PKT_DATA_INBAND, 0);
750 ++ poll_channel(channel);
751 +
752 + }
753 +
754 +@@ -603,7 +613,7 @@ void hv_kvp_onchannelcallback(void *context)
755 + return;
756 + }
757 +
758 +- vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
759 ++ vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,
760 + &requestid);
761 +
762 + if (recvlen > 0) {
763 +diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
764 +index dd761806f0e8..3b9c9ef0deb8 100644
765 +--- a/drivers/hv/hv_util.c
766 ++++ b/drivers/hv/hv_util.c
767 +@@ -319,7 +319,7 @@ static int util_probe(struct hv_device *dev,
768 + (struct hv_util_service *)dev_id->driver_data;
769 + int ret;
770 +
771 +- srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL);
772 ++ srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL);
773 + if (!srv->recv_buffer)
774 + return -ENOMEM;
775 + if (srv->util_init) {
776 +diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
777 +index 0f4dea5ccf17..9ee3913850d6 100644
778 +--- a/drivers/hwmon/adt7470.c
779 ++++ b/drivers/hwmon/adt7470.c
780 +@@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct device *dev,
781 + return -EINVAL;
782 +
783 + temp = DIV_ROUND_CLOSEST(temp, 1000);
784 +- temp = clamp_val(temp, 0, 255);
785 ++ temp = clamp_val(temp, -128, 127);
786 +
787 + mutex_lock(&data->lock);
788 + data->temp_min[attr->index] = temp;
789 +@@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct device *dev,
790 + return -EINVAL;
791 +
792 + temp = DIV_ROUND_CLOSEST(temp, 1000);
793 +- temp = clamp_val(temp, 0, 255);
794 ++ temp = clamp_val(temp, -128, 127);
795 +
796 + mutex_lock(&data->lock);
797 + data->temp_max[attr->index] = temp;
798 +@@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct device *dev,
799 + return -EINVAL;
800 +
801 + temp = DIV_ROUND_CLOSEST(temp, 1000);
802 +- temp = clamp_val(temp, 0, 255);
803 ++ temp = clamp_val(temp, -128, 127);
804 +
805 + mutex_lock(&data->lock);
806 + data->pwm_tmin[attr->index] = temp;
807 +diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c
808 +index afd31042b452..d14ab3c45daa 100644
809 +--- a/drivers/hwmon/da9052-hwmon.c
810 ++++ b/drivers/hwmon/da9052-hwmon.c
811 +@@ -194,7 +194,7 @@ static ssize_t da9052_hwmon_show_name(struct device *dev,
812 + struct device_attribute *devattr,
813 + char *buf)
814 + {
815 +- return sprintf(buf, "da9052-hwmon\n");
816 ++ return sprintf(buf, "da9052\n");
817 + }
818 +
819 + static ssize_t show_label(struct device *dev,
820 +diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
821 +index 73b3865f1207..35eb7738d711 100644
822 +--- a/drivers/hwmon/da9055-hwmon.c
823 ++++ b/drivers/hwmon/da9055-hwmon.c
824 +@@ -204,7 +204,7 @@ static ssize_t da9055_hwmon_show_name(struct device *dev,
825 + struct device_attribute *devattr,
826 + char *buf)
827 + {
828 +- return sprintf(buf, "da9055-hwmon\n");
829 ++ return sprintf(buf, "da9055\n");
830 + }
831 +
832 + static ssize_t show_label(struct device *dev,
833 +diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
834 +index ea6e06b9c7d4..11dd986e5fa0 100644
835 +--- a/drivers/iio/industrialio-event.c
836 ++++ b/drivers/iio/industrialio-event.c
837 +@@ -341,6 +341,9 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
838 + &indio_dev->event_interface->dev_attr_list);
839 + kfree(postfix);
840 +
841 ++ if ((ret == -EBUSY) && (shared_by != IIO_SEPARATE))
842 ++ continue;
843 ++
844 + if (ret)
845 + return ret;
846 +
847 +diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
848 +index 8914ea90ddd9..bff1a8ed47d0 100644
849 +--- a/drivers/infiniband/hw/cxgb4/device.c
850 ++++ b/drivers/infiniband/hw/cxgb4/device.c
851 +@@ -654,6 +654,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
852 + pr_err(MOD "error allocating status page\n");
853 + goto err4;
854 + }
855 ++ rdev->status_page->db_off = 0;
856 + return 0;
857 + err4:
858 + c4iw_rqtpool_destroy(rdev);
859 +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
860 +index dc930ed21eca..c69adc1705b4 100644
861 +--- a/drivers/infiniband/hw/mlx5/qp.c
862 ++++ b/drivers/infiniband/hw/mlx5/qp.c
863 +@@ -671,7 +671,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev,
864 + int err;
865 +
866 + uuari = &dev->mdev.priv.uuari;
867 +- if (init_attr->create_flags & ~IB_QP_CREATE_SIGNATURE_EN)
868 ++ if (init_attr->create_flags & ~(IB_QP_CREATE_SIGNATURE_EN | IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK))
869 + return -EINVAL;
870 +
871 + if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR)
872 +diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
873 +index 57d165e026f4..739ca6756cb9 100644
874 +--- a/drivers/irqchip/irq-gic.c
875 ++++ b/drivers/irqchip/irq-gic.c
876 +@@ -42,6 +42,7 @@
877 + #include <linux/irqchip/chained_irq.h>
878 + #include <linux/irqchip/arm-gic.h>
879 +
880 ++#include <asm/cputype.h>
881 + #include <asm/irq.h>
882 + #include <asm/exception.h>
883 + #include <asm/smp_plat.h>
884 +@@ -954,7 +955,9 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
885 + }
886 +
887 + for_each_possible_cpu(cpu) {
888 +- unsigned long offset = percpu_offset * cpu_logical_map(cpu);
889 ++ u32 mpidr = cpu_logical_map(cpu);
890 ++ u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
891 ++ unsigned long offset = percpu_offset * core_id;
892 + *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset;
893 + *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset;
894 + }
895 +@@ -1071,8 +1074,10 @@ gic_of_init(struct device_node *node, struct device_node *parent)
896 + gic_cnt++;
897 + return 0;
898 + }
899 ++IRQCHIP_DECLARE(gic_400, "arm,gic-400", gic_of_init);
900 + IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init);
901 + IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init);
902 ++IRQCHIP_DECLARE(cortex_a7_gic, "arm,cortex-a7-gic", gic_of_init);
903 + IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init);
904 + IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init);
905 +
906 +diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
907 +index a5da511e3c9a..158ed32ac21c 100644
908 +--- a/drivers/isdn/i4l/isdn_ppp.c
909 ++++ b/drivers/isdn/i4l/isdn_ppp.c
910 +@@ -442,7 +442,7 @@ static int get_filter(void __user *arg, struct sock_filter **p)
911 + {
912 + struct sock_fprog uprog;
913 + struct sock_filter *code = NULL;
914 +- int len, err;
915 ++ int len;
916 +
917 + if (copy_from_user(&uprog, arg, sizeof(uprog)))
918 + return -EFAULT;
919 +@@ -458,12 +458,6 @@ static int get_filter(void __user *arg, struct sock_filter **p)
920 + if (IS_ERR(code))
921 + return PTR_ERR(code);
922 +
923 +- err = sk_chk_filter(code, uprog.len);
924 +- if (err) {
925 +- kfree(code);
926 +- return err;
927 +- }
928 +-
929 + *p = code;
930 + return uprog.len;
931 + }
932 +@@ -644,9 +638,15 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
933 + fprog.len = len;
934 + fprog.filter = code;
935 +
936 +- if (is->pass_filter)
937 ++ if (is->pass_filter) {
938 + sk_unattached_filter_destroy(is->pass_filter);
939 +- err = sk_unattached_filter_create(&is->pass_filter, &fprog);
940 ++ is->pass_filter = NULL;
941 ++ }
942 ++ if (fprog.filter != NULL)
943 ++ err = sk_unattached_filter_create(&is->pass_filter,
944 ++ &fprog);
945 ++ else
946 ++ err = 0;
947 + kfree(code);
948 +
949 + return err;
950 +@@ -663,9 +663,15 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
951 + fprog.len = len;
952 + fprog.filter = code;
953 +
954 +- if (is->active_filter)
955 ++ if (is->active_filter) {
956 + sk_unattached_filter_destroy(is->active_filter);
957 +- err = sk_unattached_filter_create(&is->active_filter, &fprog);
958 ++ is->active_filter = NULL;
959 ++ }
960 ++ if (fprog.filter != NULL)
961 ++ err = sk_unattached_filter_create(&is->active_filter,
962 ++ &fprog);
963 ++ else
964 ++ err = 0;
965 + kfree(code);
966 +
967 + return err;
968 +diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
969 +index 4ead4ba60656..d2899e7eb3aa 100644
970 +--- a/drivers/md/dm-cache-metadata.c
971 ++++ b/drivers/md/dm-cache-metadata.c
972 +@@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd)
973 +
974 + disk_super = dm_block_data(sblock);
975 +
976 ++ /* Verify the data block size hasn't changed */
977 ++ if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) {
978 ++ DMERR("changing the data block size (from %u to %llu) is not supported",
979 ++ le32_to_cpu(disk_super->data_block_size),
980 ++ (unsigned long long)cmd->data_block_size);
981 ++ r = -EINVAL;
982 ++ goto bad;
983 ++ }
984 ++
985 + r = __check_incompat_features(disk_super, cmd);
986 + if (r < 0)
987 + goto bad;
988 +diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
989 +index b086a945edcb..e9d33ad59df5 100644
990 +--- a/drivers/md/dm-thin-metadata.c
991 ++++ b/drivers/md/dm-thin-metadata.c
992 +@@ -613,6 +613,15 @@ static int __open_metadata(struct dm_pool_metadata *pmd)
993 +
994 + disk_super = dm_block_data(sblock);
995 +
996 ++ /* Verify the data block size hasn't changed */
997 ++ if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) {
998 ++ DMERR("changing the data block size (from %u to %llu) is not supported",
999 ++ le32_to_cpu(disk_super->data_block_size),
1000 ++ (unsigned long long)pmd->data_block_size);
1001 ++ r = -EINVAL;
1002 ++ goto bad_unlock_sblock;
1003 ++ }
1004 ++
1005 + r = __check_incompat_features(disk_super, pmd);
1006 + if (r < 0)
1007 + goto bad_unlock_sblock;
1008 +diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c
1009 +index 2fd1c5e31a0f..339adce7c7a5 100644
1010 +--- a/drivers/media/usb/gspca/pac7302.c
1011 ++++ b/drivers/media/usb/gspca/pac7302.c
1012 +@@ -928,6 +928,7 @@ static const struct usb_device_id device_table[] = {
1013 + {USB_DEVICE(0x093a, 0x2620)},
1014 + {USB_DEVICE(0x093a, 0x2621)},
1015 + {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP},
1016 ++ {USB_DEVICE(0x093a, 0x2623), .driver_info = FL_VFLIP},
1017 + {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP},
1018 + {USB_DEVICE(0x093a, 0x2625)},
1019 + {USB_DEVICE(0x093a, 0x2626)},
1020 +diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
1021 +index 1fd4a0f77967..d85dd3693f47 100644
1022 +--- a/drivers/mtd/devices/elm.c
1023 ++++ b/drivers/mtd/devices/elm.c
1024 +@@ -445,6 +445,7 @@ static int elm_context_save(struct elm_info *info)
1025 + ELM_SYNDROME_FRAGMENT_1 + offset);
1026 + regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
1027 + ELM_SYNDROME_FRAGMENT_0 + offset);
1028 ++ break;
1029 + default:
1030 + return -EINVAL;
1031 + }
1032 +@@ -483,6 +484,7 @@ static int elm_context_restore(struct elm_info *info)
1033 + regs->elm_syndrome_fragment_1[i]);
1034 + elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
1035 + regs->elm_syndrome_fragment_0[i]);
1036 ++ break;
1037 + default:
1038 + return -EINVAL;
1039 + }
1040 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1041 +index d3a67896d435..96fee83c9606 100644
1042 +--- a/drivers/net/bonding/bond_main.c
1043 ++++ b/drivers/net/bonding/bond_main.c
1044 +@@ -4028,7 +4028,7 @@ static int bond_check_params(struct bond_params *params)
1045 + }
1046 +
1047 + if (ad_select) {
1048 +- bond_opt_initstr(&newval, lacp_rate);
1049 ++ bond_opt_initstr(&newval, ad_select);
1050 + valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_SELECT),
1051 + &newval);
1052 + if (!valptr) {
1053 +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
1054 +index dcf9196f6316..ea4d4f1a6411 100644
1055 +--- a/drivers/net/can/slcan.c
1056 ++++ b/drivers/net/can/slcan.c
1057 +@@ -52,6 +52,7 @@
1058 + #include <linux/delay.h>
1059 + #include <linux/init.h>
1060 + #include <linux/kernel.h>
1061 ++#include <linux/workqueue.h>
1062 + #include <linux/can.h>
1063 + #include <linux/can/skb.h>
1064 +
1065 +@@ -85,6 +86,7 @@ struct slcan {
1066 + struct tty_struct *tty; /* ptr to TTY structure */
1067 + struct net_device *dev; /* easy for intr handling */
1068 + spinlock_t lock;
1069 ++ struct work_struct tx_work; /* Flushes transmit buffer */
1070 +
1071 + /* These are pointers to the malloc()ed frame buffers. */
1072 + unsigned char rbuff[SLC_MTU]; /* receiver buffer */
1073 +@@ -309,36 +311,46 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf)
1074 + sl->dev->stats.tx_bytes += cf->can_dlc;
1075 + }
1076 +
1077 +-/*
1078 +- * Called by the driver when there's room for more data. If we have
1079 +- * more packets to send, we send them here.
1080 +- */
1081 +-static void slcan_write_wakeup(struct tty_struct *tty)
1082 ++/* Write out any remaining transmit buffer. Scheduled when tty is writable */
1083 ++static void slcan_transmit(struct work_struct *work)
1084 + {
1085 ++ struct slcan *sl = container_of(work, struct slcan, tx_work);
1086 + int actual;
1087 +- struct slcan *sl = (struct slcan *) tty->disc_data;
1088 +
1089 ++ spin_lock_bh(&sl->lock);
1090 + /* First make sure we're connected. */
1091 +- if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev))
1092 ++ if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) {
1093 ++ spin_unlock_bh(&sl->lock);
1094 + return;
1095 ++ }
1096 +
1097 +- spin_lock_bh(&sl->lock);
1098 + if (sl->xleft <= 0) {
1099 + /* Now serial buffer is almost free & we can start
1100 + * transmission of another packet */
1101 + sl->dev->stats.tx_packets++;
1102 +- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1103 ++ clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
1104 + spin_unlock_bh(&sl->lock);
1105 + netif_wake_queue(sl->dev);
1106 + return;
1107 + }
1108 +
1109 +- actual = tty->ops->write(tty, sl->xhead, sl->xleft);
1110 ++ actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
1111 + sl->xleft -= actual;
1112 + sl->xhead += actual;
1113 + spin_unlock_bh(&sl->lock);
1114 + }
1115 +
1116 ++/*
1117 ++ * Called by the driver when there's room for more data.
1118 ++ * Schedule the transmit.
1119 ++ */
1120 ++static void slcan_write_wakeup(struct tty_struct *tty)
1121 ++{
1122 ++ struct slcan *sl = tty->disc_data;
1123 ++
1124 ++ schedule_work(&sl->tx_work);
1125 ++}
1126 ++
1127 + /* Send a can_frame to a TTY queue. */
1128 + static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev)
1129 + {
1130 +@@ -528,6 +540,7 @@ static struct slcan *slc_alloc(dev_t line)
1131 + sl->magic = SLCAN_MAGIC;
1132 + sl->dev = dev;
1133 + spin_lock_init(&sl->lock);
1134 ++ INIT_WORK(&sl->tx_work, slcan_transmit);
1135 + slcan_devs[i] = dev;
1136 +
1137 + return sl;
1138 +@@ -626,8 +639,12 @@ static void slcan_close(struct tty_struct *tty)
1139 + if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty)
1140 + return;
1141 +
1142 ++ spin_lock_bh(&sl->lock);
1143 + tty->disc_data = NULL;
1144 + sl->tty = NULL;
1145 ++ spin_unlock_bh(&sl->lock);
1146 ++
1147 ++ flush_work(&sl->tx_work);
1148 +
1149 + /* Flush network side */
1150 + unregister_netdev(sl->dev);
1151 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1152 +index 9261d5313b5b..0979967577a1 100644
1153 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1154 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
1155 +@@ -797,7 +797,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
1156 +
1157 + return;
1158 + }
1159 +- bnx2x_frag_free(fp, new_data);
1160 ++ if (new_data)
1161 ++ bnx2x_frag_free(fp, new_data);
1162 + drop:
1163 + /* drop the packet and keep the buffer in the bin */
1164 + DP(NETIF_MSG_RX_STATUS,
1165 +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
1166 +index dc19bc5dec77..2b5ab7c770b5 100644
1167 +--- a/drivers/net/ethernet/emulex/benet/be_main.c
1168 ++++ b/drivers/net/ethernet/emulex/benet/be_main.c
1169 +@@ -2858,7 +2858,7 @@ static int be_open(struct net_device *netdev)
1170 + for_all_evt_queues(adapter, eqo, i) {
1171 + napi_enable(&eqo->napi);
1172 + be_enable_busy_poll(eqo);
1173 +- be_eq_notify(adapter, eqo->q.id, true, false, 0);
1174 ++ be_eq_notify(adapter, eqo->q.id, true, true, 0);
1175 + }
1176 + adapter->flags |= BE_FLAGS_NAPI_ENABLED;
1177 +
1178 +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
1179 +index fa36fe12e775..4c8d2d530e26 100644
1180 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
1181 ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
1182 +@@ -1489,6 +1489,13 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
1183 + s32 ret_val;
1184 + u16 i, rar_count = mac->rar_entry_count;
1185 +
1186 ++ if ((hw->mac.type >= e1000_i210) &&
1187 ++ !(igb_get_flash_presence_i210(hw))) {
1188 ++ ret_val = igb_pll_workaround_i210(hw);
1189 ++ if (ret_val)
1190 ++ return ret_val;
1191 ++ }
1192 ++
1193 + /* Initialize identification LED */
1194 + ret_val = igb_id_led_init(hw);
1195 + if (ret_val) {
1196 +diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
1197 +index b05bf925ac72..25d236143e9d 100644
1198 +--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
1199 ++++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
1200 +@@ -49,14 +49,15 @@
1201 + #define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */
1202 +
1203 + /* Physical Func Reset Done Indication */
1204 +-#define E1000_CTRL_EXT_PFRSTD 0x00004000
1205 +-#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
1206 +-#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
1207 +-#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000
1208 +-#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000
1209 +-#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
1210 +-#define E1000_CTRL_EXT_EIAME 0x01000000
1211 +-#define E1000_CTRL_EXT_IRCA 0x00000001
1212 ++#define E1000_CTRL_EXT_PFRSTD 0x00004000
1213 ++#define E1000_CTRL_EXT_SDLPE 0X00040000 /* SerDes Low Power Enable */
1214 ++#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
1215 ++#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
1216 ++#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000
1217 ++#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000
1218 ++#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
1219 ++#define E1000_CTRL_EXT_EIAME 0x01000000
1220 ++#define E1000_CTRL_EXT_IRCA 0x00000001
1221 + /* Interrupt delay cancellation */
1222 + /* Driver loaded bit for FW */
1223 + #define E1000_CTRL_EXT_DRV_LOAD 0x10000000
1224 +@@ -65,6 +66,7 @@
1225 + /* packet buffer parity error detection enabled */
1226 + /* descriptor FIFO parity error detection enable */
1227 + #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
1228 ++#define E1000_CTRL_EXT_PHYPDEN 0x00100000
1229 + #define E1000_I2CCMD_REG_ADDR_SHIFT 16
1230 + #define E1000_I2CCMD_PHY_ADDR_SHIFT 24
1231 + #define E1000_I2CCMD_OPCODE_READ 0x08000000
1232 +diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
1233 +index 10741d170f2d..e990cacbf698 100644
1234 +--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
1235 ++++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
1236 +@@ -571,4 +571,7 @@ struct net_device *igb_get_hw_dev(struct e1000_hw *hw);
1237 + /* These functions must be implemented by drivers */
1238 + s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
1239 + s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
1240 ++
1241 ++void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
1242 ++void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
1243 + #endif /* _E1000_HW_H_ */
1244 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
1245 +index f67f8a170b90..9e2c43361dfe 100644
1246 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
1247 ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
1248 +@@ -836,3 +836,69 @@ s32 igb_init_nvm_params_i210(struct e1000_hw *hw)
1249 + }
1250 + return ret_val;
1251 + }
1252 ++
1253 ++/**
1254 ++ * igb_pll_workaround_i210
1255 ++ * @hw: pointer to the HW structure
1256 ++ *
1257 ++ * Works around an errata in the PLL circuit where it occasionally
1258 ++ * provides the wrong clock frequency after power up.
1259 ++ **/
1260 ++s32 igb_pll_workaround_i210(struct e1000_hw *hw)
1261 ++{
1262 ++ s32 ret_val;
1263 ++ u32 wuc, mdicnfg, ctrl, ctrl_ext, reg_val;
1264 ++ u16 nvm_word, phy_word, pci_word, tmp_nvm;
1265 ++ int i;
1266 ++
1267 ++ /* Get and set needed register values */
1268 ++ wuc = rd32(E1000_WUC);
1269 ++ mdicnfg = rd32(E1000_MDICNFG);
1270 ++ reg_val = mdicnfg & ~E1000_MDICNFG_EXT_MDIO;
1271 ++ wr32(E1000_MDICNFG, reg_val);
1272 ++
1273 ++ /* Get data from NVM, or set default */
1274 ++ ret_val = igb_read_invm_word_i210(hw, E1000_INVM_AUTOLOAD,
1275 ++ &nvm_word);
1276 ++ if (ret_val)
1277 ++ nvm_word = E1000_INVM_DEFAULT_AL;
1278 ++ tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
1279 ++ for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
1280 ++ /* check current state directly from internal PHY */
1281 ++ igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE |
1282 ++ E1000_PHY_PLL_FREQ_REG), &phy_word);
1283 ++ if ((phy_word & E1000_PHY_PLL_UNCONF)
1284 ++ != E1000_PHY_PLL_UNCONF) {
1285 ++ ret_val = 0;
1286 ++ break;
1287 ++ } else {
1288 ++ ret_val = -E1000_ERR_PHY;
1289 ++ }
1290 ++ /* directly reset the internal PHY */
1291 ++ ctrl = rd32(E1000_CTRL);
1292 ++ wr32(E1000_CTRL, ctrl|E1000_CTRL_PHY_RST);
1293 ++
1294 ++ ctrl_ext = rd32(E1000_CTRL_EXT);
1295 ++ ctrl_ext |= (E1000_CTRL_EXT_PHYPDEN | E1000_CTRL_EXT_SDLPE);
1296 ++ wr32(E1000_CTRL_EXT, ctrl_ext);
1297 ++
1298 ++ wr32(E1000_WUC, 0);
1299 ++ reg_val = (E1000_INVM_AUTOLOAD << 4) | (tmp_nvm << 16);
1300 ++ wr32(E1000_EEARBC_I210, reg_val);
1301 ++
1302 ++ igb_read_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
1303 ++ pci_word |= E1000_PCI_PMCSR_D3;
1304 ++ igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
1305 ++ usleep_range(1000, 2000);
1306 ++ pci_word &= ~E1000_PCI_PMCSR_D3;
1307 ++ igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
1308 ++ reg_val = (E1000_INVM_AUTOLOAD << 4) | (nvm_word << 16);
1309 ++ wr32(E1000_EEARBC_I210, reg_val);
1310 ++
1311 ++ /* restore WUC register */
1312 ++ wr32(E1000_WUC, wuc);
1313 ++ }
1314 ++ /* restore MDICNFG setting */
1315 ++ wr32(E1000_MDICNFG, mdicnfg);
1316 ++ return ret_val;
1317 ++}
1318 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.h b/drivers/net/ethernet/intel/igb/e1000_i210.h
1319 +index 907fe99a9813..8205e1976595 100644
1320 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.h
1321 ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.h
1322 +@@ -36,6 +36,7 @@ s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data);
1323 + s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data);
1324 + s32 igb_init_nvm_params_i210(struct e1000_hw *hw);
1325 + bool igb_get_flash_presence_i210(struct e1000_hw *hw);
1326 ++s32 igb_pll_workaround_i210(struct e1000_hw *hw);
1327 +
1328 + #define E1000_STM_OPCODE 0xDB00
1329 + #define E1000_EEPROM_FLASH_SIZE_WORD 0x11
1330 +@@ -81,4 +82,15 @@ enum E1000_INVM_STRUCTURE_TYPE {
1331 + #define NVM_LED_1_CFG_DEFAULT_I211 0x0184
1332 + #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C
1333 +
1334 ++/* PLL Defines */
1335 ++#define E1000_PCI_PMCSR 0x44
1336 ++#define E1000_PCI_PMCSR_D3 0x03
1337 ++#define E1000_MAX_PLL_TRIES 5
1338 ++#define E1000_PHY_PLL_UNCONF 0xFF
1339 ++#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000
1340 ++#define E1000_PHY_PLL_FREQ_REG 0x000E
1341 ++#define E1000_INVM_DEFAULT_AL 0x202F
1342 ++#define E1000_INVM_AUTOLOAD 0x0A
1343 ++#define E1000_INVM_PLL_WO_VAL 0x0010
1344 ++
1345 + #endif
1346 +diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
1347 +index bdb246e848e1..8ded9a12d409 100644
1348 +--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
1349 ++++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
1350 +@@ -69,6 +69,7 @@
1351 + #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
1352 + #define E1000_PBS 0x01008 /* Packet Buffer Size */
1353 + #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
1354 ++#define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
1355 + #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
1356 + #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
1357 + #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */
1358 +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
1359 +index 16430a8440fa..d731df1da919 100644
1360 +--- a/drivers/net/ethernet/intel/igb/igb_main.c
1361 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
1362 +@@ -7204,6 +7204,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
1363 + }
1364 + }
1365 +
1366 ++void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
1367 ++{
1368 ++ struct igb_adapter *adapter = hw->back;
1369 ++
1370 ++ pci_read_config_word(adapter->pdev, reg, value);
1371 ++}
1372 ++
1373 ++void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
1374 ++{
1375 ++ struct igb_adapter *adapter = hw->back;
1376 ++
1377 ++ pci_write_config_word(adapter->pdev, reg, *value);
1378 ++}
1379 ++
1380 + s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
1381 + {
1382 + struct igb_adapter *adapter = hw->back;
1383 +@@ -7567,6 +7581,8 @@ static int igb_sriov_reinit(struct pci_dev *dev)
1384 +
1385 + if (netif_running(netdev))
1386 + igb_close(netdev);
1387 ++ else
1388 ++ igb_reset(adapter);
1389 +
1390 + igb_clear_interrupt_scheme(adapter);
1391 +
1392 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
1393 +index 14786c8bf99e..d63c4bf96c20 100644
1394 +--- a/drivers/net/ethernet/marvell/mvneta.c
1395 ++++ b/drivers/net/ethernet/marvell/mvneta.c
1396 +@@ -1189,7 +1189,7 @@ static u32 mvneta_txq_desc_csum(int l3_offs, int l3_proto,
1397 + command = l3_offs << MVNETA_TX_L3_OFF_SHIFT;
1398 + command |= ip_hdr_len << MVNETA_TX_IP_HLEN_SHIFT;
1399 +
1400 +- if (l3_proto == swab16(ETH_P_IP))
1401 ++ if (l3_proto == htons(ETH_P_IP))
1402 + command |= MVNETA_TXD_IP_CSUM;
1403 + else
1404 + command |= MVNETA_TX_L3_IP6;
1405 +@@ -2365,7 +2365,7 @@ static void mvneta_adjust_link(struct net_device *ndev)
1406 +
1407 + if (phydev->speed == SPEED_1000)
1408 + val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
1409 +- else
1410 ++ else if (phydev->speed == SPEED_100)
1411 + val |= MVNETA_GMAC_CONFIG_MII_SPEED;
1412 +
1413 + mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
1414 +diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1415 +index 7e4b1720c3d1..e03c9aff81ba 100644
1416 +--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1417 ++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1418 +@@ -2303,7 +2303,7 @@ static void mlx4_en_add_vxlan_port(struct net_device *dev,
1419 + struct mlx4_en_priv *priv = netdev_priv(dev);
1420 + __be16 current_port;
1421 +
1422 +- if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS))
1423 ++ if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)
1424 + return;
1425 +
1426 + if (sa_family == AF_INET6)
1427 +diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
1428 +index 8fa321f39dfd..52b4c3986c99 100644
1429 +--- a/drivers/net/ethernet/mellanox/mlx4/main.c
1430 ++++ b/drivers/net/ethernet/mellanox/mlx4/main.c
1431 +@@ -2466,7 +2466,8 @@ slave_start:
1432 + "with IB port. Single port VFs syntax"
1433 + " is only supported when all ports "
1434 + "are configured as ethernet\n");
1435 +- goto err_close;
1436 ++ err = -EINVAL;
1437 ++ goto err_master_mfunc;
1438 + }
1439 + for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) {
1440 + unsigned j;
1441 +diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
1442 +index 1c24a8f368bd..fd411d6e19a2 100644
1443 +--- a/drivers/net/ethernet/sun/sunvnet.c
1444 ++++ b/drivers/net/ethernet/sun/sunvnet.c
1445 +@@ -1083,6 +1083,24 @@ static struct vnet *vnet_find_or_create(const u64 *local_mac)
1446 + return vp;
1447 + }
1448 +
1449 ++static void vnet_cleanup(void)
1450 ++{
1451 ++ struct vnet *vp;
1452 ++ struct net_device *dev;
1453 ++
1454 ++ mutex_lock(&vnet_list_mutex);
1455 ++ while (!list_empty(&vnet_list)) {
1456 ++ vp = list_first_entry(&vnet_list, struct vnet, list);
1457 ++ list_del(&vp->list);
1458 ++ dev = vp->dev;
1459 ++ /* vio_unregister_driver() should have cleaned up port_list */
1460 ++ BUG_ON(!list_empty(&vp->port_list));
1461 ++ unregister_netdev(dev);
1462 ++ free_netdev(dev);
1463 ++ }
1464 ++ mutex_unlock(&vnet_list_mutex);
1465 ++}
1466 ++
1467 + static const char *local_mac_prop = "local-mac-address";
1468 +
1469 + static struct vnet *vnet_find_parent(struct mdesc_handle *hp,
1470 +@@ -1240,7 +1258,6 @@ static int vnet_port_remove(struct vio_dev *vdev)
1471 +
1472 + kfree(port);
1473 +
1474 +- unregister_netdev(vp->dev);
1475 + }
1476 + return 0;
1477 + }
1478 +@@ -1268,6 +1285,7 @@ static int __init vnet_init(void)
1479 + static void __exit vnet_exit(void)
1480 + {
1481 + vio_unregister_driver(&vnet_port_driver);
1482 ++ vnet_cleanup();
1483 + }
1484 +
1485 + module_init(vnet_init);
1486 +diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
1487 +index c331b7ebc812..80d75ee60da8 100644
1488 +--- a/drivers/net/ethernet/ti/cpsw.c
1489 ++++ b/drivers/net/ethernet/ti/cpsw.c
1490 +@@ -1201,7 +1201,12 @@ static int cpsw_ndo_open(struct net_device *ndev)
1491 + for_each_slave(priv, cpsw_slave_open, priv);
1492 +
1493 + /* Add default VLAN */
1494 +- cpsw_add_default_vlan(priv);
1495 ++ if (!priv->data.dual_emac)
1496 ++ cpsw_add_default_vlan(priv);
1497 ++ else
1498 ++ cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan,
1499 ++ ALE_ALL_PORTS << priv->host_port,
1500 ++ ALE_ALL_PORTS << priv->host_port, 0, 0);
1501 +
1502 + if (!cpsw_common_res_usage_state(priv)) {
1503 + /* setup tx dma to fixed prio and zero offset */
1504 +diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
1505 +index e3923ebb693f..3c41a83a1572 100644
1506 +--- a/drivers/net/ppp/ppp_generic.c
1507 ++++ b/drivers/net/ppp/ppp_generic.c
1508 +@@ -539,7 +539,7 @@ static int get_filter(void __user *arg, struct sock_filter **p)
1509 + {
1510 + struct sock_fprog uprog;
1511 + struct sock_filter *code = NULL;
1512 +- int len, err;
1513 ++ int len;
1514 +
1515 + if (copy_from_user(&uprog, arg, sizeof(uprog)))
1516 + return -EFAULT;
1517 +@@ -554,12 +554,6 @@ static int get_filter(void __user *arg, struct sock_filter **p)
1518 + if (IS_ERR(code))
1519 + return PTR_ERR(code);
1520 +
1521 +- err = sk_chk_filter(code, uprog.len);
1522 +- if (err) {
1523 +- kfree(code);
1524 +- return err;
1525 +- }
1526 +-
1527 + *p = code;
1528 + return uprog.len;
1529 + }
1530 +@@ -763,10 +757,15 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1531 + };
1532 +
1533 + ppp_lock(ppp);
1534 +- if (ppp->pass_filter)
1535 ++ if (ppp->pass_filter) {
1536 + sk_unattached_filter_destroy(ppp->pass_filter);
1537 +- err = sk_unattached_filter_create(&ppp->pass_filter,
1538 +- &fprog);
1539 ++ ppp->pass_filter = NULL;
1540 ++ }
1541 ++ if (fprog.filter != NULL)
1542 ++ err = sk_unattached_filter_create(&ppp->pass_filter,
1543 ++ &fprog);
1544 ++ else
1545 ++ err = 0;
1546 + kfree(code);
1547 + ppp_unlock(ppp);
1548 + }
1549 +@@ -784,10 +783,15 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1550 + };
1551 +
1552 + ppp_lock(ppp);
1553 +- if (ppp->active_filter)
1554 ++ if (ppp->active_filter) {
1555 + sk_unattached_filter_destroy(ppp->active_filter);
1556 +- err = sk_unattached_filter_create(&ppp->active_filter,
1557 +- &fprog);
1558 ++ ppp->active_filter = NULL;
1559 ++ }
1560 ++ if (fprog.filter != NULL)
1561 ++ err = sk_unattached_filter_create(&ppp->active_filter,
1562 ++ &fprog);
1563 ++ else
1564 ++ err = 0;
1565 + kfree(code);
1566 + ppp_unlock(ppp);
1567 + }
1568 +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
1569 +index 2ea7efd11857..6c9c16d76935 100644
1570 +--- a/drivers/net/ppp/pppoe.c
1571 ++++ b/drivers/net/ppp/pppoe.c
1572 +@@ -675,7 +675,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
1573 + po->chan.hdrlen = (sizeof(struct pppoe_hdr) +
1574 + dev->hard_header_len);
1575 +
1576 +- po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr);
1577 ++ po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2;
1578 + po->chan.private = sk;
1579 + po->chan.ops = &pppoe_chan_ops;
1580 +
1581 +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
1582 +index ad4a94e9ff57..87526443841f 100644
1583 +--- a/drivers/net/slip/slip.c
1584 ++++ b/drivers/net/slip/slip.c
1585 +@@ -83,6 +83,7 @@
1586 + #include <linux/delay.h>
1587 + #include <linux/init.h>
1588 + #include <linux/slab.h>
1589 ++#include <linux/workqueue.h>
1590 + #include "slip.h"
1591 + #ifdef CONFIG_INET
1592 + #include <linux/ip.h>
1593 +@@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
1594 + #endif
1595 + }
1596 +
1597 +-/*
1598 +- * Called by the driver when there's room for more data. If we have
1599 +- * more packets to send, we send them here.
1600 +- */
1601 +-static void slip_write_wakeup(struct tty_struct *tty)
1602 ++/* Write out any remaining transmit buffer. Scheduled when tty is writable */
1603 ++static void slip_transmit(struct work_struct *work)
1604 + {
1605 ++ struct slip *sl = container_of(work, struct slip, tx_work);
1606 + int actual;
1607 +- struct slip *sl = tty->disc_data;
1608 +
1609 ++ spin_lock_bh(&sl->lock);
1610 + /* First make sure we're connected. */
1611 +- if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
1612 ++ if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) {
1613 ++ spin_unlock_bh(&sl->lock);
1614 + return;
1615 ++ }
1616 +
1617 +- spin_lock_bh(&sl->lock);
1618 + if (sl->xleft <= 0) {
1619 + /* Now serial buffer is almost free & we can start
1620 + * transmission of another packet */
1621 + sl->dev->stats.tx_packets++;
1622 +- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1623 ++ clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
1624 + spin_unlock_bh(&sl->lock);
1625 + sl_unlock(sl);
1626 + return;
1627 + }
1628 +
1629 +- actual = tty->ops->write(tty, sl->xhead, sl->xleft);
1630 ++ actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
1631 + sl->xleft -= actual;
1632 + sl->xhead += actual;
1633 + spin_unlock_bh(&sl->lock);
1634 + }
1635 +
1636 ++/*
1637 ++ * Called by the driver when there's room for more data.
1638 ++ * Schedule the transmit.
1639 ++ */
1640 ++static void slip_write_wakeup(struct tty_struct *tty)
1641 ++{
1642 ++ struct slip *sl = tty->disc_data;
1643 ++
1644 ++ schedule_work(&sl->tx_work);
1645 ++}
1646 ++
1647 + static void sl_tx_timeout(struct net_device *dev)
1648 + {
1649 + struct slip *sl = netdev_priv(dev);
1650 +@@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line)
1651 + sl->magic = SLIP_MAGIC;
1652 + sl->dev = dev;
1653 + spin_lock_init(&sl->lock);
1654 ++ INIT_WORK(&sl->tx_work, slip_transmit);
1655 + sl->mode = SL_MODE_DEFAULT;
1656 + #ifdef CONFIG_SLIP_SMART
1657 + /* initialize timer_list struct */
1658 +@@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty)
1659 + if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty)
1660 + return;
1661 +
1662 ++ spin_lock_bh(&sl->lock);
1663 + tty->disc_data = NULL;
1664 + sl->tty = NULL;
1665 ++ spin_unlock_bh(&sl->lock);
1666 ++
1667 ++ flush_work(&sl->tx_work);
1668 +
1669 + /* VSV = very important to remove timers */
1670 + #ifdef CONFIG_SLIP_SMART
1671 +diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h
1672 +index 67673cf1266b..cf32aadf508f 100644
1673 +--- a/drivers/net/slip/slip.h
1674 ++++ b/drivers/net/slip/slip.h
1675 +@@ -53,6 +53,7 @@ struct slip {
1676 + struct tty_struct *tty; /* ptr to TTY structure */
1677 + struct net_device *dev; /* easy for intr handling */
1678 + spinlock_t lock;
1679 ++ struct work_struct tx_work; /* Flushes transmit buffer */
1680 +
1681 + #ifdef SL_INCLUDE_CSLIP
1682 + struct slcompress *slcomp; /* for header compression */
1683 +diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
1684 +index 312178d7b698..a01462523bc7 100644
1685 +--- a/drivers/net/usb/huawei_cdc_ncm.c
1686 ++++ b/drivers/net/usb/huawei_cdc_ncm.c
1687 +@@ -84,12 +84,13 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
1688 + ctx = drvstate->ctx;
1689 +
1690 + if (usbnet_dev->status)
1691 +- /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256
1692 +- * decimal (0x100)"
1693 ++ /* The wMaxCommand buffer must be big enough to hold
1694 ++ * any message from the modem. Experience has shown
1695 ++ * that some replies are more than 256 bytes long
1696 + */
1697 + subdriver = usb_cdc_wdm_register(ctx->control,
1698 + &usbnet_dev->status->desc,
1699 +- 256, /* wMaxCommand */
1700 ++ 1024, /* wMaxCommand */
1701 + huawei_cdc_ncm_wdm_manage_power);
1702 + if (IS_ERR(subdriver)) {
1703 + ret = PTR_ERR(subdriver);
1704 +@@ -206,6 +207,9 @@ static const struct usb_device_id huawei_cdc_ncm_devs[] = {
1705 + { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76),
1706 + .driver_info = (unsigned long)&huawei_cdc_ncm_info,
1707 + },
1708 ++ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x03, 0x16),
1709 ++ .driver_info = (unsigned long)&huawei_cdc_ncm_info,
1710 ++ },
1711 +
1712 + /* Terminating entry */
1713 + {
1714 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1715 +index cf62d7e8329f..22756db53dca 100644
1716 +--- a/drivers/net/usb/qmi_wwan.c
1717 ++++ b/drivers/net/usb/qmi_wwan.c
1718 +@@ -667,6 +667,7 @@ static const struct usb_device_id products[] = {
1719 + {QMI_FIXED_INTF(0x05c6, 0x9084, 4)},
1720 + {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
1721 + {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
1722 ++ {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
1723 + {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
1724 + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
1725 + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
1726 +@@ -741,6 +742,7 @@ static const struct usb_device_id products[] = {
1727 + {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
1728 + {QMI_FIXED_INTF(0x19d2, 0x1425, 2)},
1729 + {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */
1730 ++ {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */
1731 + {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
1732 + {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
1733 + {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1734 +@@ -756,6 +758,7 @@ static const struct usb_device_id products[] = {
1735 + {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */
1736 + {QMI_FIXED_INTF(0x1199, 0x9055, 8)}, /* Netgear AirCard 341U */
1737 + {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */
1738 ++ {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
1739 + {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
1740 + {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
1741 + {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
1742 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1743 +index 3fbfb0869030..d2c007098a3b 100644
1744 +--- a/drivers/net/usb/r8152.c
1745 ++++ b/drivers/net/usb/r8152.c
1746 +@@ -1361,7 +1361,7 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb,
1747 + struct sk_buff_head seg_list;
1748 + struct sk_buff *segs, *nskb;
1749 +
1750 +- features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO);
1751 ++ features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6);
1752 + segs = skb_gso_segment(skb, features);
1753 + if (IS_ERR(segs) || !segs)
1754 + goto drop;
1755 +diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
1756 +index 503a81e58185..c1e311341b74 100644
1757 +--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
1758 ++++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
1759 +@@ -1068,13 +1068,6 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1760 + /* recalculate basic rates */
1761 + iwl_calc_basic_rates(priv, ctx);
1762 +
1763 +- /*
1764 +- * force CTS-to-self frames protection if RTS-CTS is not preferred
1765 +- * one aggregation protection method
1766 +- */
1767 +- if (!priv->hw_params.use_rts_for_aggregation)
1768 +- ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1769 +-
1770 + if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
1771 + !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
1772 + ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
1773 +@@ -1480,11 +1473,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1774 + else
1775 + ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
1776 +
1777 +- if (bss_conf->use_cts_prot)
1778 +- ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1779 +- else
1780 +- ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN;
1781 +-
1782 + memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
1783 +
1784 + if (vif->type == NL80211_IFTYPE_AP ||
1785 +diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
1786 +index 9ccec10bba16..c3c8194d85b5 100644
1787 +--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
1788 ++++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
1789 +@@ -667,13 +667,9 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
1790 + if (vif->bss_conf.qos)
1791 + cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
1792 +
1793 +- /* Don't use cts to self as the fw doesn't support it currently. */
1794 +- if (vif->bss_conf.use_cts_prot) {
1795 ++ if (vif->bss_conf.use_cts_prot)
1796 + cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT);
1797 +- if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8)
1798 +- cmd->protection_flags |=
1799 +- cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN);
1800 +- }
1801 ++
1802 + IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n",
1803 + vif->bss_conf.use_cts_prot,
1804 + vif->bss_conf.ht_operation_mode);
1805 +diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
1806 +index 3d1d57f9f5bc..087cb618521c 100644
1807 +--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
1808 ++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
1809 +@@ -367,6 +367,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
1810 + {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)},
1811 + {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)},
1812 + {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
1813 ++ {IWL_PCI_DEVICE(0x095A, 0x5510, iwl7265_2ac_cfg)},
1814 + {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)},
1815 + {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)},
1816 + {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)},
1817 +@@ -380,7 +381,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
1818 + {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
1819 + {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)},
1820 + {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
1821 +- {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)},
1822 ++ {IWL_PCI_DEVICE(0x095B, 0x9200, iwl7265_2ac_cfg)},
1823 + {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)},
1824 + {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)},
1825 + {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
1826 +diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
1827 +index 9c771b3e9918..6ffbe87aecc0 100644
1828 +--- a/drivers/net/wireless/mwifiex/main.c
1829 ++++ b/drivers/net/wireless/mwifiex/main.c
1830 +@@ -647,6 +647,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1831 + }
1832 +
1833 + tx_info = MWIFIEX_SKB_TXCB(skb);
1834 ++ memset(tx_info, 0, sizeof(*tx_info));
1835 + tx_info->bss_num = priv->bss_num;
1836 + tx_info->bss_type = priv->bss_type;
1837 + tx_info->pkt_len = skb->len;
1838 +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
1839 +index 7367208ee8cd..034645a2978f 100644
1840 +--- a/drivers/net/xen-netback/netback.c
1841 ++++ b/drivers/net/xen-netback/netback.c
1842 +@@ -1007,14 +1007,21 @@ static int xenvif_tx_check_gop(struct xenvif *vif,
1843 + {
1844 + struct gnttab_map_grant_ref *gop_map = *gopp_map;
1845 + u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx;
1846 ++ /* This always points to the shinfo of the skb being checked, which
1847 ++ * could be either the first or the one on the frag_list
1848 ++ */
1849 + struct skb_shared_info *shinfo = skb_shinfo(skb);
1850 ++ /* If this is non-NULL, we are currently checking the frag_list skb, and
1851 ++ * this points to the shinfo of the first one
1852 ++ */
1853 ++ struct skb_shared_info *first_shinfo = NULL;
1854 + int nr_frags = shinfo->nr_frags;
1855 ++ const bool sharedslot = nr_frags &&
1856 ++ frag_get_pending_idx(&shinfo->frags[0]) == pending_idx;
1857 + int i, err;
1858 +- struct sk_buff *first_skb = NULL;
1859 +
1860 + /* Check status of header. */
1861 + err = (*gopp_copy)->status;
1862 +- (*gopp_copy)++;
1863 + if (unlikely(err)) {
1864 + if (net_ratelimit())
1865 + netdev_dbg(vif->dev,
1866 +@@ -1022,8 +1029,12 @@ static int xenvif_tx_check_gop(struct xenvif *vif,
1867 + (*gopp_copy)->status,
1868 + pending_idx,
1869 + (*gopp_copy)->source.u.ref);
1870 +- xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_ERROR);
1871 ++ /* The first frag might still have this slot mapped */
1872 ++ if (!sharedslot)
1873 ++ xenvif_idx_release(vif, pending_idx,
1874 ++ XEN_NETIF_RSP_ERROR);
1875 + }
1876 ++ (*gopp_copy)++;
1877 +
1878 + check_frags:
1879 + for (i = 0; i < nr_frags; i++, gop_map++) {
1880 +@@ -1039,8 +1050,19 @@ check_frags:
1881 + pending_idx,
1882 + gop_map->handle);
1883 + /* Had a previous error? Invalidate this fragment. */
1884 +- if (unlikely(err))
1885 ++ if (unlikely(err)) {
1886 + xenvif_idx_unmap(vif, pending_idx);
1887 ++ /* If the mapping of the first frag was OK, but
1888 ++ * the header's copy failed, and they are
1889 ++ * sharing a slot, send an error
1890 ++ */
1891 ++ if (i == 0 && sharedslot)
1892 ++ xenvif_idx_release(vif, pending_idx,
1893 ++ XEN_NETIF_RSP_ERROR);
1894 ++ else
1895 ++ xenvif_idx_release(vif, pending_idx,
1896 ++ XEN_NETIF_RSP_OKAY);
1897 ++ }
1898 + continue;
1899 + }
1900 +
1901 +@@ -1052,42 +1074,53 @@ check_frags:
1902 + gop_map->status,
1903 + pending_idx,
1904 + gop_map->ref);
1905 ++
1906 + xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_ERROR);
1907 +
1908 + /* Not the first error? Preceding frags already invalidated. */
1909 + if (err)
1910 + continue;
1911 +- /* First error: invalidate preceding fragments. */
1912 ++
1913 ++ /* First error: if the header haven't shared a slot with the
1914 ++ * first frag, release it as well.
1915 ++ */
1916 ++ if (!sharedslot)
1917 ++ xenvif_idx_release(vif,
1918 ++ XENVIF_TX_CB(skb)->pending_idx,
1919 ++ XEN_NETIF_RSP_OKAY);
1920 ++
1921 ++ /* Invalidate preceding fragments of this skb. */
1922 + for (j = 0; j < i; j++) {
1923 + pending_idx = frag_get_pending_idx(&shinfo->frags[j]);
1924 + xenvif_idx_unmap(vif, pending_idx);
1925 ++ xenvif_idx_release(vif, pending_idx,
1926 ++ XEN_NETIF_RSP_OKAY);
1927 ++ }
1928 ++
1929 ++ /* And if we found the error while checking the frag_list, unmap
1930 ++ * the first skb's frags
1931 ++ */
1932 ++ if (first_shinfo) {
1933 ++ for (j = 0; j < first_shinfo->nr_frags; j++) {
1934 ++ pending_idx = frag_get_pending_idx(&first_shinfo->frags[j]);
1935 ++ xenvif_idx_unmap(vif, pending_idx);
1936 ++ xenvif_idx_release(vif, pending_idx,
1937 ++ XEN_NETIF_RSP_OKAY);
1938 ++ }
1939 + }
1940 +
1941 + /* Remember the error: invalidate all subsequent fragments. */
1942 + err = newerr;
1943 + }
1944 +
1945 +- if (skb_has_frag_list(skb)) {
1946 +- first_skb = skb;
1947 +- skb = shinfo->frag_list;
1948 +- shinfo = skb_shinfo(skb);
1949 ++ if (skb_has_frag_list(skb) && !first_shinfo) {
1950 ++ first_shinfo = skb_shinfo(skb);
1951 ++ shinfo = skb_shinfo(skb_shinfo(skb)->frag_list);
1952 + nr_frags = shinfo->nr_frags;
1953 +
1954 + goto check_frags;
1955 + }
1956 +
1957 +- /* There was a mapping error in the frag_list skb. We have to unmap
1958 +- * the first skb's frags
1959 +- */
1960 +- if (first_skb && err) {
1961 +- int j;
1962 +- shinfo = skb_shinfo(first_skb);
1963 +- for (j = 0; j < shinfo->nr_frags; j++) {
1964 +- pending_idx = frag_get_pending_idx(&shinfo->frags[j]);
1965 +- xenvif_idx_unmap(vif, pending_idx);
1966 +- }
1967 +- }
1968 +-
1969 + *gopp_map = gop_map;
1970 + return err;
1971 + }
1972 +@@ -1495,7 +1528,16 @@ static int xenvif_tx_submit(struct xenvif *vif)
1973 +
1974 + /* Check the remap error code. */
1975 + if (unlikely(xenvif_tx_check_gop(vif, skb, &gop_map, &gop_copy))) {
1976 ++ /* If there was an error, xenvif_tx_check_gop is
1977 ++ * expected to release all the frags which were mapped,
1978 ++ * so kfree_skb shouldn't do it again
1979 ++ */
1980 + skb_shinfo(skb)->nr_frags = 0;
1981 ++ if (skb_has_frag_list(skb)) {
1982 ++ struct sk_buff *nskb =
1983 ++ skb_shinfo(skb)->frag_list;
1984 ++ skb_shinfo(nskb)->nr_frags = 0;
1985 ++ }
1986 + kfree_skb(skb);
1987 + continue;
1988 + }
1989 +@@ -1799,8 +1841,6 @@ void xenvif_idx_unmap(struct xenvif *vif, u16 pending_idx)
1990 + tx_unmap_op.status);
1991 + BUG();
1992 + }
1993 +-
1994 +- xenvif_idx_release(vif, pending_idx, XEN_NETIF_RSP_OKAY);
1995 + }
1996 +
1997 + static inline int rx_work_todo(struct xenvif *vif)
1998 +diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
1999 +index 482c45b777d3..9d13da48ebe1 100644
2000 +--- a/drivers/usb/chipidea/udc.c
2001 ++++ b/drivers/usb/chipidea/udc.c
2002 +@@ -1176,8 +1176,8 @@ static int ep_enable(struct usb_ep *ep,
2003 +
2004 + if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
2005 + cap |= QH_IOS;
2006 +- if (hwep->num)
2007 +- cap |= QH_ZLT;
2008 ++
2009 ++ cap |= QH_ZLT;
2010 + cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
2011 + /*
2012 + * For ISO-TX, we set mult at QH as the largest value, and use
2013 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
2014 +index 229a73f64304..00c4b96b4e4f 100644
2015 +--- a/drivers/usb/core/hub.c
2016 ++++ b/drivers/usb/core/hub.c
2017 +@@ -893,6 +893,25 @@ static int hub_usb3_port_disable(struct usb_hub *hub, int port1)
2018 + if (!hub_is_superspeed(hub->hdev))
2019 + return -EINVAL;
2020 +
2021 ++ ret = hub_port_status(hub, port1, &portstatus, &portchange);
2022 ++ if (ret < 0)
2023 ++ return ret;
2024 ++
2025 ++ /*
2026 ++ * USB controller Advanced Micro Devices, Inc. [AMD] FCH USB XHCI
2027 ++ * Controller [1022:7814] will have spurious result making the following
2028 ++ * usb 3.0 device hotplugging route to the 2.0 root hub and recognized
2029 ++ * as high-speed device if we set the usb 3.0 port link state to
2030 ++ * Disabled. Since it's already in USB_SS_PORT_LS_RX_DETECT state, we
2031 ++ * check the state here to avoid the bug.
2032 ++ */
2033 ++ if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
2034 ++ USB_SS_PORT_LS_RX_DETECT) {
2035 ++ dev_dbg(&hub->ports[port1 - 1]->dev,
2036 ++ "Not disabling port; link state is RxDetect\n");
2037 ++ return ret;
2038 ++ }
2039 ++
2040 + ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
2041 + if (ret)
2042 + return ret;
2043 +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
2044 +index b7a506f2bb14..5c660c77f03b 100644
2045 +--- a/drivers/xen/balloon.c
2046 ++++ b/drivers/xen/balloon.c
2047 +@@ -426,20 +426,18 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
2048 + * p2m are consistent.
2049 + */
2050 + if (!xen_feature(XENFEAT_auto_translated_physmap)) {
2051 +- unsigned long p;
2052 +- struct page *scratch_page = get_balloon_scratch_page();
2053 +-
2054 + if (!PageHighMem(page)) {
2055 ++ struct page *scratch_page = get_balloon_scratch_page();
2056 ++
2057 + ret = HYPERVISOR_update_va_mapping(
2058 + (unsigned long)__va(pfn << PAGE_SHIFT),
2059 + pfn_pte(page_to_pfn(scratch_page),
2060 + PAGE_KERNEL_RO), 0);
2061 + BUG_ON(ret);
2062 +- }
2063 +- p = page_to_pfn(scratch_page);
2064 +- __set_phys_to_machine(pfn, pfn_to_mfn(p));
2065 +
2066 +- put_balloon_scratch_page();
2067 ++ put_balloon_scratch_page();
2068 ++ }
2069 ++ __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
2070 + }
2071 + #endif
2072 +
2073 +diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
2074 +index 32f9236c959f..8684e0e4d41b 100644
2075 +--- a/drivers/xen/manage.c
2076 ++++ b/drivers/xen/manage.c
2077 +@@ -109,7 +109,6 @@ static int xen_suspend(void *data)
2078 +
2079 + if (!si->cancelled) {
2080 + xen_irq_resume();
2081 +- xen_console_resume();
2082 + xen_timer_resume();
2083 + }
2084 +
2085 +@@ -166,6 +165,10 @@ static void do_suspend(void)
2086 +
2087 + err = stop_machine(xen_suspend, &si, cpumask_of(0));
2088 +
2089 ++ /* Resume console as early as possible. */
2090 ++ if (!si.cancelled)
2091 ++ xen_console_resume();
2092 ++
2093 + raw_notifier_call_chain(&xen_resume_notifier, 0, NULL);
2094 +
2095 + dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE);
2096 +diff --git a/fs/aio.c b/fs/aio.c
2097 +index e609e15f36b9..6d68e01dc7ca 100644
2098 +--- a/fs/aio.c
2099 ++++ b/fs/aio.c
2100 +@@ -830,16 +830,20 @@ void exit_aio(struct mm_struct *mm)
2101 + static void put_reqs_available(struct kioctx *ctx, unsigned nr)
2102 + {
2103 + struct kioctx_cpu *kcpu;
2104 ++ unsigned long flags;
2105 +
2106 + preempt_disable();
2107 + kcpu = this_cpu_ptr(ctx->cpu);
2108 +
2109 ++ local_irq_save(flags);
2110 + kcpu->reqs_available += nr;
2111 ++
2112 + while (kcpu->reqs_available >= ctx->req_batch * 2) {
2113 + kcpu->reqs_available -= ctx->req_batch;
2114 + atomic_add(ctx->req_batch, &ctx->reqs_available);
2115 + }
2116 +
2117 ++ local_irq_restore(flags);
2118 + preempt_enable();
2119 + }
2120 +
2121 +@@ -847,10 +851,12 @@ static bool get_reqs_available(struct kioctx *ctx)
2122 + {
2123 + struct kioctx_cpu *kcpu;
2124 + bool ret = false;
2125 ++ unsigned long flags;
2126 +
2127 + preempt_disable();
2128 + kcpu = this_cpu_ptr(ctx->cpu);
2129 +
2130 ++ local_irq_save(flags);
2131 + if (!kcpu->reqs_available) {
2132 + int old, avail = atomic_read(&ctx->reqs_available);
2133 +
2134 +@@ -869,6 +875,7 @@ static bool get_reqs_available(struct kioctx *ctx)
2135 + ret = true;
2136 + kcpu->reqs_available--;
2137 + out:
2138 ++ local_irq_restore(flags);
2139 + preempt_enable();
2140 + return ret;
2141 + }
2142 +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
2143 +index aac71ce373e4..75fa055012b2 100644
2144 +--- a/fs/fuse/dev.c
2145 ++++ b/fs/fuse/dev.c
2146 +@@ -643,9 +643,8 @@ struct fuse_copy_state {
2147 + unsigned long seglen;
2148 + unsigned long addr;
2149 + struct page *pg;
2150 +- void *mapaddr;
2151 +- void *buf;
2152 + unsigned len;
2153 ++ unsigned offset;
2154 + unsigned move_pages:1;
2155 + };
2156 +
2157 +@@ -666,23 +665,17 @@ static void fuse_copy_finish(struct fuse_copy_state *cs)
2158 + if (cs->currbuf) {
2159 + struct pipe_buffer *buf = cs->currbuf;
2160 +
2161 +- if (!cs->write) {
2162 +- kunmap_atomic(cs->mapaddr);
2163 +- } else {
2164 +- kunmap_atomic(cs->mapaddr);
2165 ++ if (cs->write)
2166 + buf->len = PAGE_SIZE - cs->len;
2167 +- }
2168 + cs->currbuf = NULL;
2169 +- cs->mapaddr = NULL;
2170 +- } else if (cs->mapaddr) {
2171 +- kunmap_atomic(cs->mapaddr);
2172 ++ } else if (cs->pg) {
2173 + if (cs->write) {
2174 + flush_dcache_page(cs->pg);
2175 + set_page_dirty_lock(cs->pg);
2176 + }
2177 + put_page(cs->pg);
2178 +- cs->mapaddr = NULL;
2179 + }
2180 ++ cs->pg = NULL;
2181 + }
2182 +
2183 + /*
2184 +@@ -691,7 +684,7 @@ static void fuse_copy_finish(struct fuse_copy_state *cs)
2185 + */
2186 + static int fuse_copy_fill(struct fuse_copy_state *cs)
2187 + {
2188 +- unsigned long offset;
2189 ++ struct page *page;
2190 + int err;
2191 +
2192 + unlock_request(cs->fc, cs->req);
2193 +@@ -706,14 +699,12 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
2194 +
2195 + BUG_ON(!cs->nr_segs);
2196 + cs->currbuf = buf;
2197 +- cs->mapaddr = kmap_atomic(buf->page);
2198 ++ cs->pg = buf->page;
2199 ++ cs->offset = buf->offset;
2200 + cs->len = buf->len;
2201 +- cs->buf = cs->mapaddr + buf->offset;
2202 + cs->pipebufs++;
2203 + cs->nr_segs--;
2204 + } else {
2205 +- struct page *page;
2206 +-
2207 + if (cs->nr_segs == cs->pipe->buffers)
2208 + return -EIO;
2209 +
2210 +@@ -726,8 +717,8 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
2211 + buf->len = 0;
2212 +
2213 + cs->currbuf = buf;
2214 +- cs->mapaddr = kmap_atomic(page);
2215 +- cs->buf = cs->mapaddr;
2216 ++ cs->pg = page;
2217 ++ cs->offset = 0;
2218 + cs->len = PAGE_SIZE;
2219 + cs->pipebufs++;
2220 + cs->nr_segs++;
2221 +@@ -740,14 +731,13 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
2222 + cs->iov++;
2223 + cs->nr_segs--;
2224 + }
2225 +- err = get_user_pages_fast(cs->addr, 1, cs->write, &cs->pg);
2226 ++ err = get_user_pages_fast(cs->addr, 1, cs->write, &page);
2227 + if (err < 0)
2228 + return err;
2229 + BUG_ON(err != 1);
2230 +- offset = cs->addr % PAGE_SIZE;
2231 +- cs->mapaddr = kmap_atomic(cs->pg);
2232 +- cs->buf = cs->mapaddr + offset;
2233 +- cs->len = min(PAGE_SIZE - offset, cs->seglen);
2234 ++ cs->pg = page;
2235 ++ cs->offset = cs->addr % PAGE_SIZE;
2236 ++ cs->len = min(PAGE_SIZE - cs->offset, cs->seglen);
2237 + cs->seglen -= cs->len;
2238 + cs->addr += cs->len;
2239 + }
2240 +@@ -760,15 +750,20 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size)
2241 + {
2242 + unsigned ncpy = min(*size, cs->len);
2243 + if (val) {
2244 ++ void *pgaddr = kmap_atomic(cs->pg);
2245 ++ void *buf = pgaddr + cs->offset;
2246 ++
2247 + if (cs->write)
2248 +- memcpy(cs->buf, *val, ncpy);
2249 ++ memcpy(buf, *val, ncpy);
2250 + else
2251 +- memcpy(*val, cs->buf, ncpy);
2252 ++ memcpy(*val, buf, ncpy);
2253 ++
2254 ++ kunmap_atomic(pgaddr);
2255 + *val += ncpy;
2256 + }
2257 + *size -= ncpy;
2258 + cs->len -= ncpy;
2259 +- cs->buf += ncpy;
2260 ++ cs->offset += ncpy;
2261 + return ncpy;
2262 + }
2263 +
2264 +@@ -874,8 +869,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
2265 + out_fallback_unlock:
2266 + unlock_page(newpage);
2267 + out_fallback:
2268 +- cs->mapaddr = kmap_atomic(buf->page);
2269 +- cs->buf = cs->mapaddr + buf->offset;
2270 ++ cs->pg = buf->page;
2271 ++ cs->offset = buf->offset;
2272 +
2273 + err = lock_request(cs->fc, cs->req);
2274 + if (err)
2275 +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
2276 +index 42198359fa1b..202a9721be93 100644
2277 +--- a/fs/fuse/dir.c
2278 ++++ b/fs/fuse/dir.c
2279 +@@ -198,7 +198,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
2280 + inode = ACCESS_ONCE(entry->d_inode);
2281 + if (inode && is_bad_inode(inode))
2282 + goto invalid;
2283 +- else if (fuse_dentry_time(entry) < get_jiffies_64()) {
2284 ++ else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
2285 ++ (flags & LOOKUP_REVAL)) {
2286 + int err;
2287 + struct fuse_entry_out outarg;
2288 + struct fuse_req *req;
2289 +@@ -985,7 +986,7 @@ int fuse_update_attributes(struct inode *inode, struct kstat *stat,
2290 + int err;
2291 + bool r;
2292 +
2293 +- if (fi->i_time < get_jiffies_64()) {
2294 ++ if (time_before64(fi->i_time, get_jiffies_64())) {
2295 + r = true;
2296 + err = fuse_do_getattr(inode, stat, file);
2297 + } else {
2298 +@@ -1171,7 +1172,7 @@ static int fuse_permission(struct inode *inode, int mask)
2299 + ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
2300 + struct fuse_inode *fi = get_fuse_inode(inode);
2301 +
2302 +- if (fi->i_time < get_jiffies_64()) {
2303 ++ if (time_before64(fi->i_time, get_jiffies_64())) {
2304 + refreshed = true;
2305 +
2306 + err = fuse_perm_getattr(inode, mask);
2307 +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
2308 +index 754dcf23de8a..e2cd799e4d21 100644
2309 +--- a/fs/fuse/inode.c
2310 ++++ b/fs/fuse/inode.c
2311 +@@ -478,6 +478,17 @@ static const match_table_t tokens = {
2312 + {OPT_ERR, NULL}
2313 + };
2314 +
2315 ++static int fuse_match_uint(substring_t *s, unsigned int *res)
2316 ++{
2317 ++ int err = -ENOMEM;
2318 ++ char *buf = match_strdup(s);
2319 ++ if (buf) {
2320 ++ err = kstrtouint(buf, 10, res);
2321 ++ kfree(buf);
2322 ++ }
2323 ++ return err;
2324 ++}
2325 ++
2326 + static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
2327 + {
2328 + char *p;
2329 +@@ -488,6 +499,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
2330 + while ((p = strsep(&opt, ",")) != NULL) {
2331 + int token;
2332 + int value;
2333 ++ unsigned uv;
2334 + substring_t args[MAX_OPT_ARGS];
2335 + if (!*p)
2336 + continue;
2337 +@@ -511,18 +523,18 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
2338 + break;
2339 +
2340 + case OPT_USER_ID:
2341 +- if (match_int(&args[0], &value))
2342 ++ if (fuse_match_uint(&args[0], &uv))
2343 + return 0;
2344 +- d->user_id = make_kuid(current_user_ns(), value);
2345 ++ d->user_id = make_kuid(current_user_ns(), uv);
2346 + if (!uid_valid(d->user_id))
2347 + return 0;
2348 + d->user_id_present = 1;
2349 + break;
2350 +
2351 + case OPT_GROUP_ID:
2352 +- if (match_int(&args[0], &value))
2353 ++ if (fuse_match_uint(&args[0], &uv))
2354 + return 0;
2355 +- d->group_id = make_kgid(current_user_ns(), value);
2356 ++ d->group_id = make_kgid(current_user_ns(), uv);
2357 + if (!gid_valid(d->group_id))
2358 + return 0;
2359 + d->group_id_present = 1;
2360 +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
2361 +index 9cd5f63715c0..7f30bdc57d13 100644
2362 +--- a/fs/quota/dquot.c
2363 ++++ b/fs/quota/dquot.c
2364 +@@ -702,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
2365 + struct dquot *dquot;
2366 + unsigned long freed = 0;
2367 +
2368 ++ spin_lock(&dq_list_lock);
2369 + head = free_dquots.prev;
2370 + while (head != &free_dquots && sc->nr_to_scan) {
2371 + dquot = list_entry(head, struct dquot, dq_free);
2372 +@@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
2373 + freed++;
2374 + head = free_dquots.prev;
2375 + }
2376 ++ spin_unlock(&dq_list_lock);
2377 + return freed;
2378 + }
2379 +
2380 +diff --git a/include/net/sock.h b/include/net/sock.h
2381 +index 21569cf456ed..f5a7e22fb09f 100644
2382 +--- a/include/net/sock.h
2383 ++++ b/include/net/sock.h
2384 +@@ -1728,8 +1728,8 @@ sk_dst_get(struct sock *sk)
2385 +
2386 + rcu_read_lock();
2387 + dst = rcu_dereference(sk->sk_dst_cache);
2388 +- if (dst)
2389 +- dst_hold(dst);
2390 ++ if (dst && !atomic_inc_not_zero(&dst->__refcnt))
2391 ++ dst = NULL;
2392 + rcu_read_unlock();
2393 + return dst;
2394 + }
2395 +@@ -1766,9 +1766,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
2396 + static inline void
2397 + sk_dst_set(struct sock *sk, struct dst_entry *dst)
2398 + {
2399 +- spin_lock(&sk->sk_dst_lock);
2400 +- __sk_dst_set(sk, dst);
2401 +- spin_unlock(&sk->sk_dst_lock);
2402 ++ struct dst_entry *old_dst;
2403 ++
2404 ++ sk_tx_queue_clear(sk);
2405 ++ old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
2406 ++ dst_release(old_dst);
2407 + }
2408 +
2409 + static inline void
2410 +@@ -1780,9 +1782,7 @@ __sk_dst_reset(struct sock *sk)
2411 + static inline void
2412 + sk_dst_reset(struct sock *sk)
2413 + {
2414 +- spin_lock(&sk->sk_dst_lock);
2415 +- __sk_dst_reset(sk);
2416 +- spin_unlock(&sk->sk_dst_lock);
2417 ++ sk_dst_set(sk, NULL);
2418 + }
2419 +
2420 + struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
2421 +diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
2422 +index d2b32ac27a39..ecee67a00f5f 100644
2423 +--- a/kernel/Kconfig.locks
2424 ++++ b/kernel/Kconfig.locks
2425 +@@ -220,6 +220,9 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE
2426 +
2427 + endif
2428 +
2429 ++config ARCH_SUPPORTS_ATOMIC_RMW
2430 ++ bool
2431 ++
2432 + config MUTEX_SPIN_ON_OWNER
2433 + def_bool y
2434 +- depends on SMP && !DEBUG_MUTEXES
2435 ++ depends on SMP && !DEBUG_MUTEXES && ARCH_SUPPORTS_ATOMIC_RMW
2436 +diff --git a/kernel/events/core.c b/kernel/events/core.c
2437 +index 440eefc67397..935271c4b4d4 100644
2438 +--- a/kernel/events/core.c
2439 ++++ b/kernel/events/core.c
2440 +@@ -2315,7 +2315,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
2441 + next_parent = rcu_dereference(next_ctx->parent_ctx);
2442 +
2443 + /* If neither context have a parent context; they cannot be clones. */
2444 +- if (!parent && !next_parent)
2445 ++ if (!parent || !next_parent)
2446 + goto unlock;
2447 +
2448 + if (next_parent == ctx || next_ctx == parent || next_parent == parent) {
2449 +diff --git a/kernel/power/process.c b/kernel/power/process.c
2450 +index 06ec8869dbf1..14f9a8d4725d 100644
2451 +--- a/kernel/power/process.c
2452 ++++ b/kernel/power/process.c
2453 +@@ -184,6 +184,7 @@ void thaw_processes(void)
2454 +
2455 + printk("Restarting tasks ... ");
2456 +
2457 ++ __usermodehelper_set_disable_depth(UMH_FREEZING);
2458 + thaw_workqueues();
2459 +
2460 + read_lock(&tasklist_lock);
2461 +diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
2462 +index 695f9773bb60..627b3c34b821 100644
2463 +--- a/kernel/sched/debug.c
2464 ++++ b/kernel/sched/debug.c
2465 +@@ -608,7 +608,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
2466 +
2467 + avg_atom = p->se.sum_exec_runtime;
2468 + if (nr_switches)
2469 +- do_div(avg_atom, nr_switches);
2470 ++ avg_atom = div64_ul(avg_atom, nr_switches);
2471 + else
2472 + avg_atom = -1LL;
2473 +
2474 +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
2475 +index 88c9c65a430d..fe75444ae7ec 100644
2476 +--- a/kernel/time/alarmtimer.c
2477 ++++ b/kernel/time/alarmtimer.c
2478 +@@ -585,9 +585,14 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
2479 + struct itimerspec *new_setting,
2480 + struct itimerspec *old_setting)
2481 + {
2482 ++ ktime_t exp;
2483 ++
2484 + if (!rtcdev)
2485 + return -ENOTSUPP;
2486 +
2487 ++ if (flags & ~TIMER_ABSTIME)
2488 ++ return -EINVAL;
2489 ++
2490 + if (old_setting)
2491 + alarm_timer_get(timr, old_setting);
2492 +
2493 +@@ -597,8 +602,16 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
2494 +
2495 + /* start the timer */
2496 + timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval);
2497 +- alarm_start(&timr->it.alarm.alarmtimer,
2498 +- timespec_to_ktime(new_setting->it_value));
2499 ++ exp = timespec_to_ktime(new_setting->it_value);
2500 ++ /* Convert (if necessary) to absolute time */
2501 ++ if (flags != TIMER_ABSTIME) {
2502 ++ ktime_t now;
2503 ++
2504 ++ now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();
2505 ++ exp = ktime_add(now, exp);
2506 ++ }
2507 ++
2508 ++ alarm_start(&timr->it.alarm.alarmtimer, exp);
2509 + return 0;
2510 + }
2511 +
2512 +@@ -730,6 +743,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
2513 + if (!alarmtimer_get_rtcdev())
2514 + return -ENOTSUPP;
2515 +
2516 ++ if (flags & ~TIMER_ABSTIME)
2517 ++ return -EINVAL;
2518 ++
2519 + if (!capable(CAP_WAKE_ALARM))
2520 + return -EPERM;
2521 +
2522 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
2523 +index 4a54a25afa2f..5aeac5338b30 100644
2524 +--- a/kernel/trace/ftrace.c
2525 ++++ b/kernel/trace/ftrace.c
2526 +@@ -325,12 +325,12 @@ static void update_ftrace_function(void)
2527 + func = ftrace_ops_list_func;
2528 + }
2529 +
2530 ++ update_function_graph_func();
2531 ++
2532 + /* If there's no change, then do nothing more here */
2533 + if (ftrace_trace_function == func)
2534 + return;
2535 +
2536 +- update_function_graph_func();
2537 +-
2538 + /*
2539 + * If we are using the list function, it doesn't care
2540 + * about the function_trace_ops.
2541 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
2542 +index 7c56c3d06943..ff7027199a9a 100644
2543 +--- a/kernel/trace/ring_buffer.c
2544 ++++ b/kernel/trace/ring_buffer.c
2545 +@@ -616,10 +616,6 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
2546 + struct ring_buffer_per_cpu *cpu_buffer;
2547 + struct rb_irq_work *work;
2548 +
2549 +- if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) ||
2550 +- (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu)))
2551 +- return POLLIN | POLLRDNORM;
2552 +-
2553 + if (cpu == RING_BUFFER_ALL_CPUS)
2554 + work = &buffer->irq_work;
2555 + else {
2556 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
2557 +index 39a12265c253..4dcbf7dc3c51 100644
2558 +--- a/kernel/trace/trace.c
2559 ++++ b/kernel/trace/trace.c
2560 +@@ -466,6 +466,12 @@ int __trace_puts(unsigned long ip, const char *str, int size)
2561 + struct print_entry *entry;
2562 + unsigned long irq_flags;
2563 + int alloc;
2564 ++ int pc;
2565 ++
2566 ++ if (!(trace_flags & TRACE_ITER_PRINTK))
2567 ++ return 0;
2568 ++
2569 ++ pc = preempt_count();
2570 +
2571 + if (unlikely(tracing_selftest_running || tracing_disabled))
2572 + return 0;
2573 +@@ -475,7 +481,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
2574 + local_save_flags(irq_flags);
2575 + buffer = global_trace.trace_buffer.buffer;
2576 + event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
2577 +- irq_flags, preempt_count());
2578 ++ irq_flags, pc);
2579 + if (!event)
2580 + return 0;
2581 +
2582 +@@ -492,6 +498,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
2583 + entry->buf[size] = '\0';
2584 +
2585 + __buffer_unlock_commit(buffer, event);
2586 ++ ftrace_trace_stack(buffer, irq_flags, 4, pc);
2587 +
2588 + return size;
2589 + }
2590 +@@ -509,6 +516,12 @@ int __trace_bputs(unsigned long ip, const char *str)
2591 + struct bputs_entry *entry;
2592 + unsigned long irq_flags;
2593 + int size = sizeof(struct bputs_entry);
2594 ++ int pc;
2595 ++
2596 ++ if (!(trace_flags & TRACE_ITER_PRINTK))
2597 ++ return 0;
2598 ++
2599 ++ pc = preempt_count();
2600 +
2601 + if (unlikely(tracing_selftest_running || tracing_disabled))
2602 + return 0;
2603 +@@ -516,7 +529,7 @@ int __trace_bputs(unsigned long ip, const char *str)
2604 + local_save_flags(irq_flags);
2605 + buffer = global_trace.trace_buffer.buffer;
2606 + event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
2607 +- irq_flags, preempt_count());
2608 ++ irq_flags, pc);
2609 + if (!event)
2610 + return 0;
2611 +
2612 +@@ -525,6 +538,7 @@ int __trace_bputs(unsigned long ip, const char *str)
2613 + entry->str = str;
2614 +
2615 + __buffer_unlock_commit(buffer, event);
2616 ++ ftrace_trace_stack(buffer, irq_flags, 4, pc);
2617 +
2618 + return 1;
2619 + }
2620 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
2621 +index 3ddfd8f62c05..aec1dac0a4e4 100644
2622 +--- a/kernel/trace/trace_events.c
2623 ++++ b/kernel/trace/trace_events.c
2624 +@@ -470,6 +470,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file)
2625 +
2626 + list_del(&file->list);
2627 + remove_subsystem(file->system);
2628 ++ free_event_filter(file->filter);
2629 + kmem_cache_free(file_cachep, file);
2630 + }
2631 +
2632 +diff --git a/mm/shmem.c b/mm/shmem.c
2633 +index a2801ba8ae2d..a731cef61305 100644
2634 +--- a/mm/shmem.c
2635 ++++ b/mm/shmem.c
2636 +@@ -80,11 +80,12 @@ static struct vfsmount *shm_mnt;
2637 + #define SHORT_SYMLINK_LEN 128
2638 +
2639 + /*
2640 +- * shmem_fallocate and shmem_writepage communicate via inode->i_private
2641 +- * (with i_mutex making sure that it has only one user at a time):
2642 +- * we would prefer not to enlarge the shmem inode just for that.
2643 ++ * shmem_fallocate communicates with shmem_fault or shmem_writepage via
2644 ++ * inode->i_private (with i_mutex making sure that it has only one user at
2645 ++ * a time): we would prefer not to enlarge the shmem inode just for that.
2646 + */
2647 + struct shmem_falloc {
2648 ++ wait_queue_head_t *waitq; /* faults into hole wait for punch to end */
2649 + pgoff_t start; /* start of range currently being fallocated */
2650 + pgoff_t next; /* the next page offset to be fallocated */
2651 + pgoff_t nr_falloced; /* how many new pages have been fallocated */
2652 +@@ -467,23 +468,20 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
2653 + return;
2654 +
2655 + index = start;
2656 +- for ( ; ; ) {
2657 ++ while (index < end) {
2658 + cond_resched();
2659 +
2660 + pvec.nr = find_get_entries(mapping, index,
2661 + min(end - index, (pgoff_t)PAGEVEC_SIZE),
2662 + pvec.pages, indices);
2663 + if (!pvec.nr) {
2664 +- if (index == start || unfalloc)
2665 ++ /* If all gone or hole-punch or unfalloc, we're done */
2666 ++ if (index == start || end != -1)
2667 + break;
2668 ++ /* But if truncating, restart to make sure all gone */
2669 + index = start;
2670 + continue;
2671 + }
2672 +- if ((index == start || unfalloc) && indices[0] >= end) {
2673 +- pagevec_remove_exceptionals(&pvec);
2674 +- pagevec_release(&pvec);
2675 +- break;
2676 +- }
2677 + mem_cgroup_uncharge_start();
2678 + for (i = 0; i < pagevec_count(&pvec); i++) {
2679 + struct page *page = pvec.pages[i];
2680 +@@ -495,8 +493,12 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
2681 + if (radix_tree_exceptional_entry(page)) {
2682 + if (unfalloc)
2683 + continue;
2684 +- nr_swaps_freed += !shmem_free_swap(mapping,
2685 +- index, page);
2686 ++ if (shmem_free_swap(mapping, index, page)) {
2687 ++ /* Swap was replaced by page: retry */
2688 ++ index--;
2689 ++ break;
2690 ++ }
2691 ++ nr_swaps_freed++;
2692 + continue;
2693 + }
2694 +
2695 +@@ -505,6 +507,11 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
2696 + if (page->mapping == mapping) {
2697 + VM_BUG_ON_PAGE(PageWriteback(page), page);
2698 + truncate_inode_page(mapping, page);
2699 ++ } else {
2700 ++ /* Page was replaced by swap: retry */
2701 ++ unlock_page(page);
2702 ++ index--;
2703 ++ break;
2704 + }
2705 + }
2706 + unlock_page(page);
2707 +@@ -759,6 +766,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
2708 + spin_lock(&inode->i_lock);
2709 + shmem_falloc = inode->i_private;
2710 + if (shmem_falloc &&
2711 ++ !shmem_falloc->waitq &&
2712 + index >= shmem_falloc->start &&
2713 + index < shmem_falloc->next)
2714 + shmem_falloc->nr_unswapped++;
2715 +@@ -1233,6 +1241,64 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
2716 + int error;
2717 + int ret = VM_FAULT_LOCKED;
2718 +
2719 ++ /*
2720 ++ * Trinity finds that probing a hole which tmpfs is punching can
2721 ++ * prevent the hole-punch from ever completing: which in turn
2722 ++ * locks writers out with its hold on i_mutex. So refrain from
2723 ++ * faulting pages into the hole while it's being punched. Although
2724 ++ * shmem_undo_range() does remove the additions, it may be unable to
2725 ++ * keep up, as each new page needs its own unmap_mapping_range() call,
2726 ++ * and the i_mmap tree grows ever slower to scan if new vmas are added.
2727 ++ *
2728 ++ * It does not matter if we sometimes reach this check just before the
2729 ++ * hole-punch begins, so that one fault then races with the punch:
2730 ++ * we just need to make racing faults a rare case.
2731 ++ *
2732 ++ * The implementation below would be much simpler if we just used a
2733 ++ * standard mutex or completion: but we cannot take i_mutex in fault,
2734 ++ * and bloating every shmem inode for this unlikely case would be sad.
2735 ++ */
2736 ++ if (unlikely(inode->i_private)) {
2737 ++ struct shmem_falloc *shmem_falloc;
2738 ++
2739 ++ spin_lock(&inode->i_lock);
2740 ++ shmem_falloc = inode->i_private;
2741 ++ if (shmem_falloc &&
2742 ++ shmem_falloc->waitq &&
2743 ++ vmf->pgoff >= shmem_falloc->start &&
2744 ++ vmf->pgoff < shmem_falloc->next) {
2745 ++ wait_queue_head_t *shmem_falloc_waitq;
2746 ++ DEFINE_WAIT(shmem_fault_wait);
2747 ++
2748 ++ ret = VM_FAULT_NOPAGE;
2749 ++ if ((vmf->flags & FAULT_FLAG_ALLOW_RETRY) &&
2750 ++ !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
2751 ++ /* It's polite to up mmap_sem if we can */
2752 ++ up_read(&vma->vm_mm->mmap_sem);
2753 ++ ret = VM_FAULT_RETRY;
2754 ++ }
2755 ++
2756 ++ shmem_falloc_waitq = shmem_falloc->waitq;
2757 ++ prepare_to_wait(shmem_falloc_waitq, &shmem_fault_wait,
2758 ++ TASK_UNINTERRUPTIBLE);
2759 ++ spin_unlock(&inode->i_lock);
2760 ++ schedule();
2761 ++
2762 ++ /*
2763 ++ * shmem_falloc_waitq points into the shmem_fallocate()
2764 ++ * stack of the hole-punching task: shmem_falloc_waitq
2765 ++ * is usually invalid by the time we reach here, but
2766 ++ * finish_wait() does not dereference it in that case;
2767 ++ * though i_lock needed lest racing with wake_up_all().
2768 ++ */
2769 ++ spin_lock(&inode->i_lock);
2770 ++ finish_wait(shmem_falloc_waitq, &shmem_fault_wait);
2771 ++ spin_unlock(&inode->i_lock);
2772 ++ return ret;
2773 ++ }
2774 ++ spin_unlock(&inode->i_lock);
2775 ++ }
2776 ++
2777 + error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret);
2778 + if (error)
2779 + return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS);
2780 +@@ -1737,12 +1803,25 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
2781 + struct address_space *mapping = file->f_mapping;
2782 + loff_t unmap_start = round_up(offset, PAGE_SIZE);
2783 + loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1;
2784 ++ DECLARE_WAIT_QUEUE_HEAD_ONSTACK(shmem_falloc_waitq);
2785 ++
2786 ++ shmem_falloc.waitq = &shmem_falloc_waitq;
2787 ++ shmem_falloc.start = unmap_start >> PAGE_SHIFT;
2788 ++ shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT;
2789 ++ spin_lock(&inode->i_lock);
2790 ++ inode->i_private = &shmem_falloc;
2791 ++ spin_unlock(&inode->i_lock);
2792 +
2793 + if ((u64)unmap_end > (u64)unmap_start)
2794 + unmap_mapping_range(mapping, unmap_start,
2795 + 1 + unmap_end - unmap_start, 0);
2796 + shmem_truncate_range(inode, offset, offset + len - 1);
2797 + /* No need to unmap again: hole-punching leaves COWed pages */
2798 ++
2799 ++ spin_lock(&inode->i_lock);
2800 ++ inode->i_private = NULL;
2801 ++ wake_up_all(&shmem_falloc_waitq);
2802 ++ spin_unlock(&inode->i_lock);
2803 + error = 0;
2804 + goto out;
2805 + }
2806 +@@ -1760,6 +1839,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
2807 + goto out;
2808 + }
2809 +
2810 ++ shmem_falloc.waitq = NULL;
2811 + shmem_falloc.start = start;
2812 + shmem_falloc.next = start;
2813 + shmem_falloc.nr_falloced = 0;
2814 +diff --git a/mm/vmscan.c b/mm/vmscan.c
2815 +index a50bde6edbbc..229c017cd090 100644
2816 +--- a/mm/vmscan.c
2817 ++++ b/mm/vmscan.c
2818 +@@ -1554,19 +1554,18 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
2819 + * If dirty pages are scanned that are not queued for IO, it
2820 + * implies that flushers are not keeping up. In this case, flag
2821 + * the zone ZONE_TAIL_LRU_DIRTY and kswapd will start writing
2822 +- * pages from reclaim context. It will forcibly stall in the
2823 +- * next check.
2824 ++ * pages from reclaim context.
2825 + */
2826 + if (nr_unqueued_dirty == nr_taken)
2827 + zone_set_flag(zone, ZONE_TAIL_LRU_DIRTY);
2828 +
2829 + /*
2830 +- * In addition, if kswapd scans pages marked marked for
2831 +- * immediate reclaim and under writeback (nr_immediate), it
2832 +- * implies that pages are cycling through the LRU faster than
2833 ++ * If kswapd scans pages marked marked for immediate
2834 ++ * reclaim and under writeback (nr_immediate), it implies
2835 ++ * that pages are cycling through the LRU faster than
2836 + * they are written so also forcibly stall.
2837 + */
2838 +- if (nr_unqueued_dirty == nr_taken || nr_immediate)
2839 ++ if (nr_immediate)
2840 + congestion_wait(BLK_RW_ASYNC, HZ/10);
2841 + }
2842 +
2843 +diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
2844 +index 3c32bd257b73..80e0d0360b80 100644
2845 +--- a/net/8021q/vlan_core.c
2846 ++++ b/net/8021q/vlan_core.c
2847 +@@ -114,8 +114,11 @@ EXPORT_SYMBOL(vlan_dev_vlan_proto);
2848 +
2849 + static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
2850 + {
2851 +- if (skb_cow(skb, skb_headroom(skb)) < 0)
2852 ++ if (skb_cow(skb, skb_headroom(skb)) < 0) {
2853 ++ kfree_skb(skb);
2854 + return NULL;
2855 ++ }
2856 ++
2857 + memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
2858 + skb->mac_header += VLAN_HLEN;
2859 + return skb;
2860 +diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
2861 +index 019efb79708f..6806d03a67a1 100644
2862 +--- a/net/8021q/vlan_dev.c
2863 ++++ b/net/8021q/vlan_dev.c
2864 +@@ -627,8 +627,6 @@ static void vlan_dev_uninit(struct net_device *dev)
2865 + struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
2866 + int i;
2867 +
2868 +- free_percpu(vlan->vlan_pcpu_stats);
2869 +- vlan->vlan_pcpu_stats = NULL;
2870 + for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
2871 + while ((pm = vlan->egress_priority_map[i]) != NULL) {
2872 + vlan->egress_priority_map[i] = pm->next;
2873 +@@ -787,6 +785,15 @@ static const struct net_device_ops vlan_netdev_ops = {
2874 + .ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
2875 + };
2876 +
2877 ++static void vlan_dev_free(struct net_device *dev)
2878 ++{
2879 ++ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
2880 ++
2881 ++ free_percpu(vlan->vlan_pcpu_stats);
2882 ++ vlan->vlan_pcpu_stats = NULL;
2883 ++ free_netdev(dev);
2884 ++}
2885 ++
2886 + void vlan_setup(struct net_device *dev)
2887 + {
2888 + ether_setup(dev);
2889 +@@ -796,7 +803,7 @@ void vlan_setup(struct net_device *dev)
2890 + dev->tx_queue_len = 0;
2891 +
2892 + dev->netdev_ops = &vlan_netdev_ops;
2893 +- dev->destructor = free_netdev;
2894 ++ dev->destructor = vlan_dev_free;
2895 + dev->ethtool_ops = &vlan_ethtool_ops;
2896 +
2897 + memset(dev->broadcast, 0, ETH_ALEN);
2898 +diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
2899 +index 786ee2f83d5f..82f6e63e1a4a 100644
2900 +--- a/net/appletalk/ddp.c
2901 ++++ b/net/appletalk/ddp.c
2902 +@@ -1489,8 +1489,6 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
2903 + goto drop;
2904 +
2905 + /* Queue packet (standard) */
2906 +- skb->sk = sock;
2907 +-
2908 + if (sock_queue_rcv_skb(sock, skb) < 0)
2909 + goto drop;
2910 +
2911 +@@ -1644,7 +1642,6 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
2912 + if (!skb)
2913 + goto out;
2914 +
2915 +- skb->sk = sk;
2916 + skb_reserve(skb, ddp_dl->header_length);
2917 + skb_reserve(skb, dev->hard_header_len);
2918 + skb->dev = dev;
2919 +diff --git a/net/core/dev.c b/net/core/dev.c
2920 +index a30bef1882f5..a7621f3ff505 100644
2921 +--- a/net/core/dev.c
2922 ++++ b/net/core/dev.c
2923 +@@ -148,6 +148,9 @@ struct list_head ptype_all __read_mostly; /* Taps */
2924 + static struct list_head offload_base __read_mostly;
2925 +
2926 + static int netif_rx_internal(struct sk_buff *skb);
2927 ++static int call_netdevice_notifiers_info(unsigned long val,
2928 ++ struct net_device *dev,
2929 ++ struct netdev_notifier_info *info);
2930 +
2931 + /*
2932 + * The @dev_base_head list is protected by @dev_base_lock and the rtnl
2933 +@@ -1207,7 +1210,11 @@ EXPORT_SYMBOL(netdev_features_change);
2934 + void netdev_state_change(struct net_device *dev)
2935 + {
2936 + if (dev->flags & IFF_UP) {
2937 +- call_netdevice_notifiers(NETDEV_CHANGE, dev);
2938 ++ struct netdev_notifier_change_info change_info;
2939 ++
2940 ++ change_info.flags_changed = 0;
2941 ++ call_netdevice_notifiers_info(NETDEV_CHANGE, dev,
2942 ++ &change_info.info);
2943 + rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
2944 + }
2945 + }
2946 +@@ -4057,6 +4064,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
2947 + skb->vlan_tci = 0;
2948 + skb->dev = napi->dev;
2949 + skb->skb_iif = 0;
2950 ++ skb->encapsulation = 0;
2951 ++ skb_shinfo(skb)->gso_type = 0;
2952 + skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
2953 +
2954 + napi->skb = skb;
2955 +diff --git a/net/core/dst.c b/net/core/dst.c
2956 +index 80d6286c8b62..a028409ee438 100644
2957 +--- a/net/core/dst.c
2958 ++++ b/net/core/dst.c
2959 +@@ -269,6 +269,15 @@ again:
2960 + }
2961 + EXPORT_SYMBOL(dst_destroy);
2962 +
2963 ++static void dst_destroy_rcu(struct rcu_head *head)
2964 ++{
2965 ++ struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head);
2966 ++
2967 ++ dst = dst_destroy(dst);
2968 ++ if (dst)
2969 ++ __dst_free(dst);
2970 ++}
2971 ++
2972 + void dst_release(struct dst_entry *dst)
2973 + {
2974 + if (dst) {
2975 +@@ -276,11 +285,8 @@ void dst_release(struct dst_entry *dst)
2976 +
2977 + newrefcnt = atomic_dec_return(&dst->__refcnt);
2978 + WARN_ON(newrefcnt < 0);
2979 +- if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) {
2980 +- dst = dst_destroy(dst);
2981 +- if (dst)
2982 +- __dst_free(dst);
2983 +- }
2984 ++ if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
2985 ++ call_rcu(&dst->rcu_head, dst_destroy_rcu);
2986 + }
2987 + }
2988 + EXPORT_SYMBOL(dst_release);
2989 +diff --git a/net/core/filter.c b/net/core/filter.c
2990 +index 4aec7b93f1a9..5310d5e0884f 100644
2991 +--- a/net/core/filter.c
2992 ++++ b/net/core/filter.c
2993 +@@ -872,7 +872,7 @@ int sk_convert_filter(struct sock_filter *prog, int len,
2994 + BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK);
2995 + BUILD_BUG_ON(FP_REG + 1 != MAX_BPF_REG);
2996 +
2997 +- if (len <= 0 || len >= BPF_MAXINSNS)
2998 ++ if (len <= 0 || len > BPF_MAXINSNS)
2999 + return -EINVAL;
3000 +
3001 + if (new_prog) {
3002 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
3003 +index 8383b2bddeb9..9433047b2453 100644
3004 +--- a/net/core/skbuff.c
3005 ++++ b/net/core/skbuff.c
3006 +@@ -2881,12 +2881,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
3007 + int pos;
3008 + int dummy;
3009 +
3010 ++ __skb_push(head_skb, doffset);
3011 + proto = skb_network_protocol(head_skb, &dummy);
3012 + if (unlikely(!proto))
3013 + return ERR_PTR(-EINVAL);
3014 +
3015 + csum = !!can_checksum_protocol(features, proto);
3016 +- __skb_push(head_skb, doffset);
3017 ++
3018 + headroom = skb_headroom(head_skb);
3019 + pos = skb_headlen(head_skb);
3020 +
3021 +diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
3022 +index e7b6d53eef88..f005cc760535 100644
3023 +--- a/net/dns_resolver/dns_query.c
3024 ++++ b/net/dns_resolver/dns_query.c
3025 +@@ -149,7 +149,9 @@ int dns_query(const char *type, const char *name, size_t namelen,
3026 + if (!*_result)
3027 + goto put;
3028 +
3029 +- memcpy(*_result, upayload->data, len + 1);
3030 ++ memcpy(*_result, upayload->data, len);
3031 ++ (*_result)[len] = '\0';
3032 ++
3033 + if (_expiry)
3034 + *_expiry = rkey->expiry;
3035 +
3036 +diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
3037 +index 6d6dd345bc4d..6af8ab6e1706 100644
3038 +--- a/net/ipv4/af_inet.c
3039 ++++ b/net/ipv4/af_inet.c
3040 +@@ -1434,6 +1434,9 @@ static int inet_gro_complete(struct sk_buff *skb, int nhoff)
3041 + int proto = iph->protocol;
3042 + int err = -ENOSYS;
3043 +
3044 ++ if (skb->encapsulation)
3045 ++ skb_set_inner_network_header(skb, nhoff);
3046 ++
3047 + csum_replace2(&iph->check, iph->tot_len, newlen);
3048 + iph->tot_len = newlen;
3049 +
3050 +diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
3051 +index f1d32280cb54..2d24f293f977 100644
3052 +--- a/net/ipv4/gre_offload.c
3053 ++++ b/net/ipv4/gre_offload.c
3054 +@@ -255,6 +255,9 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff)
3055 + int err = -ENOENT;
3056 + __be16 type;
3057 +
3058 ++ skb->encapsulation = 1;
3059 ++ skb_shinfo(skb)->gso_type = SKB_GSO_GRE;
3060 ++
3061 + type = greh->protocol;
3062 + if (greh->flags & GRE_KEY)
3063 + grehlen += GRE_HEADER_SECTION;
3064 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
3065 +index 0134663fdbce..1e4aa8354f93 100644
3066 +--- a/net/ipv4/icmp.c
3067 ++++ b/net/ipv4/icmp.c
3068 +@@ -732,8 +732,6 @@ static void icmp_unreach(struct sk_buff *skb)
3069 + /* fall through */
3070 + case 0:
3071 + info = ntohs(icmph->un.frag.mtu);
3072 +- if (!info)
3073 +- goto out;
3074 + }
3075 + break;
3076 + case ICMP_SR_FAILED:
3077 +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
3078 +index 97e4d1655d26..9db3b877fcaf 100644
3079 +--- a/net/ipv4/igmp.c
3080 ++++ b/net/ipv4/igmp.c
3081 +@@ -1952,6 +1952,10 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
3082 +
3083 + rtnl_lock();
3084 + in_dev = ip_mc_find_dev(net, imr);
3085 ++ if (!in_dev) {
3086 ++ ret = -ENODEV;
3087 ++ goto out;
3088 ++ }
3089 + ifindex = imr->imr_ifindex;
3090 + for (imlp = &inet->mc_list;
3091 + (iml = rtnl_dereference(*imlp)) != NULL;
3092 +@@ -1969,16 +1973,14 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
3093 +
3094 + *imlp = iml->next_rcu;
3095 +
3096 +- if (in_dev)
3097 +- ip_mc_dec_group(in_dev, group);
3098 ++ ip_mc_dec_group(in_dev, group);
3099 + rtnl_unlock();
3100 + /* decrease mem now to avoid the memleak warning */
3101 + atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
3102 + kfree_rcu(iml, rcu);
3103 + return 0;
3104 + }
3105 +- if (!in_dev)
3106 +- ret = -ENODEV;
3107 ++out:
3108 + rtnl_unlock();
3109 + return ret;
3110 + }
3111 +diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
3112 +index f4ab72e19af9..96f90b89df32 100644
3113 +--- a/net/ipv4/ip_options.c
3114 ++++ b/net/ipv4/ip_options.c
3115 +@@ -288,6 +288,10 @@ int ip_options_compile(struct net *net,
3116 + optptr++;
3117 + continue;
3118 + }
3119 ++ if (unlikely(l < 2)) {
3120 ++ pp_ptr = optptr;
3121 ++ goto error;
3122 ++ }
3123 + optlen = optptr[1];
3124 + if (optlen < 2 || optlen > l) {
3125 + pp_ptr = optptr;
3126 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
3127 +index 2acc2337d38b..b77b6a55b05e 100644
3128 +--- a/net/ipv4/ip_tunnel.c
3129 ++++ b/net/ipv4/ip_tunnel.c
3130 +@@ -73,12 +73,7 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst,
3131 + {
3132 + struct dst_entry *old_dst;
3133 +
3134 +- if (dst) {
3135 +- if (dst->flags & DST_NOCACHE)
3136 +- dst = NULL;
3137 +- else
3138 +- dst_clone(dst);
3139 +- }
3140 ++ dst_clone(dst);
3141 + old_dst = xchg((__force struct dst_entry **)&idst->dst, dst);
3142 + dst_release(old_dst);
3143 + }
3144 +@@ -108,13 +103,14 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie)
3145 +
3146 + rcu_read_lock();
3147 + dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst);
3148 ++ if (dst && !atomic_inc_not_zero(&dst->__refcnt))
3149 ++ dst = NULL;
3150 + if (dst) {
3151 + if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
3152 +- rcu_read_unlock();
3153 + tunnel_dst_reset(t);
3154 +- return NULL;
3155 ++ dst_release(dst);
3156 ++ dst = NULL;
3157 + }
3158 +- dst_hold(dst);
3159 + }
3160 + rcu_read_unlock();
3161 + return (struct rtable *)dst;
3162 +@@ -173,6 +169,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
3163 +
3164 + hlist_for_each_entry_rcu(t, head, hash_node) {
3165 + if (remote != t->parms.iph.daddr ||
3166 ++ t->parms.iph.saddr != 0 ||
3167 + !(t->dev->flags & IFF_UP))
3168 + continue;
3169 +
3170 +@@ -189,10 +186,11 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
3171 + head = &itn->tunnels[hash];
3172 +
3173 + hlist_for_each_entry_rcu(t, head, hash_node) {
3174 +- if ((local != t->parms.iph.saddr &&
3175 +- (local != t->parms.iph.daddr ||
3176 +- !ipv4_is_multicast(local))) ||
3177 +- !(t->dev->flags & IFF_UP))
3178 ++ if ((local != t->parms.iph.saddr || t->parms.iph.daddr != 0) &&
3179 ++ (local != t->parms.iph.daddr || !ipv4_is_multicast(local)))
3180 ++ continue;
3181 ++
3182 ++ if (!(t->dev->flags & IFF_UP))
3183 + continue;
3184 +
3185 + if (!ip_tunnel_key_match(&t->parms, flags, key))
3186 +@@ -209,6 +207,8 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
3187 +
3188 + hlist_for_each_entry_rcu(t, head, hash_node) {
3189 + if (t->parms.i_key != key ||
3190 ++ t->parms.iph.saddr != 0 ||
3191 ++ t->parms.iph.daddr != 0 ||
3192 + !(t->dev->flags & IFF_UP))
3193 + continue;
3194 +
3195 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
3196 +index 5e676be3daeb..be9f2b1ac3ab 100644
3197 +--- a/net/ipv4/route.c
3198 ++++ b/net/ipv4/route.c
3199 +@@ -1022,7 +1022,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
3200 + const struct iphdr *iph = (const struct iphdr *) skb->data;
3201 + struct flowi4 fl4;
3202 + struct rtable *rt;
3203 +- struct dst_entry *dst;
3204 ++ struct dst_entry *odst = NULL;
3205 + bool new = false;
3206 +
3207 + bh_lock_sock(sk);
3208 +@@ -1030,16 +1030,17 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
3209 + if (!ip_sk_accept_pmtu(sk))
3210 + goto out;
3211 +
3212 +- rt = (struct rtable *) __sk_dst_get(sk);
3213 ++ odst = sk_dst_get(sk);
3214 +
3215 +- if (sock_owned_by_user(sk) || !rt) {
3216 ++ if (sock_owned_by_user(sk) || !odst) {
3217 + __ipv4_sk_update_pmtu(skb, sk, mtu);
3218 + goto out;
3219 + }
3220 +
3221 + __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
3222 +
3223 +- if (!__sk_dst_check(sk, 0)) {
3224 ++ rt = (struct rtable *)odst;
3225 ++ if (odst->obsolete && odst->ops->check(odst, 0) == NULL) {
3226 + rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
3227 + if (IS_ERR(rt))
3228 + goto out;
3229 +@@ -1049,8 +1050,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
3230 +
3231 + __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu);
3232 +
3233 +- dst = dst_check(&rt->dst, 0);
3234 +- if (!dst) {
3235 ++ if (!dst_check(&rt->dst, 0)) {
3236 + if (new)
3237 + dst_release(&rt->dst);
3238 +
3239 +@@ -1062,10 +1062,11 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
3240 + }
3241 +
3242 + if (new)
3243 +- __sk_dst_set(sk, &rt->dst);
3244 ++ sk_dst_set(sk, &rt->dst);
3245 +
3246 + out:
3247 + bh_unlock_sock(sk);
3248 ++ dst_release(odst);
3249 + }
3250 + EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu);
3251 +
3252 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
3253 +index 4bd6d52eeffb..599e53e760e3 100644
3254 +--- a/net/ipv4/tcp.c
3255 ++++ b/net/ipv4/tcp.c
3256 +@@ -1108,7 +1108,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
3257 + if (unlikely(tp->repair)) {
3258 + if (tp->repair_queue == TCP_RECV_QUEUE) {
3259 + copied = tcp_send_rcvq(sk, msg, size);
3260 +- goto out;
3261 ++ goto out_nopush;
3262 + }
3263 +
3264 + err = -EINVAL;
3265 +@@ -1282,6 +1282,7 @@ wait_for_memory:
3266 + out:
3267 + if (copied)
3268 + tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
3269 ++out_nopush:
3270 + release_sock(sk);
3271 + return copied + copied_syn;
3272 +
3273 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
3274 +index 3a26b3b23f16..09b85cdda165 100644
3275 +--- a/net/ipv4/tcp_input.c
3276 ++++ b/net/ipv4/tcp_input.c
3277 +@@ -1106,7 +1106,7 @@ static bool tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb,
3278 + }
3279 +
3280 + /* D-SACK for already forgotten data... Do dumb counting. */
3281 +- if (dup_sack && tp->undo_marker && tp->undo_retrans &&
3282 ++ if (dup_sack && tp->undo_marker && tp->undo_retrans > 0 &&
3283 + !after(end_seq_0, prior_snd_una) &&
3284 + after(end_seq_0, tp->undo_marker))
3285 + tp->undo_retrans--;
3286 +@@ -1162,7 +1162,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb,
3287 + unsigned int new_len = (pkt_len / mss) * mss;
3288 + if (!in_sack && new_len < pkt_len) {
3289 + new_len += mss;
3290 +- if (new_len > skb->len)
3291 ++ if (new_len >= skb->len)
3292 + return 0;
3293 + }
3294 + pkt_len = new_len;
3295 +@@ -1187,7 +1187,7 @@ static u8 tcp_sacktag_one(struct sock *sk,
3296 +
3297 + /* Account D-SACK for retransmitted packet. */
3298 + if (dup_sack && (sacked & TCPCB_RETRANS)) {
3299 +- if (tp->undo_marker && tp->undo_retrans &&
3300 ++ if (tp->undo_marker && tp->undo_retrans > 0 &&
3301 + after(end_seq, tp->undo_marker))
3302 + tp->undo_retrans--;
3303 + if (sacked & TCPCB_SACKED_ACKED)
3304 +@@ -1893,7 +1893,7 @@ static void tcp_clear_retrans_partial(struct tcp_sock *tp)
3305 + tp->lost_out = 0;
3306 +
3307 + tp->undo_marker = 0;
3308 +- tp->undo_retrans = 0;
3309 ++ tp->undo_retrans = -1;
3310 + }
3311 +
3312 + void tcp_clear_retrans(struct tcp_sock *tp)
3313 +@@ -2664,7 +2664,7 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)
3314 +
3315 + tp->prior_ssthresh = 0;
3316 + tp->undo_marker = tp->snd_una;
3317 +- tp->undo_retrans = tp->retrans_out;
3318 ++ tp->undo_retrans = tp->retrans_out ? : -1;
3319 +
3320 + if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
3321 + if (!ece_ack)
3322 +diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
3323 +index b92b81718ca4..c25953a386d0 100644
3324 +--- a/net/ipv4/tcp_offload.c
3325 ++++ b/net/ipv4/tcp_offload.c
3326 +@@ -310,7 +310,7 @@ static int tcp4_gro_complete(struct sk_buff *skb, int thoff)
3327 +
3328 + th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr,
3329 + iph->daddr, 0);
3330 +- skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
3331 ++ skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
3332 +
3333 + return tcp_gro_complete(skb);
3334 + }
3335 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
3336 +index 12d6016bdd9a..589b5ac1339e 100644
3337 +--- a/net/ipv4/tcp_output.c
3338 ++++ b/net/ipv4/tcp_output.c
3339 +@@ -2472,8 +2472,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
3340 + if (!tp->retrans_stamp)
3341 + tp->retrans_stamp = TCP_SKB_CB(skb)->when;
3342 +
3343 +- tp->undo_retrans += tcp_skb_pcount(skb);
3344 +-
3345 + /* snd_nxt is stored to detect loss of retransmitted segment,
3346 + * see tcp_input.c tcp_sacktag_write_queue().
3347 + */
3348 +@@ -2481,6 +2479,10 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
3349 + } else {
3350 + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);
3351 + }
3352 ++
3353 ++ if (tp->undo_retrans < 0)
3354 ++ tp->undo_retrans = 0;
3355 ++ tp->undo_retrans += tcp_skb_pcount(skb);
3356 + return err;
3357 + }
3358 +
3359 +diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c
3360 +index 8517d3cd1aed..01b0ff9a0c2c 100644
3361 +--- a/net/ipv6/tcpv6_offload.c
3362 ++++ b/net/ipv6/tcpv6_offload.c
3363 +@@ -73,7 +73,7 @@ static int tcp6_gro_complete(struct sk_buff *skb, int thoff)
3364 +
3365 + th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr,
3366 + &iph->daddr, 0);
3367 +- skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
3368 ++ skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6;
3369 +
3370 + return tcp_gro_complete(skb);
3371 + }
3372 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
3373 +index f22757a29cd0..6c0fe9766094 100644
3374 +--- a/net/netlink/af_netlink.c
3375 ++++ b/net/netlink/af_netlink.c
3376 +@@ -636,7 +636,7 @@ static unsigned int netlink_poll(struct file *file, struct socket *sock,
3377 + while (nlk->cb_running && netlink_dump_space(nlk)) {
3378 + err = netlink_dump(sk);
3379 + if (err < 0) {
3380 +- sk->sk_err = err;
3381 ++ sk->sk_err = -err;
3382 + sk->sk_error_report(sk);
3383 + break;
3384 + }
3385 +@@ -2453,7 +2453,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
3386 + atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
3387 + ret = netlink_dump(sk);
3388 + if (ret) {
3389 +- sk->sk_err = ret;
3390 ++ sk->sk_err = -ret;
3391 + sk->sk_error_report(sk);
3392 + }
3393 + }
3394 +diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
3395 +index c82fdc1eab7c..dfa532f00d88 100644
3396 +--- a/net/sctp/sysctl.c
3397 ++++ b/net/sctp/sysctl.c
3398 +@@ -307,41 +307,40 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
3399 + loff_t *ppos)
3400 + {
3401 + struct net *net = current->nsproxy->net_ns;
3402 +- char tmp[8];
3403 + struct ctl_table tbl;
3404 +- int ret;
3405 +- int changed = 0;
3406 ++ bool changed = false;
3407 + char *none = "none";
3408 ++ char tmp[8];
3409 ++ int ret;
3410 +
3411 + memset(&tbl, 0, sizeof(struct ctl_table));
3412 +
3413 + if (write) {
3414 + tbl.data = tmp;
3415 +- tbl.maxlen = 8;
3416 ++ tbl.maxlen = sizeof(tmp);
3417 + } else {
3418 + tbl.data = net->sctp.sctp_hmac_alg ? : none;
3419 + tbl.maxlen = strlen(tbl.data);
3420 + }
3421 +- ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
3422 +
3423 +- if (write) {
3424 ++ ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
3425 ++ if (write && ret == 0) {
3426 + #ifdef CONFIG_CRYPTO_MD5
3427 + if (!strncmp(tmp, "md5", 3)) {
3428 + net->sctp.sctp_hmac_alg = "md5";
3429 +- changed = 1;
3430 ++ changed = true;
3431 + }
3432 + #endif
3433 + #ifdef CONFIG_CRYPTO_SHA1
3434 + if (!strncmp(tmp, "sha1", 4)) {
3435 + net->sctp.sctp_hmac_alg = "sha1";
3436 +- changed = 1;
3437 ++ changed = true;
3438 + }
3439 + #endif
3440 + if (!strncmp(tmp, "none", 4)) {
3441 + net->sctp.sctp_hmac_alg = NULL;
3442 +- changed = 1;
3443 ++ changed = true;
3444 + }
3445 +-
3446 + if (!changed)
3447 + ret = -EINVAL;
3448 + }
3449 +@@ -354,11 +353,10 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
3450 + loff_t *ppos)
3451 + {
3452 + struct net *net = current->nsproxy->net_ns;
3453 +- int new_value;
3454 +- struct ctl_table tbl;
3455 + unsigned int min = *(unsigned int *) ctl->extra1;
3456 + unsigned int max = *(unsigned int *) ctl->extra2;
3457 +- int ret;
3458 ++ struct ctl_table tbl;
3459 ++ int ret, new_value;
3460 +
3461 + memset(&tbl, 0, sizeof(struct ctl_table));
3462 + tbl.maxlen = sizeof(unsigned int);
3463 +@@ -367,12 +365,15 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
3464 + tbl.data = &new_value;
3465 + else
3466 + tbl.data = &net->sctp.rto_min;
3467 ++
3468 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
3469 +- if (write) {
3470 +- if (ret || new_value > max || new_value < min)
3471 ++ if (write && ret == 0) {
3472 ++ if (new_value > max || new_value < min)
3473 + return -EINVAL;
3474 ++
3475 + net->sctp.rto_min = new_value;
3476 + }
3477 ++
3478 + return ret;
3479 + }
3480 +
3481 +@@ -381,11 +382,10 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
3482 + loff_t *ppos)
3483 + {
3484 + struct net *net = current->nsproxy->net_ns;
3485 +- int new_value;
3486 +- struct ctl_table tbl;
3487 + unsigned int min = *(unsigned int *) ctl->extra1;
3488 + unsigned int max = *(unsigned int *) ctl->extra2;
3489 +- int ret;
3490 ++ struct ctl_table tbl;
3491 ++ int ret, new_value;
3492 +
3493 + memset(&tbl, 0, sizeof(struct ctl_table));
3494 + tbl.maxlen = sizeof(unsigned int);
3495 +@@ -394,12 +394,15 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
3496 + tbl.data = &new_value;
3497 + else
3498 + tbl.data = &net->sctp.rto_max;
3499 ++
3500 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
3501 +- if (write) {
3502 +- if (ret || new_value > max || new_value < min)
3503 ++ if (write && ret == 0) {
3504 ++ if (new_value > max || new_value < min)
3505 + return -EINVAL;
3506 ++
3507 + net->sctp.rto_max = new_value;
3508 + }
3509 ++
3510 + return ret;
3511 + }
3512 +
3513 +@@ -420,8 +423,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
3514 + tbl.data = &net->sctp.auth_enable;
3515 +
3516 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
3517 +-
3518 +- if (write) {
3519 ++ if (write && ret == 0) {
3520 + struct sock *sk = net->sctp.ctl_sock;
3521 +
3522 + net->sctp.auth_enable = new_value;
3523 +diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
3524 +index 85c64658bd0b..b6842fdb53d4 100644
3525 +--- a/net/sctp/ulpevent.c
3526 ++++ b/net/sctp/ulpevent.c
3527 +@@ -366,9 +366,10 @@ fail:
3528 + * specification [SCTP] and any extensions for a list of possible
3529 + * error formats.
3530 + */
3531 +-struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
3532 +- const struct sctp_association *asoc, struct sctp_chunk *chunk,
3533 +- __u16 flags, gfp_t gfp)
3534 ++struct sctp_ulpevent *
3535 ++sctp_ulpevent_make_remote_error(const struct sctp_association *asoc,
3536 ++ struct sctp_chunk *chunk, __u16 flags,
3537 ++ gfp_t gfp)
3538 + {
3539 + struct sctp_ulpevent *event;
3540 + struct sctp_remote_error *sre;
3541 +@@ -387,8 +388,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
3542 + /* Copy the skb to a new skb with room for us to prepend
3543 + * notification with.
3544 + */
3545 +- skb = skb_copy_expand(chunk->skb, sizeof(struct sctp_remote_error),
3546 +- 0, gfp);
3547 ++ skb = skb_copy_expand(chunk->skb, sizeof(*sre), 0, gfp);
3548 +
3549 + /* Pull off the rest of the cause TLV from the chunk. */
3550 + skb_pull(chunk->skb, elen);
3551 +@@ -399,62 +399,21 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
3552 + event = sctp_skb2event(skb);
3553 + sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
3554 +
3555 +- sre = (struct sctp_remote_error *)
3556 +- skb_push(skb, sizeof(struct sctp_remote_error));
3557 ++ sre = (struct sctp_remote_error *) skb_push(skb, sizeof(*sre));
3558 +
3559 + /* Trim the buffer to the right length. */
3560 +- skb_trim(skb, sizeof(struct sctp_remote_error) + elen);
3561 ++ skb_trim(skb, sizeof(*sre) + elen);
3562 +
3563 +- /* Socket Extensions for SCTP
3564 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3565 +- *
3566 +- * sre_type:
3567 +- * It should be SCTP_REMOTE_ERROR.
3568 +- */
3569 ++ /* RFC6458, Section 6.1.3. SCTP_REMOTE_ERROR */
3570 ++ memset(sre, 0, sizeof(*sre));
3571 + sre->sre_type = SCTP_REMOTE_ERROR;
3572 +-
3573 +- /*
3574 +- * Socket Extensions for SCTP
3575 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3576 +- *
3577 +- * sre_flags: 16 bits (unsigned integer)
3578 +- * Currently unused.
3579 +- */
3580 + sre->sre_flags = 0;
3581 +-
3582 +- /* Socket Extensions for SCTP
3583 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3584 +- *
3585 +- * sre_length: sizeof (__u32)
3586 +- *
3587 +- * This field is the total length of the notification data,
3588 +- * including the notification header.
3589 +- */
3590 + sre->sre_length = skb->len;
3591 +-
3592 +- /* Socket Extensions for SCTP
3593 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3594 +- *
3595 +- * sre_error: 16 bits (unsigned integer)
3596 +- * This value represents one of the Operational Error causes defined in
3597 +- * the SCTP specification, in network byte order.
3598 +- */
3599 + sre->sre_error = cause;
3600 +-
3601 +- /* Socket Extensions for SCTP
3602 +- * 5.3.1.3 SCTP_REMOTE_ERROR
3603 +- *
3604 +- * sre_assoc_id: sizeof (sctp_assoc_t)
3605 +- *
3606 +- * The association id field, holds the identifier for the association.
3607 +- * All notifications for a given association have the same association
3608 +- * identifier. For TCP style socket, this field is ignored.
3609 +- */
3610 + sctp_ulpevent_set_owner(event, asoc);
3611 + sre->sre_assoc_id = sctp_assoc2id(asoc);
3612 +
3613 + return event;
3614 +-
3615 + fail:
3616 + return NULL;
3617 + }
3618 +@@ -899,7 +858,9 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
3619 + return notification->sn_header.sn_type;
3620 + }
3621 +
3622 +-/* Copy out the sndrcvinfo into a msghdr. */
3623 ++/* RFC6458, Section 5.3.2. SCTP Header Information Structure
3624 ++ * (SCTP_SNDRCV, DEPRECATED)
3625 ++ */
3626 + void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
3627 + struct msghdr *msghdr)
3628 + {
3629 +@@ -908,74 +869,21 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
3630 + if (sctp_ulpevent_is_notification(event))
3631 + return;
3632 +
3633 +- /* Sockets API Extensions for SCTP
3634 +- * Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
3635 +- *
3636 +- * sinfo_stream: 16 bits (unsigned integer)
3637 +- *
3638 +- * For recvmsg() the SCTP stack places the message's stream number in
3639 +- * this value.
3640 +- */
3641 ++ memset(&sinfo, 0, sizeof(sinfo));
3642 + sinfo.sinfo_stream = event->stream;
3643 +- /* sinfo_ssn: 16 bits (unsigned integer)
3644 +- *
3645 +- * For recvmsg() this value contains the stream sequence number that
3646 +- * the remote endpoint placed in the DATA chunk. For fragmented
3647 +- * messages this is the same number for all deliveries of the message
3648 +- * (if more than one recvmsg() is needed to read the message).
3649 +- */
3650 + sinfo.sinfo_ssn = event->ssn;
3651 +- /* sinfo_ppid: 32 bits (unsigned integer)
3652 +- *
3653 +- * In recvmsg() this value is
3654 +- * the same information that was passed by the upper layer in the peer
3655 +- * application. Please note that byte order issues are NOT accounted
3656 +- * for and this information is passed opaquely by the SCTP stack from
3657 +- * one end to the other.
3658 +- */
3659 + sinfo.sinfo_ppid = event->ppid;
3660 +- /* sinfo_flags: 16 bits (unsigned integer)
3661 +- *
3662 +- * This field may contain any of the following flags and is composed of
3663 +- * a bitwise OR of these values.
3664 +- *
3665 +- * recvmsg() flags:
3666 +- *
3667 +- * SCTP_UNORDERED - This flag is present when the message was sent
3668 +- * non-ordered.
3669 +- */
3670 + sinfo.sinfo_flags = event->flags;
3671 +- /* sinfo_tsn: 32 bit (unsigned integer)
3672 +- *
3673 +- * For the receiving side, this field holds a TSN that was
3674 +- * assigned to one of the SCTP Data Chunks.
3675 +- */
3676 + sinfo.sinfo_tsn = event->tsn;
3677 +- /* sinfo_cumtsn: 32 bit (unsigned integer)
3678 +- *
3679 +- * This field will hold the current cumulative TSN as
3680 +- * known by the underlying SCTP layer. Note this field is
3681 +- * ignored when sending and only valid for a receive
3682 +- * operation when sinfo_flags are set to SCTP_UNORDERED.
3683 +- */
3684 + sinfo.sinfo_cumtsn = event->cumtsn;
3685 +- /* sinfo_assoc_id: sizeof (sctp_assoc_t)
3686 +- *
3687 +- * The association handle field, sinfo_assoc_id, holds the identifier
3688 +- * for the association announced in the COMMUNICATION_UP notification.
3689 +- * All notifications for a given association have the same identifier.
3690 +- * Ignored for one-to-one style sockets.
3691 +- */
3692 + sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc);
3693 +-
3694 +- /* context value that is set via SCTP_CONTEXT socket option. */
3695 ++ /* Context value that is set via SCTP_CONTEXT socket option. */
3696 + sinfo.sinfo_context = event->asoc->default_rcv_context;
3697 +-
3698 + /* These fields are not used while receiving. */
3699 + sinfo.sinfo_timetolive = 0;
3700 +
3701 + put_cmsg(msghdr, IPPROTO_SCTP, SCTP_SNDRCV,
3702 +- sizeof(struct sctp_sndrcvinfo), (void *)&sinfo);
3703 ++ sizeof(sinfo), &sinfo);
3704 + }
3705 +
3706 + /* Do accounting for bytes received and hold a reference to the association
3707 +diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
3708 +index 95ab5ef92920..958279c8e7d7 100644
3709 +--- a/net/tipc/bcast.c
3710 ++++ b/net/tipc/bcast.c
3711 +@@ -536,6 +536,7 @@ receive:
3712 +
3713 + buf = node->bclink.deferred_head;
3714 + node->bclink.deferred_head = buf->next;
3715 ++ buf->next = NULL;
3716 + node->bclink.deferred_size--;
3717 + goto receive;
3718 + }
3719 +diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
3720 +index 480bbddbd801..6df04d91c93c 100644
3721 +--- a/sound/pci/hda/hda_controller.c
3722 ++++ b/sound/pci/hda/hda_controller.c
3723 +@@ -193,7 +193,8 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
3724 + dsp_unlock(azx_dev);
3725 + return azx_dev;
3726 + }
3727 +- if (!res)
3728 ++ if (!res ||
3729 ++ (chip->driver_caps & AZX_DCAPS_REVERSE_ASSIGN))
3730 + res = azx_dev;
3731 + }
3732 + dsp_unlock(azx_dev);
3733 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3734 +index bc36f9cdd9d2..893beca9d45f 100644
3735 +--- a/sound/pci/hda/hda_intel.c
3736 ++++ b/sound/pci/hda/hda_intel.c
3737 +@@ -227,7 +227,7 @@ enum {
3738 + /* quirks for Intel PCH */
3739 + #define AZX_DCAPS_INTEL_PCH_NOPM \
3740 + (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \
3741 +- AZX_DCAPS_COUNT_LPIB_DELAY)
3742 ++ AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_REVERSE_ASSIGN)
3743 +
3744 + #define AZX_DCAPS_INTEL_PCH \
3745 + (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME)
3746 +@@ -590,7 +590,7 @@ static int azx_suspend(struct device *dev)
3747 + struct azx *chip = card->private_data;
3748 + struct azx_pcm *p;
3749 +
3750 +- if (chip->disabled)
3751 ++ if (chip->disabled || chip->init_failed)
3752 + return 0;
3753 +
3754 + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
3755 +@@ -622,7 +622,7 @@ static int azx_resume(struct device *dev)
3756 + struct snd_card *card = dev_get_drvdata(dev);
3757 + struct azx *chip = card->private_data;
3758 +
3759 +- if (chip->disabled)
3760 ++ if (chip->disabled || chip->init_failed)
3761 + return 0;
3762 +
3763 + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
3764 +@@ -659,7 +659,7 @@ static int azx_runtime_suspend(struct device *dev)
3765 + struct snd_card *card = dev_get_drvdata(dev);
3766 + struct azx *chip = card->private_data;
3767 +
3768 +- if (chip->disabled)
3769 ++ if (chip->disabled || chip->init_failed)
3770 + return 0;
3771 +
3772 + if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
3773 +@@ -686,7 +686,7 @@ static int azx_runtime_resume(struct device *dev)
3774 + struct hda_codec *codec;
3775 + int status;
3776 +
3777 +- if (chip->disabled)
3778 ++ if (chip->disabled || chip->init_failed)
3779 + return 0;
3780 +
3781 + if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
3782 +@@ -723,7 +723,7 @@ static int azx_runtime_idle(struct device *dev)
3783 + struct snd_card *card = dev_get_drvdata(dev);
3784 + struct azx *chip = card->private_data;
3785 +
3786 +- if (chip->disabled)
3787 ++ if (chip->disabled || chip->init_failed)
3788 + return 0;
3789 +
3790 + if (!power_save_controller ||
3791 +diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h
3792 +index 4a7cb01fa912..e9d1a5762a55 100644
3793 +--- a/sound/pci/hda/hda_priv.h
3794 ++++ b/sound/pci/hda/hda_priv.h
3795 +@@ -186,6 +186,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
3796 + #define AZX_DCAPS_BUFSIZE (1 << 21) /* no buffer size alignment */
3797 + #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */
3798 + #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */
3799 ++#define AZX_DCAPS_REVERSE_ASSIGN (1 << 24) /* Assign devices in reverse order */
3800 + #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
3801 + #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
3802 + #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */