Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.14 commit in: /
Date: Mon, 28 Jul 2014 19:17:21
Message-Id: 1406575025.0a8452bd52ddbe1bdbbbb9180eec4d67f595d3d2.mpagano@gentoo
1 commit: 0a8452bd52ddbe1bdbbbb9180eec4d67f595d3d2
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 28 19:17:05 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 28 19:17:05 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=0a8452bd
7
8 Linux patch 3.14.14
9
10 ---
11 0000_README | 4 +
12 1013_linux-3.14.14.patch | 2814 ++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 2818 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index 4e6bfc3..d44b3d0 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -94,6 +94,10 @@ Patch: 1012_linux-3.14.13.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.14.13
22
23 +Patch: 1013_linux-3.14.14.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.14.14
26 +
27 Patch: 1500_XATTR_USER_PREFIX.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
29 Desc: Support for namespace user.pax.* on tmpfs.
30
31 diff --git a/1013_linux-3.14.14.patch b/1013_linux-3.14.14.patch
32 new file mode 100644
33 index 0000000..35b4ef6
34 --- /dev/null
35 +++ b/1013_linux-3.14.14.patch
36 @@ -0,0 +1,2814 @@
37 +diff --git a/Makefile b/Makefile
38 +index 7a2981c972ae..230c7f694ab7 100644
39 +--- a/Makefile
40 ++++ b/Makefile
41 +@@ -1,6 +1,6 @@
42 + VERSION = 3
43 + PATCHLEVEL = 14
44 +-SUBLEVEL = 13
45 ++SUBLEVEL = 14
46 + EXTRAVERSION =
47 + NAME = Remembering Coco
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 44298add8a48..4733d327cfb1 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 737ed5da8f71..de1611966d8b 100644
90 +--- a/arch/arm/boot/dts/imx25.dtsi
91 ++++ b/arch/arm/boot/dts/imx25.dtsi
92 +@@ -30,6 +30,7 @@
93 + spi2 = &spi3;
94 + usb0 = &usbotg;
95 + usb1 = &usbhost1;
96 ++ ethernet0 = &fec;
97 + };
98 +
99 + cpus {
100 +diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
101 +index 826231eb4446..da2eb7f6a5b2 100644
102 +--- a/arch/arm/boot/dts/imx27.dtsi
103 ++++ b/arch/arm/boot/dts/imx27.dtsi
104 +@@ -30,6 +30,7 @@
105 + spi0 = &cspi1;
106 + spi1 = &cspi2;
107 + spi2 = &cspi3;
108 ++ ethernet0 = &fec;
109 + };
110 +
111 + aitc: aitc-interrupt-controller@e0000000 {
112 +diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
113 +index 4bcdd3ad15e5..e1b601595a09 100644
114 +--- a/arch/arm/boot/dts/imx51.dtsi
115 ++++ b/arch/arm/boot/dts/imx51.dtsi
116 +@@ -27,6 +27,7 @@
117 + spi0 = &ecspi1;
118 + spi1 = &ecspi2;
119 + spi2 = &cspi;
120 ++ ethernet0 = &fec;
121 + };
122 +
123 + tzic: tz-interrupt-controller@e0000000 {
124 +diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
125 +index dc72353de0b3..50eda500f39a 100644
126 +--- a/arch/arm/boot/dts/imx53.dtsi
127 ++++ b/arch/arm/boot/dts/imx53.dtsi
128 +@@ -33,6 +33,7 @@
129 + spi0 = &ecspi1;
130 + spi1 = &ecspi2;
131 + spi2 = &cspi;
132 ++ ethernet0 = &fec;
133 + };
134 +
135 + cpus {
136 +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
137 +index 27bbcfc7202a..65b788410bd9 100644
138 +--- a/arch/arm64/Kconfig
139 ++++ b/arch/arm64/Kconfig
140 +@@ -2,6 +2,7 @@ config ARM64
141 + def_bool y
142 + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
143 + select ARCH_USE_CMPXCHG_LOCKREF
144 ++ select ARCH_SUPPORTS_ATOMIC_RMW
145 + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
146 + select ARCH_WANT_OPTIONAL_GPIOLIB
147 + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
148 +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
149 +index 2156fa2d25fe..ee3c6608126a 100644
150 +--- a/arch/powerpc/Kconfig
151 ++++ b/arch/powerpc/Kconfig
152 +@@ -141,6 +141,7 @@ config PPC
153 + select HAVE_DEBUG_STACKOVERFLOW
154 + select HAVE_IRQ_EXIT_ON_IRQ_STACK
155 + select ARCH_USE_CMPXCHG_LOCKREF if PPC64
156 ++ select ARCH_SUPPORTS_ATOMIC_RMW
157 +
158 + config GENERIC_CSUM
159 + def_bool CPU_LITTLE_ENDIAN
160 +diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
161 +index 7d8b7e94b93b..b398c68b2713 100644
162 +--- a/arch/sparc/Kconfig
163 ++++ b/arch/sparc/Kconfig
164 +@@ -77,6 +77,7 @@ config SPARC64
165 + select ARCH_HAVE_NMI_SAFE_CMPXCHG
166 + select HAVE_C_RECORDMCOUNT
167 + select NO_BOOTMEM
168 ++ select ARCH_SUPPORTS_ATOMIC_RMW
169 +
170 + config ARCH_DEFCONFIG
171 + string
172 +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
173 +index 1981dd9b8a11..7324107acb40 100644
174 +--- a/arch/x86/Kconfig
175 ++++ b/arch/x86/Kconfig
176 +@@ -127,6 +127,7 @@ config X86
177 + select HAVE_DEBUG_STACKOVERFLOW
178 + select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64
179 + select HAVE_CC_STACKPROTECTOR
180 ++ select ARCH_SUPPORTS_ATOMIC_RMW
181 +
182 + config INSTRUCTION_DECODER
183 + def_bool y
184 +diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
185 +index aa333d966886..1340ebfcb467 100644
186 +--- a/arch/x86/kernel/cpu/perf_event_intel.c
187 ++++ b/arch/x86/kernel/cpu/perf_event_intel.c
188 +@@ -1383,6 +1383,15 @@ again:
189 + intel_pmu_lbr_read();
190 +
191 + /*
192 ++ * CondChgd bit 63 doesn't mean any overflow status. Ignore
193 ++ * and clear the bit.
194 ++ */
195 ++ if (__test_and_clear_bit(63, (unsigned long *)&status)) {
196 ++ if (!status)
197 ++ goto done;
198 ++ }
199 ++
200 ++ /*
201 + * PEBS overflow sets bit 62 in the global status register
202 + */
203 + if (__test_and_clear_bit(62, (unsigned long *)&status)) {
204 +diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
205 +index cfbe99f88830..e0d1d7a8354e 100644
206 +--- a/arch/x86/kernel/tsc.c
207 ++++ b/arch/x86/kernel/tsc.c
208 +@@ -921,9 +921,9 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
209 + tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
210 + if (!(freq->flags & CPUFREQ_CONST_LOOPS))
211 + mark_tsc_unstable("cpufreq changes");
212 +- }
213 +
214 +- set_cyc2ns_scale(tsc_khz, freq->cpu);
215 ++ set_cyc2ns_scale(tsc_khz, freq->cpu);
216 ++ }
217 +
218 + return 0;
219 + }
220 +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
221 +index f6f497450560..e36a0245f2c1 100644
222 +--- a/drivers/bluetooth/hci_h5.c
223 ++++ b/drivers/bluetooth/hci_h5.c
224 +@@ -406,6 +406,7 @@ static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c)
225 + H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) {
226 + BT_ERR("Non-link packet received in non-active state");
227 + h5_reset_rx(h5);
228 ++ return 0;
229 + }
230 +
231 + h5->rx_func = h5_rx_payload;
232 +diff --git a/drivers/gpu/drm/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c
233 +index 28f84b4fce32..3485bdccf8b8 100644
234 +--- a/drivers/gpu/drm/qxl/qxl_irq.c
235 ++++ b/drivers/gpu/drm/qxl/qxl_irq.c
236 +@@ -33,6 +33,9 @@ irqreturn_t qxl_irq_handler(int irq, void *arg)
237 +
238 + pending = xchg(&qdev->ram_header->int_pending, 0);
239 +
240 ++ if (!pending)
241 ++ return IRQ_NONE;
242 ++
243 + atomic_inc(&qdev->irq_received);
244 +
245 + if (pending & QXL_INTERRUPT_DISPLAY) {
246 +diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
247 +index ccca8b224d18..e7bfd5502410 100644
248 +--- a/drivers/gpu/drm/radeon/atombios_encoders.c
249 ++++ b/drivers/gpu/drm/radeon/atombios_encoders.c
250 +@@ -183,7 +183,6 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
251 + struct backlight_properties props;
252 + struct radeon_backlight_privdata *pdata;
253 + struct radeon_encoder_atom_dig *dig;
254 +- u8 backlight_level;
255 + char bl_name[16];
256 +
257 + /* Mac laptops with multiple GPUs use the gmux driver for backlight
258 +@@ -222,12 +221,17 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
259 +
260 + pdata->encoder = radeon_encoder;
261 +
262 +- backlight_level = radeon_atom_get_backlight_level_from_reg(rdev);
263 +-
264 + dig = radeon_encoder->enc_priv;
265 + dig->bl_dev = bd;
266 +
267 + bd->props.brightness = radeon_atom_backlight_get_brightness(bd);
268 ++ /* Set a reasonable default here if the level is 0 otherwise
269 ++ * fbdev will attempt to turn the backlight on after console
270 ++ * unblanking and it will try and restore 0 which turns the backlight
271 ++ * off again.
272 ++ */
273 ++ if (bd->props.brightness == 0)
274 ++ bd->props.brightness = RADEON_MAX_BL_LEVEL;
275 + bd->props.power = FB_BLANK_UNBLANK;
276 + backlight_update_status(bd);
277 +
278 +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
279 +index df6d0079d0af..11d06c7b5afa 100644
280 +--- a/drivers/gpu/drm/radeon/radeon_display.c
281 ++++ b/drivers/gpu/drm/radeon/radeon_display.c
282 +@@ -755,6 +755,10 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
283 + struct radeon_device *rdev = dev->dev_private;
284 + int ret = 0;
285 +
286 ++ /* don't leak the edid if we already fetched it in detect() */
287 ++ if (radeon_connector->edid)
288 ++ goto got_edid;
289 ++
290 + /* on hw with routers, select right port */
291 + if (radeon_connector->router.ddc_valid)
292 + radeon_router_select_ddc_port(radeon_connector);
293 +@@ -794,6 +798,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
294 + radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev);
295 + }
296 + if (radeon_connector->edid) {
297 ++got_edid:
298 + drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid);
299 + ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid);
300 + drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid);
301 +diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
302 +index 09988b289622..816782a65488 100644
303 +--- a/drivers/hv/hv_kvp.c
304 ++++ b/drivers/hv/hv_kvp.c
305 +@@ -127,6 +127,15 @@ kvp_work_func(struct work_struct *dummy)
306 + kvp_respond_to_host(NULL, HV_E_FAIL);
307 + }
308 +
309 ++static void poll_channel(struct vmbus_channel *channel)
310 ++{
311 ++ unsigned long flags;
312 ++
313 ++ spin_lock_irqsave(&channel->inbound_lock, flags);
314 ++ hv_kvp_onchannelcallback(channel);
315 ++ spin_unlock_irqrestore(&channel->inbound_lock, flags);
316 ++}
317 ++
318 + static int kvp_handle_handshake(struct hv_kvp_msg *msg)
319 + {
320 + int ret = 1;
321 +@@ -155,7 +164,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg)
322 + kvp_register(dm_reg_value);
323 + kvp_transaction.active = false;
324 + if (kvp_transaction.kvp_context)
325 +- hv_kvp_onchannelcallback(kvp_transaction.kvp_context);
326 ++ poll_channel(kvp_transaction.kvp_context);
327 + }
328 + return ret;
329 + }
330 +@@ -568,6 +577,7 @@ response_done:
331 +
332 + vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,
333 + VM_PKT_DATA_INBAND, 0);
334 ++ poll_channel(channel);
335 +
336 + }
337 +
338 +@@ -603,7 +613,7 @@ void hv_kvp_onchannelcallback(void *context)
339 + return;
340 + }
341 +
342 +- vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
343 ++ vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen,
344 + &requestid);
345 +
346 + if (recvlen > 0) {
347 +diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
348 +index 62dfd246b948..d016be36cc03 100644
349 +--- a/drivers/hv/hv_util.c
350 ++++ b/drivers/hv/hv_util.c
351 +@@ -312,7 +312,7 @@ static int util_probe(struct hv_device *dev,
352 + (struct hv_util_service *)dev_id->driver_data;
353 + int ret;
354 +
355 +- srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL);
356 ++ srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL);
357 + if (!srv->recv_buffer)
358 + return -ENOMEM;
359 + if (srv->util_init) {
360 +diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
361 +index 0f4dea5ccf17..9ee3913850d6 100644
362 +--- a/drivers/hwmon/adt7470.c
363 ++++ b/drivers/hwmon/adt7470.c
364 +@@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct device *dev,
365 + return -EINVAL;
366 +
367 + temp = DIV_ROUND_CLOSEST(temp, 1000);
368 +- temp = clamp_val(temp, 0, 255);
369 ++ temp = clamp_val(temp, -128, 127);
370 +
371 + mutex_lock(&data->lock);
372 + data->temp_min[attr->index] = temp;
373 +@@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct device *dev,
374 + return -EINVAL;
375 +
376 + temp = DIV_ROUND_CLOSEST(temp, 1000);
377 +- temp = clamp_val(temp, 0, 255);
378 ++ temp = clamp_val(temp, -128, 127);
379 +
380 + mutex_lock(&data->lock);
381 + data->temp_max[attr->index] = temp;
382 +@@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct device *dev,
383 + return -EINVAL;
384 +
385 + temp = DIV_ROUND_CLOSEST(temp, 1000);
386 +- temp = clamp_val(temp, 0, 255);
387 ++ temp = clamp_val(temp, -128, 127);
388 +
389 + mutex_lock(&data->lock);
390 + data->pwm_tmin[attr->index] = temp;
391 +diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c
392 +index afd31042b452..d14ab3c45daa 100644
393 +--- a/drivers/hwmon/da9052-hwmon.c
394 ++++ b/drivers/hwmon/da9052-hwmon.c
395 +@@ -194,7 +194,7 @@ static ssize_t da9052_hwmon_show_name(struct device *dev,
396 + struct device_attribute *devattr,
397 + char *buf)
398 + {
399 +- return sprintf(buf, "da9052-hwmon\n");
400 ++ return sprintf(buf, "da9052\n");
401 + }
402 +
403 + static ssize_t show_label(struct device *dev,
404 +diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
405 +index 73b3865f1207..35eb7738d711 100644
406 +--- a/drivers/hwmon/da9055-hwmon.c
407 ++++ b/drivers/hwmon/da9055-hwmon.c
408 +@@ -204,7 +204,7 @@ static ssize_t da9055_hwmon_show_name(struct device *dev,
409 + struct device_attribute *devattr,
410 + char *buf)
411 + {
412 +- return sprintf(buf, "da9055-hwmon\n");
413 ++ return sprintf(buf, "da9055\n");
414 + }
415 +
416 + static ssize_t show_label(struct device *dev,
417 +diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
418 +index c9c1419fe6e0..f9360f497ed4 100644
419 +--- a/drivers/iio/industrialio-event.c
420 ++++ b/drivers/iio/industrialio-event.c
421 +@@ -343,6 +343,9 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
422 + &indio_dev->event_interface->dev_attr_list);
423 + kfree(postfix);
424 +
425 ++ if ((ret == -EBUSY) && (shared_by != IIO_SEPARATE))
426 ++ continue;
427 ++
428 + if (ret)
429 + return ret;
430 +
431 +diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
432 +index ac2d41bd71a0..12698ee9e06b 100644
433 +--- a/drivers/irqchip/irq-gic.c
434 ++++ b/drivers/irqchip/irq-gic.c
435 +@@ -42,6 +42,7 @@
436 + #include <linux/irqchip/chained_irq.h>
437 + #include <linux/irqchip/arm-gic.h>
438 +
439 ++#include <asm/cputype.h>
440 + #include <asm/irq.h>
441 + #include <asm/exception.h>
442 + #include <asm/smp_plat.h>
443 +@@ -903,7 +904,9 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
444 + }
445 +
446 + for_each_possible_cpu(cpu) {
447 +- unsigned long offset = percpu_offset * cpu_logical_map(cpu);
448 ++ u32 mpidr = cpu_logical_map(cpu);
449 ++ u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
450 ++ unsigned long offset = percpu_offset * core_id;
451 + *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset;
452 + *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset;
453 + }
454 +@@ -1008,8 +1011,10 @@ int __init gic_of_init(struct device_node *node, struct device_node *parent)
455 + gic_cnt++;
456 + return 0;
457 + }
458 ++IRQCHIP_DECLARE(gic_400, "arm,gic-400", gic_of_init);
459 + IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init);
460 + IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init);
461 ++IRQCHIP_DECLARE(cortex_a7_gic, "arm,cortex-a7-gic", gic_of_init);
462 + IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init);
463 + IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init);
464 +
465 +diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
466 +index 5320332390b7..a87d3fab0271 100644
467 +--- a/drivers/md/dm-cache-metadata.c
468 ++++ b/drivers/md/dm-cache-metadata.c
469 +@@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd)
470 +
471 + disk_super = dm_block_data(sblock);
472 +
473 ++ /* Verify the data block size hasn't changed */
474 ++ if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) {
475 ++ DMERR("changing the data block size (from %u to %llu) is not supported",
476 ++ le32_to_cpu(disk_super->data_block_size),
477 ++ (unsigned long long)cmd->data_block_size);
478 ++ r = -EINVAL;
479 ++ goto bad;
480 ++ }
481 ++
482 + r = __check_incompat_features(disk_super, cmd);
483 + if (r < 0)
484 + goto bad;
485 +diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
486 +index b086a945edcb..e9d33ad59df5 100644
487 +--- a/drivers/md/dm-thin-metadata.c
488 ++++ b/drivers/md/dm-thin-metadata.c
489 +@@ -613,6 +613,15 @@ static int __open_metadata(struct dm_pool_metadata *pmd)
490 +
491 + disk_super = dm_block_data(sblock);
492 +
493 ++ /* Verify the data block size hasn't changed */
494 ++ if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) {
495 ++ DMERR("changing the data block size (from %u to %llu) is not supported",
496 ++ le32_to_cpu(disk_super->data_block_size),
497 ++ (unsigned long long)pmd->data_block_size);
498 ++ r = -EINVAL;
499 ++ goto bad_unlock_sblock;
500 ++ }
501 ++
502 + r = __check_incompat_features(disk_super, pmd);
503 + if (r < 0)
504 + goto bad_unlock_sblock;
505 +diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c
506 +index 2fd1c5e31a0f..339adce7c7a5 100644
507 +--- a/drivers/media/usb/gspca/pac7302.c
508 ++++ b/drivers/media/usb/gspca/pac7302.c
509 +@@ -928,6 +928,7 @@ static const struct usb_device_id device_table[] = {
510 + {USB_DEVICE(0x093a, 0x2620)},
511 + {USB_DEVICE(0x093a, 0x2621)},
512 + {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP},
513 ++ {USB_DEVICE(0x093a, 0x2623), .driver_info = FL_VFLIP},
514 + {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP},
515 + {USB_DEVICE(0x093a, 0x2625)},
516 + {USB_DEVICE(0x093a, 0x2626)},
517 +diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c
518 +index d1dd6a33a050..3059a7a53bff 100644
519 +--- a/drivers/mtd/devices/elm.c
520 ++++ b/drivers/mtd/devices/elm.c
521 +@@ -428,6 +428,7 @@ static int elm_context_save(struct elm_info *info)
522 + ELM_SYNDROME_FRAGMENT_1 + offset);
523 + regs->elm_syndrome_fragment_0[i] = elm_read_reg(info,
524 + ELM_SYNDROME_FRAGMENT_0 + offset);
525 ++ break;
526 + default:
527 + return -EINVAL;
528 + }
529 +@@ -466,6 +467,7 @@ static int elm_context_restore(struct elm_info *info)
530 + regs->elm_syndrome_fragment_1[i]);
531 + elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset,
532 + regs->elm_syndrome_fragment_0[i]);
533 ++ break;
534 + default:
535 + return -EINVAL;
536 + }
537 +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
538 +index 91ec8cd12478..a95b322f0924 100644
539 +--- a/drivers/net/bonding/bond_main.c
540 ++++ b/drivers/net/bonding/bond_main.c
541 +@@ -4068,7 +4068,7 @@ static int bond_check_params(struct bond_params *params)
542 + }
543 +
544 + if (ad_select) {
545 +- bond_opt_initstr(&newval, lacp_rate);
546 ++ bond_opt_initstr(&newval, ad_select);
547 + valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_SELECT),
548 + &newval);
549 + if (!valptr) {
550 +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
551 +index 3fcdae266377..1d0dab854b90 100644
552 +--- a/drivers/net/can/slcan.c
553 ++++ b/drivers/net/can/slcan.c
554 +@@ -52,6 +52,7 @@
555 + #include <linux/delay.h>
556 + #include <linux/init.h>
557 + #include <linux/kernel.h>
558 ++#include <linux/workqueue.h>
559 + #include <linux/can.h>
560 + #include <linux/can/skb.h>
561 +
562 +@@ -85,6 +86,7 @@ struct slcan {
563 + struct tty_struct *tty; /* ptr to TTY structure */
564 + struct net_device *dev; /* easy for intr handling */
565 + spinlock_t lock;
566 ++ struct work_struct tx_work; /* Flushes transmit buffer */
567 +
568 + /* These are pointers to the malloc()ed frame buffers. */
569 + unsigned char rbuff[SLC_MTU]; /* receiver buffer */
570 +@@ -309,34 +311,44 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf)
571 + sl->dev->stats.tx_bytes += cf->can_dlc;
572 + }
573 +
574 +-/*
575 +- * Called by the driver when there's room for more data. If we have
576 +- * more packets to send, we send them here.
577 +- */
578 +-static void slcan_write_wakeup(struct tty_struct *tty)
579 ++/* Write out any remaining transmit buffer. Scheduled when tty is writable */
580 ++static void slcan_transmit(struct work_struct *work)
581 + {
582 ++ struct slcan *sl = container_of(work, struct slcan, tx_work);
583 + int actual;
584 +- struct slcan *sl = (struct slcan *) tty->disc_data;
585 +
586 ++ spin_lock_bh(&sl->lock);
587 + /* First make sure we're connected. */
588 +- if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev))
589 ++ if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) {
590 ++ spin_unlock_bh(&sl->lock);
591 + return;
592 ++ }
593 +
594 +- spin_lock(&sl->lock);
595 + if (sl->xleft <= 0) {
596 + /* Now serial buffer is almost free & we can start
597 + * transmission of another packet */
598 + sl->dev->stats.tx_packets++;
599 +- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
600 +- spin_unlock(&sl->lock);
601 ++ clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
602 ++ spin_unlock_bh(&sl->lock);
603 + netif_wake_queue(sl->dev);
604 + return;
605 + }
606 +
607 +- actual = tty->ops->write(tty, sl->xhead, sl->xleft);
608 ++ actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
609 + sl->xleft -= actual;
610 + sl->xhead += actual;
611 +- spin_unlock(&sl->lock);
612 ++ spin_unlock_bh(&sl->lock);
613 ++}
614 ++
615 ++/*
616 ++ * Called by the driver when there's room for more data.
617 ++ * Schedule the transmit.
618 ++ */
619 ++static void slcan_write_wakeup(struct tty_struct *tty)
620 ++{
621 ++ struct slcan *sl = tty->disc_data;
622 ++
623 ++ schedule_work(&sl->tx_work);
624 + }
625 +
626 + /* Send a can_frame to a TTY queue. */
627 +@@ -522,6 +534,7 @@ static struct slcan *slc_alloc(dev_t line)
628 + sl->magic = SLCAN_MAGIC;
629 + sl->dev = dev;
630 + spin_lock_init(&sl->lock);
631 ++ INIT_WORK(&sl->tx_work, slcan_transmit);
632 + slcan_devs[i] = dev;
633 +
634 + return sl;
635 +@@ -620,8 +633,12 @@ static void slcan_close(struct tty_struct *tty)
636 + if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty)
637 + return;
638 +
639 ++ spin_lock_bh(&sl->lock);
640 + tty->disc_data = NULL;
641 + sl->tty = NULL;
642 ++ spin_unlock_bh(&sl->lock);
643 ++
644 ++ flush_work(&sl->tx_work);
645 +
646 + /* Flush network side */
647 + unregister_netdev(sl->dev);
648 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
649 +index dbcff509dc3f..5ed512473b12 100644
650 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
651 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
652 +@@ -793,7 +793,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
653 +
654 + return;
655 + }
656 +- bnx2x_frag_free(fp, new_data);
657 ++ if (new_data)
658 ++ bnx2x_frag_free(fp, new_data);
659 + drop:
660 + /* drop the packet and keep the buffer in the bin */
661 + DP(NETIF_MSG_RX_STATUS,
662 +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
663 +index 36c80612e21a..80bfa0391913 100644
664 +--- a/drivers/net/ethernet/emulex/benet/be_main.c
665 ++++ b/drivers/net/ethernet/emulex/benet/be_main.c
666 +@@ -2797,7 +2797,7 @@ static int be_open(struct net_device *netdev)
667 + for_all_evt_queues(adapter, eqo, i) {
668 + napi_enable(&eqo->napi);
669 + be_enable_busy_poll(eqo);
670 +- be_eq_notify(adapter, eqo->q.id, true, false, 0);
671 ++ be_eq_notify(adapter, eqo->q.id, true, true, 0);
672 + }
673 + adapter->flags |= BE_FLAGS_NAPI_ENABLED;
674 +
675 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
676 +index 42f0f6717511..70e16f71f574 100644
677 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
678 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
679 +@@ -1374,7 +1374,7 @@ static void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
680 + /* RAR[1-6] are owned by manageability. Skip those and program the
681 + * next address into the SHRA register array.
682 + */
683 +- if (index < (u32)(hw->mac.rar_entry_count - 6)) {
684 ++ if (index < (u32)(hw->mac.rar_entry_count)) {
685 + s32 ret_val;
686 +
687 + ret_val = e1000_acquire_swflag_ich8lan(hw);
688 +diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
689 +index 217090df33e7..59865695b282 100644
690 +--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
691 ++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
692 +@@ -98,7 +98,7 @@
693 + #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
694 +
695 + #define E1000_ICH_RAR_ENTRIES 7
696 +-#define E1000_PCH2_RAR_ENTRIES 11 /* RAR[0-6], SHRA[0-3] */
697 ++#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */
698 + #define E1000_PCH_LPT_RAR_ENTRIES 12 /* RAR[0], SHRA[0-10] */
699 +
700 + #define PHY_PAGE_SHIFT 5
701 +diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
702 +index 06df6928f44c..4fa5c2a77d49 100644
703 +--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
704 ++++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
705 +@@ -1492,6 +1492,13 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw)
706 + s32 ret_val;
707 + u16 i, rar_count = mac->rar_entry_count;
708 +
709 ++ if ((hw->mac.type >= e1000_i210) &&
710 ++ !(igb_get_flash_presence_i210(hw))) {
711 ++ ret_val = igb_pll_workaround_i210(hw);
712 ++ if (ret_val)
713 ++ return ret_val;
714 ++ }
715 ++
716 + /* Initialize identification LED */
717 + ret_val = igb_id_led_init(hw);
718 + if (ret_val) {
719 +diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
720 +index 0571b973be80..20b37668284a 100644
721 +--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
722 ++++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
723 +@@ -46,14 +46,15 @@
724 + /* Extended Device Control */
725 + #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Defineable Pin 3 */
726 + /* Physical Func Reset Done Indication */
727 +-#define E1000_CTRL_EXT_PFRSTD 0x00004000
728 +-#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
729 +-#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
730 +-#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000
731 +-#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000
732 +-#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
733 +-#define E1000_CTRL_EXT_EIAME 0x01000000
734 +-#define E1000_CTRL_EXT_IRCA 0x00000001
735 ++#define E1000_CTRL_EXT_PFRSTD 0x00004000
736 ++#define E1000_CTRL_EXT_SDLPE 0X00040000 /* SerDes Low Power Enable */
737 ++#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
738 ++#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000
739 ++#define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000
740 ++#define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000
741 ++#define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000
742 ++#define E1000_CTRL_EXT_EIAME 0x01000000
743 ++#define E1000_CTRL_EXT_IRCA 0x00000001
744 + /* Interrupt delay cancellation */
745 + /* Driver loaded bit for FW */
746 + #define E1000_CTRL_EXT_DRV_LOAD 0x10000000
747 +@@ -62,6 +63,7 @@
748 + /* packet buffer parity error detection enabled */
749 + /* descriptor FIFO parity error detection enable */
750 + #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
751 ++#define E1000_CTRL_EXT_PHYPDEN 0x00100000
752 + #define E1000_I2CCMD_REG_ADDR_SHIFT 16
753 + #define E1000_I2CCMD_PHY_ADDR_SHIFT 24
754 + #define E1000_I2CCMD_OPCODE_READ 0x08000000
755 +diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
756 +index ab99e2b582a8..b79980ad225b 100644
757 +--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
758 ++++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
759 +@@ -572,4 +572,7 @@ struct net_device *igb_get_hw_dev(struct e1000_hw *hw);
760 + /* These functions must be implemented by drivers */
761 + s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
762 + s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
763 ++
764 ++void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
765 ++void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
766 + #endif /* _E1000_HW_H_ */
767 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c
768 +index 0c0393316a3a..0217d4e229a0 100644
769 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
770 ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
771 +@@ -835,3 +835,69 @@ s32 igb_init_nvm_params_i210(struct e1000_hw *hw)
772 + }
773 + return ret_val;
774 + }
775 ++
776 ++/**
777 ++ * igb_pll_workaround_i210
778 ++ * @hw: pointer to the HW structure
779 ++ *
780 ++ * Works around an errata in the PLL circuit where it occasionally
781 ++ * provides the wrong clock frequency after power up.
782 ++ **/
783 ++s32 igb_pll_workaround_i210(struct e1000_hw *hw)
784 ++{
785 ++ s32 ret_val;
786 ++ u32 wuc, mdicnfg, ctrl, ctrl_ext, reg_val;
787 ++ u16 nvm_word, phy_word, pci_word, tmp_nvm;
788 ++ int i;
789 ++
790 ++ /* Get and set needed register values */
791 ++ wuc = rd32(E1000_WUC);
792 ++ mdicnfg = rd32(E1000_MDICNFG);
793 ++ reg_val = mdicnfg & ~E1000_MDICNFG_EXT_MDIO;
794 ++ wr32(E1000_MDICNFG, reg_val);
795 ++
796 ++ /* Get data from NVM, or set default */
797 ++ ret_val = igb_read_invm_word_i210(hw, E1000_INVM_AUTOLOAD,
798 ++ &nvm_word);
799 ++ if (ret_val)
800 ++ nvm_word = E1000_INVM_DEFAULT_AL;
801 ++ tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
802 ++ for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
803 ++ /* check current state directly from internal PHY */
804 ++ igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE |
805 ++ E1000_PHY_PLL_FREQ_REG), &phy_word);
806 ++ if ((phy_word & E1000_PHY_PLL_UNCONF)
807 ++ != E1000_PHY_PLL_UNCONF) {
808 ++ ret_val = 0;
809 ++ break;
810 ++ } else {
811 ++ ret_val = -E1000_ERR_PHY;
812 ++ }
813 ++ /* directly reset the internal PHY */
814 ++ ctrl = rd32(E1000_CTRL);
815 ++ wr32(E1000_CTRL, ctrl|E1000_CTRL_PHY_RST);
816 ++
817 ++ ctrl_ext = rd32(E1000_CTRL_EXT);
818 ++ ctrl_ext |= (E1000_CTRL_EXT_PHYPDEN | E1000_CTRL_EXT_SDLPE);
819 ++ wr32(E1000_CTRL_EXT, ctrl_ext);
820 ++
821 ++ wr32(E1000_WUC, 0);
822 ++ reg_val = (E1000_INVM_AUTOLOAD << 4) | (tmp_nvm << 16);
823 ++ wr32(E1000_EEARBC_I210, reg_val);
824 ++
825 ++ igb_read_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
826 ++ pci_word |= E1000_PCI_PMCSR_D3;
827 ++ igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
828 ++ usleep_range(1000, 2000);
829 ++ pci_word &= ~E1000_PCI_PMCSR_D3;
830 ++ igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word);
831 ++ reg_val = (E1000_INVM_AUTOLOAD << 4) | (nvm_word << 16);
832 ++ wr32(E1000_EEARBC_I210, reg_val);
833 ++
834 ++ /* restore WUC register */
835 ++ wr32(E1000_WUC, wuc);
836 ++ }
837 ++ /* restore MDICNFG setting */
838 ++ wr32(E1000_MDICNFG, mdicnfg);
839 ++ return ret_val;
840 ++}
841 +diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.h b/drivers/net/ethernet/intel/igb/e1000_i210.h
842 +index 2d913716573a..710f8e9f10fb 100644
843 +--- a/drivers/net/ethernet/intel/igb/e1000_i210.h
844 ++++ b/drivers/net/ethernet/intel/igb/e1000_i210.h
845 +@@ -46,6 +46,7 @@ s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data);
846 + s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data);
847 + s32 igb_init_nvm_params_i210(struct e1000_hw *hw);
848 + bool igb_get_flash_presence_i210(struct e1000_hw *hw);
849 ++s32 igb_pll_workaround_i210(struct e1000_hw *hw);
850 +
851 + #define E1000_STM_OPCODE 0xDB00
852 + #define E1000_EEPROM_FLASH_SIZE_WORD 0x11
853 +@@ -91,4 +92,15 @@ enum E1000_INVM_STRUCTURE_TYPE {
854 + #define NVM_LED_1_CFG_DEFAULT_I211 0x0184
855 + #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C
856 +
857 ++/* PLL Defines */
858 ++#define E1000_PCI_PMCSR 0x44
859 ++#define E1000_PCI_PMCSR_D3 0x03
860 ++#define E1000_MAX_PLL_TRIES 5
861 ++#define E1000_PHY_PLL_UNCONF 0xFF
862 ++#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000
863 ++#define E1000_PHY_PLL_FREQ_REG 0x000E
864 ++#define E1000_INVM_DEFAULT_AL 0x202F
865 ++#define E1000_INVM_AUTOLOAD 0x0A
866 ++#define E1000_INVM_PLL_WO_VAL 0x0010
867 ++
868 + #endif
869 +diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
870 +index 82632c6c53af..7156981ec813 100644
871 +--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
872 ++++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
873 +@@ -69,6 +69,7 @@
874 + #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */
875 + #define E1000_PBS 0x01008 /* Packet Buffer Size */
876 + #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
877 ++#define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
878 + #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
879 + #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
880 + #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */
881 +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
882 +index d9c7eb279141..5ca8c479666e 100644
883 +--- a/drivers/net/ethernet/intel/igb/igb_main.c
884 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
885 +@@ -7128,6 +7128,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
886 + }
887 + }
888 +
889 ++void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
890 ++{
891 ++ struct igb_adapter *adapter = hw->back;
892 ++
893 ++ pci_read_config_word(adapter->pdev, reg, value);
894 ++}
895 ++
896 ++void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value)
897 ++{
898 ++ struct igb_adapter *adapter = hw->back;
899 ++
900 ++ pci_write_config_word(adapter->pdev, reg, *value);
901 ++}
902 ++
903 + s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
904 + {
905 + struct igb_adapter *adapter = hw->back;
906 +@@ -7491,6 +7505,8 @@ static int igb_sriov_reinit(struct pci_dev *dev)
907 +
908 + if (netif_running(netdev))
909 + igb_close(netdev);
910 ++ else
911 ++ igb_reset(adapter);
912 +
913 + igb_clear_interrupt_scheme(adapter);
914 +
915 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
916 +index ca2dfbe01598..c4c00d9f2c04 100644
917 +--- a/drivers/net/ethernet/marvell/mvneta.c
918 ++++ b/drivers/net/ethernet/marvell/mvneta.c
919 +@@ -1217,7 +1217,7 @@ static u32 mvneta_txq_desc_csum(int l3_offs, int l3_proto,
920 + command = l3_offs << MVNETA_TX_L3_OFF_SHIFT;
921 + command |= ip_hdr_len << MVNETA_TX_IP_HLEN_SHIFT;
922 +
923 +- if (l3_proto == swab16(ETH_P_IP))
924 ++ if (l3_proto == htons(ETH_P_IP))
925 + command |= MVNETA_TXD_IP_CSUM;
926 + else
927 + command |= MVNETA_TX_L3_IP6;
928 +@@ -2393,7 +2393,7 @@ static void mvneta_adjust_link(struct net_device *ndev)
929 +
930 + if (phydev->speed == SPEED_1000)
931 + val |= MVNETA_GMAC_CONFIG_GMII_SPEED;
932 +- else
933 ++ else if (phydev->speed == SPEED_100)
934 + val |= MVNETA_GMAC_CONFIG_MII_SPEED;
935 +
936 + mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
937 +diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
938 +index 1c24a8f368bd..fd411d6e19a2 100644
939 +--- a/drivers/net/ethernet/sun/sunvnet.c
940 ++++ b/drivers/net/ethernet/sun/sunvnet.c
941 +@@ -1083,6 +1083,24 @@ static struct vnet *vnet_find_or_create(const u64 *local_mac)
942 + return vp;
943 + }
944 +
945 ++static void vnet_cleanup(void)
946 ++{
947 ++ struct vnet *vp;
948 ++ struct net_device *dev;
949 ++
950 ++ mutex_lock(&vnet_list_mutex);
951 ++ while (!list_empty(&vnet_list)) {
952 ++ vp = list_first_entry(&vnet_list, struct vnet, list);
953 ++ list_del(&vp->list);
954 ++ dev = vp->dev;
955 ++ /* vio_unregister_driver() should have cleaned up port_list */
956 ++ BUG_ON(!list_empty(&vp->port_list));
957 ++ unregister_netdev(dev);
958 ++ free_netdev(dev);
959 ++ }
960 ++ mutex_unlock(&vnet_list_mutex);
961 ++}
962 ++
963 + static const char *local_mac_prop = "local-mac-address";
964 +
965 + static struct vnet *vnet_find_parent(struct mdesc_handle *hp,
966 +@@ -1240,7 +1258,6 @@ static int vnet_port_remove(struct vio_dev *vdev)
967 +
968 + kfree(port);
969 +
970 +- unregister_netdev(vp->dev);
971 + }
972 + return 0;
973 + }
974 +@@ -1268,6 +1285,7 @@ static int __init vnet_init(void)
975 + static void __exit vnet_exit(void)
976 + {
977 + vio_unregister_driver(&vnet_port_driver);
978 ++ vnet_cleanup();
979 + }
980 +
981 + module_init(vnet_init);
982 +diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
983 +index 2ea7efd11857..6c9c16d76935 100644
984 +--- a/drivers/net/ppp/pppoe.c
985 ++++ b/drivers/net/ppp/pppoe.c
986 +@@ -675,7 +675,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
987 + po->chan.hdrlen = (sizeof(struct pppoe_hdr) +
988 + dev->hard_header_len);
989 +
990 +- po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr);
991 ++ po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2;
992 + po->chan.private = sk;
993 + po->chan.ops = &pppoe_chan_ops;
994 +
995 +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
996 +index ad4a94e9ff57..87526443841f 100644
997 +--- a/drivers/net/slip/slip.c
998 ++++ b/drivers/net/slip/slip.c
999 +@@ -83,6 +83,7 @@
1000 + #include <linux/delay.h>
1001 + #include <linux/init.h>
1002 + #include <linux/slab.h>
1003 ++#include <linux/workqueue.h>
1004 + #include "slip.h"
1005 + #ifdef CONFIG_INET
1006 + #include <linux/ip.h>
1007 +@@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
1008 + #endif
1009 + }
1010 +
1011 +-/*
1012 +- * Called by the driver when there's room for more data. If we have
1013 +- * more packets to send, we send them here.
1014 +- */
1015 +-static void slip_write_wakeup(struct tty_struct *tty)
1016 ++/* Write out any remaining transmit buffer. Scheduled when tty is writable */
1017 ++static void slip_transmit(struct work_struct *work)
1018 + {
1019 ++ struct slip *sl = container_of(work, struct slip, tx_work);
1020 + int actual;
1021 +- struct slip *sl = tty->disc_data;
1022 +
1023 ++ spin_lock_bh(&sl->lock);
1024 + /* First make sure we're connected. */
1025 +- if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev))
1026 ++ if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) {
1027 ++ spin_unlock_bh(&sl->lock);
1028 + return;
1029 ++ }
1030 +
1031 +- spin_lock_bh(&sl->lock);
1032 + if (sl->xleft <= 0) {
1033 + /* Now serial buffer is almost free & we can start
1034 + * transmission of another packet */
1035 + sl->dev->stats.tx_packets++;
1036 +- clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
1037 ++ clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
1038 + spin_unlock_bh(&sl->lock);
1039 + sl_unlock(sl);
1040 + return;
1041 + }
1042 +
1043 +- actual = tty->ops->write(tty, sl->xhead, sl->xleft);
1044 ++ actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft);
1045 + sl->xleft -= actual;
1046 + sl->xhead += actual;
1047 + spin_unlock_bh(&sl->lock);
1048 + }
1049 +
1050 ++/*
1051 ++ * Called by the driver when there's room for more data.
1052 ++ * Schedule the transmit.
1053 ++ */
1054 ++static void slip_write_wakeup(struct tty_struct *tty)
1055 ++{
1056 ++ struct slip *sl = tty->disc_data;
1057 ++
1058 ++ schedule_work(&sl->tx_work);
1059 ++}
1060 ++
1061 + static void sl_tx_timeout(struct net_device *dev)
1062 + {
1063 + struct slip *sl = netdev_priv(dev);
1064 +@@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line)
1065 + sl->magic = SLIP_MAGIC;
1066 + sl->dev = dev;
1067 + spin_lock_init(&sl->lock);
1068 ++ INIT_WORK(&sl->tx_work, slip_transmit);
1069 + sl->mode = SL_MODE_DEFAULT;
1070 + #ifdef CONFIG_SLIP_SMART
1071 + /* initialize timer_list struct */
1072 +@@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty)
1073 + if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty)
1074 + return;
1075 +
1076 ++ spin_lock_bh(&sl->lock);
1077 + tty->disc_data = NULL;
1078 + sl->tty = NULL;
1079 ++ spin_unlock_bh(&sl->lock);
1080 ++
1081 ++ flush_work(&sl->tx_work);
1082 +
1083 + /* VSV = very important to remove timers */
1084 + #ifdef CONFIG_SLIP_SMART
1085 +diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h
1086 +index 67673cf1266b..cf32aadf508f 100644
1087 +--- a/drivers/net/slip/slip.h
1088 ++++ b/drivers/net/slip/slip.h
1089 +@@ -53,6 +53,7 @@ struct slip {
1090 + struct tty_struct *tty; /* ptr to TTY structure */
1091 + struct net_device *dev; /* easy for intr handling */
1092 + spinlock_t lock;
1093 ++ struct work_struct tx_work; /* Flushes transmit buffer */
1094 +
1095 + #ifdef SL_INCLUDE_CSLIP
1096 + struct slcompress *slcomp; /* for header compression */
1097 +diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
1098 +index 312178d7b698..a01462523bc7 100644
1099 +--- a/drivers/net/usb/huawei_cdc_ncm.c
1100 ++++ b/drivers/net/usb/huawei_cdc_ncm.c
1101 +@@ -84,12 +84,13 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
1102 + ctx = drvstate->ctx;
1103 +
1104 + if (usbnet_dev->status)
1105 +- /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256
1106 +- * decimal (0x100)"
1107 ++ /* The wMaxCommand buffer must be big enough to hold
1108 ++ * any message from the modem. Experience has shown
1109 ++ * that some replies are more than 256 bytes long
1110 + */
1111 + subdriver = usb_cdc_wdm_register(ctx->control,
1112 + &usbnet_dev->status->desc,
1113 +- 256, /* wMaxCommand */
1114 ++ 1024, /* wMaxCommand */
1115 + huawei_cdc_ncm_wdm_manage_power);
1116 + if (IS_ERR(subdriver)) {
1117 + ret = PTR_ERR(subdriver);
1118 +@@ -206,6 +207,9 @@ static const struct usb_device_id huawei_cdc_ncm_devs[] = {
1119 + { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76),
1120 + .driver_info = (unsigned long)&huawei_cdc_ncm_info,
1121 + },
1122 ++ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x03, 0x16),
1123 ++ .driver_info = (unsigned long)&huawei_cdc_ncm_info,
1124 ++ },
1125 +
1126 + /* Terminating entry */
1127 + {
1128 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1129 +index b71120842c4f..d510f1d41bae 100644
1130 +--- a/drivers/net/usb/qmi_wwan.c
1131 ++++ b/drivers/net/usb/qmi_wwan.c
1132 +@@ -660,6 +660,7 @@ static const struct usb_device_id products[] = {
1133 + {QMI_FIXED_INTF(0x05c6, 0x9084, 4)},
1134 + {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
1135 + {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
1136 ++ {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
1137 + {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
1138 + {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
1139 + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
1140 +@@ -734,6 +735,7 @@ static const struct usb_device_id products[] = {
1141 + {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
1142 + {QMI_FIXED_INTF(0x19d2, 0x1425, 2)},
1143 + {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */
1144 ++ {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */
1145 + {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
1146 + {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
1147 + {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1148 +@@ -746,6 +748,7 @@ static const struct usb_device_id products[] = {
1149 + {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
1150 + {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
1151 + {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */
1152 ++ {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
1153 + {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
1154 + {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
1155 + {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
1156 +diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
1157 +index 503a81e58185..c1e311341b74 100644
1158 +--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
1159 ++++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
1160 +@@ -1068,13 +1068,6 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
1161 + /* recalculate basic rates */
1162 + iwl_calc_basic_rates(priv, ctx);
1163 +
1164 +- /*
1165 +- * force CTS-to-self frames protection if RTS-CTS is not preferred
1166 +- * one aggregation protection method
1167 +- */
1168 +- if (!priv->hw_params.use_rts_for_aggregation)
1169 +- ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1170 +-
1171 + if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
1172 + !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
1173 + ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
1174 +@@ -1480,11 +1473,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1175 + else
1176 + ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
1177 +
1178 +- if (bss_conf->use_cts_prot)
1179 +- ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
1180 +- else
1181 +- ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN;
1182 +-
1183 + memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN);
1184 +
1185 + if (vif->type == NL80211_IFTYPE_AP ||
1186 +diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
1187 +index ba723d50939a..820797af7abf 100644
1188 +--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
1189 ++++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
1190 +@@ -651,13 +651,9 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
1191 + if (vif->bss_conf.qos)
1192 + cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
1193 +
1194 +- /* Don't use cts to self as the fw doesn't support it currently. */
1195 +- if (vif->bss_conf.use_cts_prot) {
1196 ++ if (vif->bss_conf.use_cts_prot)
1197 + cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT);
1198 +- if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8)
1199 +- cmd->protection_flags |=
1200 +- cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN);
1201 +- }
1202 ++
1203 + IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n",
1204 + vif->bss_conf.use_cts_prot,
1205 + vif->bss_conf.ht_operation_mode);
1206 +diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c
1207 +index 43e27a174430..df1f5e732ab5 100644
1208 +--- a/drivers/net/wireless/iwlwifi/pcie/drv.c
1209 ++++ b/drivers/net/wireless/iwlwifi/pcie/drv.c
1210 +@@ -366,6 +366,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
1211 + {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)},
1212 + {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)},
1213 + {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
1214 ++ {IWL_PCI_DEVICE(0x095A, 0x5510, iwl7265_2ac_cfg)},
1215 + {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)},
1216 + {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)},
1217 + {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)},
1218 +@@ -379,7 +380,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
1219 + {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
1220 + {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)},
1221 + {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
1222 +- {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)},
1223 ++ {IWL_PCI_DEVICE(0x095B, 0x9200, iwl7265_2ac_cfg)},
1224 + {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)},
1225 + {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)},
1226 + {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
1227 +diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
1228 +index 9d3d2758ec35..952a47f6554e 100644
1229 +--- a/drivers/net/wireless/mwifiex/main.c
1230 ++++ b/drivers/net/wireless/mwifiex/main.c
1231 +@@ -646,6 +646,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1232 + }
1233 +
1234 + tx_info = MWIFIEX_SKB_TXCB(skb);
1235 ++ memset(tx_info, 0, sizeof(*tx_info));
1236 + tx_info->bss_num = priv->bss_num;
1237 + tx_info->bss_type = priv->bss_type;
1238 + tx_info->pkt_len = skb->len;
1239 +diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
1240 +index 3314516018c6..86b1fd673749 100644
1241 +--- a/drivers/usb/chipidea/udc.c
1242 ++++ b/drivers/usb/chipidea/udc.c
1243 +@@ -1179,8 +1179,8 @@ static int ep_enable(struct usb_ep *ep,
1244 +
1245 + if (hwep->type == USB_ENDPOINT_XFER_CONTROL)
1246 + cap |= QH_IOS;
1247 +- if (hwep->num)
1248 +- cap |= QH_ZLT;
1249 ++
1250 ++ cap |= QH_ZLT;
1251 + cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
1252 + /*
1253 + * For ISO-TX, we set mult at QH as the largest value, and use
1254 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1255 +index 3baa51bf8a6a..36b1e856bd00 100644
1256 +--- a/drivers/usb/core/hub.c
1257 ++++ b/drivers/usb/core/hub.c
1258 +@@ -884,6 +884,25 @@ static int hub_usb3_port_disable(struct usb_hub *hub, int port1)
1259 + if (!hub_is_superspeed(hub->hdev))
1260 + return -EINVAL;
1261 +
1262 ++ ret = hub_port_status(hub, port1, &portstatus, &portchange);
1263 ++ if (ret < 0)
1264 ++ return ret;
1265 ++
1266 ++ /*
1267 ++ * USB controller Advanced Micro Devices, Inc. [AMD] FCH USB XHCI
1268 ++ * Controller [1022:7814] will have spurious result making the following
1269 ++ * usb 3.0 device hotplugging route to the 2.0 root hub and recognized
1270 ++ * as high-speed device if we set the usb 3.0 port link state to
1271 ++ * Disabled. Since it's already in USB_SS_PORT_LS_RX_DETECT state, we
1272 ++ * check the state here to avoid the bug.
1273 ++ */
1274 ++ if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
1275 ++ USB_SS_PORT_LS_RX_DETECT) {
1276 ++ dev_dbg(&hub->ports[port1 - 1]->dev,
1277 ++ "Not disabling port; link state is RxDetect\n");
1278 ++ return ret;
1279 ++ }
1280 ++
1281 + ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
1282 + if (ret)
1283 + return ret;
1284 +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
1285 +index 61a6ac8fa8fc..08834b565aab 100644
1286 +--- a/drivers/xen/balloon.c
1287 ++++ b/drivers/xen/balloon.c
1288 +@@ -426,20 +426,18 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
1289 + * p2m are consistent.
1290 + */
1291 + if (!xen_feature(XENFEAT_auto_translated_physmap)) {
1292 +- unsigned long p;
1293 +- struct page *scratch_page = get_balloon_scratch_page();
1294 +-
1295 + if (!PageHighMem(page)) {
1296 ++ struct page *scratch_page = get_balloon_scratch_page();
1297 ++
1298 + ret = HYPERVISOR_update_va_mapping(
1299 + (unsigned long)__va(pfn << PAGE_SHIFT),
1300 + pfn_pte(page_to_pfn(scratch_page),
1301 + PAGE_KERNEL_RO), 0);
1302 + BUG_ON(ret);
1303 +- }
1304 +- p = page_to_pfn(scratch_page);
1305 +- __set_phys_to_machine(pfn, pfn_to_mfn(p));
1306 +
1307 +- put_balloon_scratch_page();
1308 ++ put_balloon_scratch_page();
1309 ++ }
1310 ++ __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
1311 + }
1312 + #endif
1313 +
1314 +diff --git a/fs/aio.c b/fs/aio.c
1315 +index e609e15f36b9..6d68e01dc7ca 100644
1316 +--- a/fs/aio.c
1317 ++++ b/fs/aio.c
1318 +@@ -830,16 +830,20 @@ void exit_aio(struct mm_struct *mm)
1319 + static void put_reqs_available(struct kioctx *ctx, unsigned nr)
1320 + {
1321 + struct kioctx_cpu *kcpu;
1322 ++ unsigned long flags;
1323 +
1324 + preempt_disable();
1325 + kcpu = this_cpu_ptr(ctx->cpu);
1326 +
1327 ++ local_irq_save(flags);
1328 + kcpu->reqs_available += nr;
1329 ++
1330 + while (kcpu->reqs_available >= ctx->req_batch * 2) {
1331 + kcpu->reqs_available -= ctx->req_batch;
1332 + atomic_add(ctx->req_batch, &ctx->reqs_available);
1333 + }
1334 +
1335 ++ local_irq_restore(flags);
1336 + preempt_enable();
1337 + }
1338 +
1339 +@@ -847,10 +851,12 @@ static bool get_reqs_available(struct kioctx *ctx)
1340 + {
1341 + struct kioctx_cpu *kcpu;
1342 + bool ret = false;
1343 ++ unsigned long flags;
1344 +
1345 + preempt_disable();
1346 + kcpu = this_cpu_ptr(ctx->cpu);
1347 +
1348 ++ local_irq_save(flags);
1349 + if (!kcpu->reqs_available) {
1350 + int old, avail = atomic_read(&ctx->reqs_available);
1351 +
1352 +@@ -869,6 +875,7 @@ static bool get_reqs_available(struct kioctx *ctx)
1353 + ret = true;
1354 + kcpu->reqs_available--;
1355 + out:
1356 ++ local_irq_restore(flags);
1357 + preempt_enable();
1358 + return ret;
1359 + }
1360 +diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
1361 +index 1d1292c581c3..342f0239fcbf 100644
1362 +--- a/fs/fuse/dir.c
1363 ++++ b/fs/fuse/dir.c
1364 +@@ -198,7 +198,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
1365 + inode = ACCESS_ONCE(entry->d_inode);
1366 + if (inode && is_bad_inode(inode))
1367 + goto invalid;
1368 +- else if (fuse_dentry_time(entry) < get_jiffies_64()) {
1369 ++ else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) ||
1370 ++ (flags & LOOKUP_REVAL)) {
1371 + int err;
1372 + struct fuse_entry_out outarg;
1373 + struct fuse_req *req;
1374 +@@ -925,7 +926,7 @@ int fuse_update_attributes(struct inode *inode, struct kstat *stat,
1375 + int err;
1376 + bool r;
1377 +
1378 +- if (fi->i_time < get_jiffies_64()) {
1379 ++ if (time_before64(fi->i_time, get_jiffies_64())) {
1380 + r = true;
1381 + err = fuse_do_getattr(inode, stat, file);
1382 + } else {
1383 +@@ -1111,7 +1112,7 @@ static int fuse_permission(struct inode *inode, int mask)
1384 + ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
1385 + struct fuse_inode *fi = get_fuse_inode(inode);
1386 +
1387 +- if (fi->i_time < get_jiffies_64()) {
1388 ++ if (time_before64(fi->i_time, get_jiffies_64())) {
1389 + refreshed = true;
1390 +
1391 + err = fuse_perm_getattr(inode, mask);
1392 +diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
1393 +index d468643a68b2..73f6bcb44ea8 100644
1394 +--- a/fs/fuse/inode.c
1395 ++++ b/fs/fuse/inode.c
1396 +@@ -461,6 +461,17 @@ static const match_table_t tokens = {
1397 + {OPT_ERR, NULL}
1398 + };
1399 +
1400 ++static int fuse_match_uint(substring_t *s, unsigned int *res)
1401 ++{
1402 ++ int err = -ENOMEM;
1403 ++ char *buf = match_strdup(s);
1404 ++ if (buf) {
1405 ++ err = kstrtouint(buf, 10, res);
1406 ++ kfree(buf);
1407 ++ }
1408 ++ return err;
1409 ++}
1410 ++
1411 + static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
1412 + {
1413 + char *p;
1414 +@@ -471,6 +482,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
1415 + while ((p = strsep(&opt, ",")) != NULL) {
1416 + int token;
1417 + int value;
1418 ++ unsigned uv;
1419 + substring_t args[MAX_OPT_ARGS];
1420 + if (!*p)
1421 + continue;
1422 +@@ -494,18 +506,18 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
1423 + break;
1424 +
1425 + case OPT_USER_ID:
1426 +- if (match_int(&args[0], &value))
1427 ++ if (fuse_match_uint(&args[0], &uv))
1428 + return 0;
1429 +- d->user_id = make_kuid(current_user_ns(), value);
1430 ++ d->user_id = make_kuid(current_user_ns(), uv);
1431 + if (!uid_valid(d->user_id))
1432 + return 0;
1433 + d->user_id_present = 1;
1434 + break;
1435 +
1436 + case OPT_GROUP_ID:
1437 +- if (match_int(&args[0], &value))
1438 ++ if (fuse_match_uint(&args[0], &uv))
1439 + return 0;
1440 +- d->group_id = make_kgid(current_user_ns(), value);
1441 ++ d->group_id = make_kgid(current_user_ns(), uv);
1442 + if (!gid_valid(d->group_id))
1443 + return 0;
1444 + d->group_id_present = 1;
1445 +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
1446 +index cfc8dcc16043..ce87c9007b0f 100644
1447 +--- a/fs/quota/dquot.c
1448 ++++ b/fs/quota/dquot.c
1449 +@@ -702,6 +702,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1450 + struct dquot *dquot;
1451 + unsigned long freed = 0;
1452 +
1453 ++ spin_lock(&dq_list_lock);
1454 + head = free_dquots.prev;
1455 + while (head != &free_dquots && sc->nr_to_scan) {
1456 + dquot = list_entry(head, struct dquot, dq_free);
1457 +@@ -713,6 +714,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
1458 + freed++;
1459 + head = free_dquots.prev;
1460 + }
1461 ++ spin_unlock(&dq_list_lock);
1462 + return freed;
1463 + }
1464 +
1465 +diff --git a/include/net/sock.h b/include/net/sock.h
1466 +index 57c31dd15e64..2f7bc435c93d 100644
1467 +--- a/include/net/sock.h
1468 ++++ b/include/net/sock.h
1469 +@@ -1755,8 +1755,8 @@ sk_dst_get(struct sock *sk)
1470 +
1471 + rcu_read_lock();
1472 + dst = rcu_dereference(sk->sk_dst_cache);
1473 +- if (dst)
1474 +- dst_hold(dst);
1475 ++ if (dst && !atomic_inc_not_zero(&dst->__refcnt))
1476 ++ dst = NULL;
1477 + rcu_read_unlock();
1478 + return dst;
1479 + }
1480 +@@ -1793,9 +1793,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
1481 + static inline void
1482 + sk_dst_set(struct sock *sk, struct dst_entry *dst)
1483 + {
1484 +- spin_lock(&sk->sk_dst_lock);
1485 +- __sk_dst_set(sk, dst);
1486 +- spin_unlock(&sk->sk_dst_lock);
1487 ++ struct dst_entry *old_dst;
1488 ++
1489 ++ sk_tx_queue_clear(sk);
1490 ++ old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
1491 ++ dst_release(old_dst);
1492 + }
1493 +
1494 + static inline void
1495 +@@ -1807,9 +1809,7 @@ __sk_dst_reset(struct sock *sk)
1496 + static inline void
1497 + sk_dst_reset(struct sock *sk)
1498 + {
1499 +- spin_lock(&sk->sk_dst_lock);
1500 +- __sk_dst_reset(sk);
1501 +- spin_unlock(&sk->sk_dst_lock);
1502 ++ sk_dst_set(sk, NULL);
1503 + }
1504 +
1505 + struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1506 +diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
1507 +index d2b32ac27a39..ecee67a00f5f 100644
1508 +--- a/kernel/Kconfig.locks
1509 ++++ b/kernel/Kconfig.locks
1510 +@@ -220,6 +220,9 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE
1511 +
1512 + endif
1513 +
1514 ++config ARCH_SUPPORTS_ATOMIC_RMW
1515 ++ bool
1516 ++
1517 + config MUTEX_SPIN_ON_OWNER
1518 + def_bool y
1519 +- depends on SMP && !DEBUG_MUTEXES
1520 ++ depends on SMP && !DEBUG_MUTEXES && ARCH_SUPPORTS_ATOMIC_RMW
1521 +diff --git a/kernel/events/core.c b/kernel/events/core.c
1522 +index 0e7fea78f565..f774e9365a03 100644
1523 +--- a/kernel/events/core.c
1524 ++++ b/kernel/events/core.c
1525 +@@ -2311,7 +2311,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
1526 + next_parent = rcu_dereference(next_ctx->parent_ctx);
1527 +
1528 + /* If neither context have a parent context; they cannot be clones. */
1529 +- if (!parent && !next_parent)
1530 ++ if (!parent || !next_parent)
1531 + goto unlock;
1532 +
1533 + if (next_parent == ctx || next_ctx == parent || next_parent == parent) {
1534 +diff --git a/kernel/power/process.c b/kernel/power/process.c
1535 +index 06ec8869dbf1..14f9a8d4725d 100644
1536 +--- a/kernel/power/process.c
1537 ++++ b/kernel/power/process.c
1538 +@@ -184,6 +184,7 @@ void thaw_processes(void)
1539 +
1540 + printk("Restarting tasks ... ");
1541 +
1542 ++ __usermodehelper_set_disable_depth(UMH_FREEZING);
1543 + thaw_workqueues();
1544 +
1545 + read_lock(&tasklist_lock);
1546 +diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
1547 +index dd52e7ffb10e..183e8e5c38ba 100644
1548 +--- a/kernel/sched/debug.c
1549 ++++ b/kernel/sched/debug.c
1550 +@@ -608,7 +608,7 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
1551 +
1552 + avg_atom = p->se.sum_exec_runtime;
1553 + if (nr_switches)
1554 +- do_div(avg_atom, nr_switches);
1555 ++ avg_atom = div64_ul(avg_atom, nr_switches);
1556 + else
1557 + avg_atom = -1LL;
1558 +
1559 +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
1560 +index 88c9c65a430d..fe75444ae7ec 100644
1561 +--- a/kernel/time/alarmtimer.c
1562 ++++ b/kernel/time/alarmtimer.c
1563 +@@ -585,9 +585,14 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
1564 + struct itimerspec *new_setting,
1565 + struct itimerspec *old_setting)
1566 + {
1567 ++ ktime_t exp;
1568 ++
1569 + if (!rtcdev)
1570 + return -ENOTSUPP;
1571 +
1572 ++ if (flags & ~TIMER_ABSTIME)
1573 ++ return -EINVAL;
1574 ++
1575 + if (old_setting)
1576 + alarm_timer_get(timr, old_setting);
1577 +
1578 +@@ -597,8 +602,16 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
1579 +
1580 + /* start the timer */
1581 + timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval);
1582 +- alarm_start(&timr->it.alarm.alarmtimer,
1583 +- timespec_to_ktime(new_setting->it_value));
1584 ++ exp = timespec_to_ktime(new_setting->it_value);
1585 ++ /* Convert (if necessary) to absolute time */
1586 ++ if (flags != TIMER_ABSTIME) {
1587 ++ ktime_t now;
1588 ++
1589 ++ now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();
1590 ++ exp = ktime_add(now, exp);
1591 ++ }
1592 ++
1593 ++ alarm_start(&timr->it.alarm.alarmtimer, exp);
1594 + return 0;
1595 + }
1596 +
1597 +@@ -730,6 +743,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
1598 + if (!alarmtimer_get_rtcdev())
1599 + return -ENOTSUPP;
1600 +
1601 ++ if (flags & ~TIMER_ABSTIME)
1602 ++ return -EINVAL;
1603 ++
1604 + if (!capable(CAP_WAKE_ALARM))
1605 + return -EPERM;
1606 +
1607 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1608 +index 868633e61b43..e3be87edde33 100644
1609 +--- a/kernel/trace/ftrace.c
1610 ++++ b/kernel/trace/ftrace.c
1611 +@@ -331,12 +331,12 @@ static void update_ftrace_function(void)
1612 + func = ftrace_ops_list_func;
1613 + }
1614 +
1615 ++ update_function_graph_func();
1616 ++
1617 + /* If there's no change, then do nothing more here */
1618 + if (ftrace_trace_function == func)
1619 + return;
1620 +
1621 +- update_function_graph_func();
1622 +-
1623 + /*
1624 + * If we are using the list function, it doesn't care
1625 + * about the function_trace_ops.
1626 +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
1627 +index 04202d9aa514..0954450df7dc 100644
1628 +--- a/kernel/trace/ring_buffer.c
1629 ++++ b/kernel/trace/ring_buffer.c
1630 +@@ -616,10 +616,6 @@ int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
1631 + struct ring_buffer_per_cpu *cpu_buffer;
1632 + struct rb_irq_work *work;
1633 +
1634 +- if ((cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) ||
1635 +- (cpu != RING_BUFFER_ALL_CPUS && !ring_buffer_empty_cpu(buffer, cpu)))
1636 +- return POLLIN | POLLRDNORM;
1637 +-
1638 + if (cpu == RING_BUFFER_ALL_CPUS)
1639 + work = &buffer->irq_work;
1640 + else {
1641 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1642 +index 922657f30723..7e259b2bdf44 100644
1643 +--- a/kernel/trace/trace.c
1644 ++++ b/kernel/trace/trace.c
1645 +@@ -454,6 +454,12 @@ int __trace_puts(unsigned long ip, const char *str, int size)
1646 + struct print_entry *entry;
1647 + unsigned long irq_flags;
1648 + int alloc;
1649 ++ int pc;
1650 ++
1651 ++ if (!(trace_flags & TRACE_ITER_PRINTK))
1652 ++ return 0;
1653 ++
1654 ++ pc = preempt_count();
1655 +
1656 + if (unlikely(tracing_selftest_running || tracing_disabled))
1657 + return 0;
1658 +@@ -463,7 +469,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
1659 + local_save_flags(irq_flags);
1660 + buffer = global_trace.trace_buffer.buffer;
1661 + event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc,
1662 +- irq_flags, preempt_count());
1663 ++ irq_flags, pc);
1664 + if (!event)
1665 + return 0;
1666 +
1667 +@@ -480,6 +486,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
1668 + entry->buf[size] = '\0';
1669 +
1670 + __buffer_unlock_commit(buffer, event);
1671 ++ ftrace_trace_stack(buffer, irq_flags, 4, pc);
1672 +
1673 + return size;
1674 + }
1675 +@@ -497,6 +504,12 @@ int __trace_bputs(unsigned long ip, const char *str)
1676 + struct bputs_entry *entry;
1677 + unsigned long irq_flags;
1678 + int size = sizeof(struct bputs_entry);
1679 ++ int pc;
1680 ++
1681 ++ if (!(trace_flags & TRACE_ITER_PRINTK))
1682 ++ return 0;
1683 ++
1684 ++ pc = preempt_count();
1685 +
1686 + if (unlikely(tracing_selftest_running || tracing_disabled))
1687 + return 0;
1688 +@@ -504,7 +517,7 @@ int __trace_bputs(unsigned long ip, const char *str)
1689 + local_save_flags(irq_flags);
1690 + buffer = global_trace.trace_buffer.buffer;
1691 + event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
1692 +- irq_flags, preempt_count());
1693 ++ irq_flags, pc);
1694 + if (!event)
1695 + return 0;
1696 +
1697 +@@ -513,6 +526,7 @@ int __trace_bputs(unsigned long ip, const char *str)
1698 + entry->str = str;
1699 +
1700 + __buffer_unlock_commit(buffer, event);
1701 ++ ftrace_trace_stack(buffer, irq_flags, 4, pc);
1702 +
1703 + return 1;
1704 + }
1705 +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
1706 +index 7b16d40bd64d..e4c4efc4ba0d 100644
1707 +--- a/kernel/trace/trace_events.c
1708 ++++ b/kernel/trace/trace_events.c
1709 +@@ -439,6 +439,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file)
1710 +
1711 + list_del(&file->list);
1712 + remove_subsystem(file->system);
1713 ++ free_event_filter(file->filter);
1714 + kmem_cache_free(file_cachep, file);
1715 + }
1716 +
1717 +diff --git a/mm/shmem.c b/mm/shmem.c
1718 +index 1f18c9d0d93e..ff85863587ee 100644
1719 +--- a/mm/shmem.c
1720 ++++ b/mm/shmem.c
1721 +@@ -80,11 +80,12 @@ static struct vfsmount *shm_mnt;
1722 + #define SHORT_SYMLINK_LEN 128
1723 +
1724 + /*
1725 +- * shmem_fallocate and shmem_writepage communicate via inode->i_private
1726 +- * (with i_mutex making sure that it has only one user at a time):
1727 +- * we would prefer not to enlarge the shmem inode just for that.
1728 ++ * shmem_fallocate communicates with shmem_fault or shmem_writepage via
1729 ++ * inode->i_private (with i_mutex making sure that it has only one user at
1730 ++ * a time): we would prefer not to enlarge the shmem inode just for that.
1731 + */
1732 + struct shmem_falloc {
1733 ++ wait_queue_head_t *waitq; /* faults into hole wait for punch to end */
1734 + pgoff_t start; /* start of range currently being fallocated */
1735 + pgoff_t next; /* the next page offset to be fallocated */
1736 + pgoff_t nr_falloced; /* how many new pages have been fallocated */
1737 +@@ -533,22 +534,19 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
1738 + return;
1739 +
1740 + index = start;
1741 +- for ( ; ; ) {
1742 ++ while (index < end) {
1743 + cond_resched();
1744 + pvec.nr = shmem_find_get_pages_and_swap(mapping, index,
1745 + min(end - index, (pgoff_t)PAGEVEC_SIZE),
1746 + pvec.pages, indices);
1747 + if (!pvec.nr) {
1748 +- if (index == start || unfalloc)
1749 ++ /* If all gone or hole-punch or unfalloc, we're done */
1750 ++ if (index == start || end != -1)
1751 + break;
1752 ++ /* But if truncating, restart to make sure all gone */
1753 + index = start;
1754 + continue;
1755 + }
1756 +- if ((index == start || unfalloc) && indices[0] >= end) {
1757 +- shmem_deswap_pagevec(&pvec);
1758 +- pagevec_release(&pvec);
1759 +- break;
1760 +- }
1761 + mem_cgroup_uncharge_start();
1762 + for (i = 0; i < pagevec_count(&pvec); i++) {
1763 + struct page *page = pvec.pages[i];
1764 +@@ -560,8 +558,12 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
1765 + if (radix_tree_exceptional_entry(page)) {
1766 + if (unfalloc)
1767 + continue;
1768 +- nr_swaps_freed += !shmem_free_swap(mapping,
1769 +- index, page);
1770 ++ if (shmem_free_swap(mapping, index, page)) {
1771 ++ /* Swap was replaced by page: retry */
1772 ++ index--;
1773 ++ break;
1774 ++ }
1775 ++ nr_swaps_freed++;
1776 + continue;
1777 + }
1778 +
1779 +@@ -570,6 +572,11 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
1780 + if (page->mapping == mapping) {
1781 + VM_BUG_ON_PAGE(PageWriteback(page), page);
1782 + truncate_inode_page(mapping, page);
1783 ++ } else {
1784 ++ /* Page was replaced by swap: retry */
1785 ++ unlock_page(page);
1786 ++ index--;
1787 ++ break;
1788 + }
1789 + }
1790 + unlock_page(page);
1791 +@@ -824,6 +831,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
1792 + spin_lock(&inode->i_lock);
1793 + shmem_falloc = inode->i_private;
1794 + if (shmem_falloc &&
1795 ++ !shmem_falloc->waitq &&
1796 + index >= shmem_falloc->start &&
1797 + index < shmem_falloc->next)
1798 + shmem_falloc->nr_unswapped++;
1799 +@@ -1298,6 +1306,64 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1800 + int error;
1801 + int ret = VM_FAULT_LOCKED;
1802 +
1803 ++ /*
1804 ++ * Trinity finds that probing a hole which tmpfs is punching can
1805 ++ * prevent the hole-punch from ever completing: which in turn
1806 ++ * locks writers out with its hold on i_mutex. So refrain from
1807 ++ * faulting pages into the hole while it's being punched. Although
1808 ++ * shmem_undo_range() does remove the additions, it may be unable to
1809 ++ * keep up, as each new page needs its own unmap_mapping_range() call,
1810 ++ * and the i_mmap tree grows ever slower to scan if new vmas are added.
1811 ++ *
1812 ++ * It does not matter if we sometimes reach this check just before the
1813 ++ * hole-punch begins, so that one fault then races with the punch:
1814 ++ * we just need to make racing faults a rare case.
1815 ++ *
1816 ++ * The implementation below would be much simpler if we just used a
1817 ++ * standard mutex or completion: but we cannot take i_mutex in fault,
1818 ++ * and bloating every shmem inode for this unlikely case would be sad.
1819 ++ */
1820 ++ if (unlikely(inode->i_private)) {
1821 ++ struct shmem_falloc *shmem_falloc;
1822 ++
1823 ++ spin_lock(&inode->i_lock);
1824 ++ shmem_falloc = inode->i_private;
1825 ++ if (shmem_falloc &&
1826 ++ shmem_falloc->waitq &&
1827 ++ vmf->pgoff >= shmem_falloc->start &&
1828 ++ vmf->pgoff < shmem_falloc->next) {
1829 ++ wait_queue_head_t *shmem_falloc_waitq;
1830 ++ DEFINE_WAIT(shmem_fault_wait);
1831 ++
1832 ++ ret = VM_FAULT_NOPAGE;
1833 ++ if ((vmf->flags & FAULT_FLAG_ALLOW_RETRY) &&
1834 ++ !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
1835 ++ /* It's polite to up mmap_sem if we can */
1836 ++ up_read(&vma->vm_mm->mmap_sem);
1837 ++ ret = VM_FAULT_RETRY;
1838 ++ }
1839 ++
1840 ++ shmem_falloc_waitq = shmem_falloc->waitq;
1841 ++ prepare_to_wait(shmem_falloc_waitq, &shmem_fault_wait,
1842 ++ TASK_UNINTERRUPTIBLE);
1843 ++ spin_unlock(&inode->i_lock);
1844 ++ schedule();
1845 ++
1846 ++ /*
1847 ++ * shmem_falloc_waitq points into the shmem_fallocate()
1848 ++ * stack of the hole-punching task: shmem_falloc_waitq
1849 ++ * is usually invalid by the time we reach here, but
1850 ++ * finish_wait() does not dereference it in that case;
1851 ++ * though i_lock needed lest racing with wake_up_all().
1852 ++ */
1853 ++ spin_lock(&inode->i_lock);
1854 ++ finish_wait(shmem_falloc_waitq, &shmem_fault_wait);
1855 ++ spin_unlock(&inode->i_lock);
1856 ++ return ret;
1857 ++ }
1858 ++ spin_unlock(&inode->i_lock);
1859 ++ }
1860 ++
1861 + error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret);
1862 + if (error)
1863 + return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS);
1864 +@@ -1817,12 +1883,25 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
1865 + struct address_space *mapping = file->f_mapping;
1866 + loff_t unmap_start = round_up(offset, PAGE_SIZE);
1867 + loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1;
1868 ++ DECLARE_WAIT_QUEUE_HEAD_ONSTACK(shmem_falloc_waitq);
1869 ++
1870 ++ shmem_falloc.waitq = &shmem_falloc_waitq;
1871 ++ shmem_falloc.start = unmap_start >> PAGE_SHIFT;
1872 ++ shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT;
1873 ++ spin_lock(&inode->i_lock);
1874 ++ inode->i_private = &shmem_falloc;
1875 ++ spin_unlock(&inode->i_lock);
1876 +
1877 + if ((u64)unmap_end > (u64)unmap_start)
1878 + unmap_mapping_range(mapping, unmap_start,
1879 + 1 + unmap_end - unmap_start, 0);
1880 + shmem_truncate_range(inode, offset, offset + len - 1);
1881 + /* No need to unmap again: hole-punching leaves COWed pages */
1882 ++
1883 ++ spin_lock(&inode->i_lock);
1884 ++ inode->i_private = NULL;
1885 ++ wake_up_all(&shmem_falloc_waitq);
1886 ++ spin_unlock(&inode->i_lock);
1887 + error = 0;
1888 + goto out;
1889 + }
1890 +@@ -1840,6 +1919,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
1891 + goto out;
1892 + }
1893 +
1894 ++ shmem_falloc.waitq = NULL;
1895 + shmem_falloc.start = start;
1896 + shmem_falloc.next = start;
1897 + shmem_falloc.nr_falloced = 0;
1898 +diff --git a/mm/vmscan.c b/mm/vmscan.c
1899 +index 6ef876cae8f1..6ef484f0777f 100644
1900 +--- a/mm/vmscan.c
1901 ++++ b/mm/vmscan.c
1902 +@@ -1540,19 +1540,18 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
1903 + * If dirty pages are scanned that are not queued for IO, it
1904 + * implies that flushers are not keeping up. In this case, flag
1905 + * the zone ZONE_TAIL_LRU_DIRTY and kswapd will start writing
1906 +- * pages from reclaim context. It will forcibly stall in the
1907 +- * next check.
1908 ++ * pages from reclaim context.
1909 + */
1910 + if (nr_unqueued_dirty == nr_taken)
1911 + zone_set_flag(zone, ZONE_TAIL_LRU_DIRTY);
1912 +
1913 + /*
1914 +- * In addition, if kswapd scans pages marked marked for
1915 +- * immediate reclaim and under writeback (nr_immediate), it
1916 +- * implies that pages are cycling through the LRU faster than
1917 ++ * If kswapd scans pages marked marked for immediate
1918 ++ * reclaim and under writeback (nr_immediate), it implies
1919 ++ * that pages are cycling through the LRU faster than
1920 + * they are written so also forcibly stall.
1921 + */
1922 +- if (nr_unqueued_dirty == nr_taken || nr_immediate)
1923 ++ if (nr_immediate)
1924 + congestion_wait(BLK_RW_ASYNC, HZ/10);
1925 + }
1926 +
1927 +diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
1928 +index 6ee48aac776f..7e57135c7cc4 100644
1929 +--- a/net/8021q/vlan_core.c
1930 ++++ b/net/8021q/vlan_core.c
1931 +@@ -108,8 +108,11 @@ EXPORT_SYMBOL(vlan_dev_vlan_id);
1932 +
1933 + static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
1934 + {
1935 +- if (skb_cow(skb, skb_headroom(skb)) < 0)
1936 ++ if (skb_cow(skb, skb_headroom(skb)) < 0) {
1937 ++ kfree_skb(skb);
1938 + return NULL;
1939 ++ }
1940 ++
1941 + memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
1942 + skb->mac_header += VLAN_HLEN;
1943 + return skb;
1944 +diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
1945 +index cc0d21895420..1f26a1b8c576 100644
1946 +--- a/net/8021q/vlan_dev.c
1947 ++++ b/net/8021q/vlan_dev.c
1948 +@@ -635,8 +635,6 @@ static void vlan_dev_uninit(struct net_device *dev)
1949 + struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
1950 + int i;
1951 +
1952 +- free_percpu(vlan->vlan_pcpu_stats);
1953 +- vlan->vlan_pcpu_stats = NULL;
1954 + for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
1955 + while ((pm = vlan->egress_priority_map[i]) != NULL) {
1956 + vlan->egress_priority_map[i] = pm->next;
1957 +@@ -796,6 +794,15 @@ static const struct net_device_ops vlan_netdev_ops = {
1958 + .ndo_get_lock_subclass = vlan_dev_get_lock_subclass,
1959 + };
1960 +
1961 ++static void vlan_dev_free(struct net_device *dev)
1962 ++{
1963 ++ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
1964 ++
1965 ++ free_percpu(vlan->vlan_pcpu_stats);
1966 ++ vlan->vlan_pcpu_stats = NULL;
1967 ++ free_netdev(dev);
1968 ++}
1969 ++
1970 + void vlan_setup(struct net_device *dev)
1971 + {
1972 + ether_setup(dev);
1973 +@@ -805,7 +812,7 @@ void vlan_setup(struct net_device *dev)
1974 + dev->tx_queue_len = 0;
1975 +
1976 + dev->netdev_ops = &vlan_netdev_ops;
1977 +- dev->destructor = free_netdev;
1978 ++ dev->destructor = vlan_dev_free;
1979 + dev->ethtool_ops = &vlan_ethtool_ops;
1980 +
1981 + memset(dev->broadcast, 0, ETH_ALEN);
1982 +diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
1983 +index 02806c6b2ff3..0c769cc65f25 100644
1984 +--- a/net/appletalk/ddp.c
1985 ++++ b/net/appletalk/ddp.c
1986 +@@ -1489,8 +1489,6 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1987 + goto drop;
1988 +
1989 + /* Queue packet (standard) */
1990 +- skb->sk = sock;
1991 +-
1992 + if (sock_queue_rcv_skb(sock, skb) < 0)
1993 + goto drop;
1994 +
1995 +@@ -1644,7 +1642,6 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
1996 + if (!skb)
1997 + goto out;
1998 +
1999 +- skb->sk = sk;
2000 + skb_reserve(skb, ddp_dl->header_length);
2001 + skb_reserve(skb, dev->hard_header_len);
2002 + skb->dev = dev;
2003 +diff --git a/net/core/dev.c b/net/core/dev.c
2004 +index 4c1b483f7c07..37bddf729e77 100644
2005 +--- a/net/core/dev.c
2006 ++++ b/net/core/dev.c
2007 +@@ -148,6 +148,9 @@ struct list_head ptype_all __read_mostly; /* Taps */
2008 + static struct list_head offload_base __read_mostly;
2009 +
2010 + static int netif_rx_internal(struct sk_buff *skb);
2011 ++static int call_netdevice_notifiers_info(unsigned long val,
2012 ++ struct net_device *dev,
2013 ++ struct netdev_notifier_info *info);
2014 +
2015 + /*
2016 + * The @dev_base_head list is protected by @dev_base_lock and the rtnl
2017 +@@ -1207,7 +1210,11 @@ EXPORT_SYMBOL(netdev_features_change);
2018 + void netdev_state_change(struct net_device *dev)
2019 + {
2020 + if (dev->flags & IFF_UP) {
2021 +- call_netdevice_notifiers(NETDEV_CHANGE, dev);
2022 ++ struct netdev_notifier_change_info change_info;
2023 ++
2024 ++ change_info.flags_changed = 0;
2025 ++ call_netdevice_notifiers_info(NETDEV_CHANGE, dev,
2026 ++ &change_info.info);
2027 + rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
2028 + }
2029 + }
2030 +@@ -4051,6 +4058,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
2031 + skb->vlan_tci = 0;
2032 + skb->dev = napi->dev;
2033 + skb->skb_iif = 0;
2034 ++ skb->encapsulation = 0;
2035 ++ skb_shinfo(skb)->gso_type = 0;
2036 + skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
2037 +
2038 + napi->skb = skb;
2039 +diff --git a/net/core/dst.c b/net/core/dst.c
2040 +index ca4231ec7347..15b6792e6ebb 100644
2041 +--- a/net/core/dst.c
2042 ++++ b/net/core/dst.c
2043 +@@ -267,6 +267,15 @@ again:
2044 + }
2045 + EXPORT_SYMBOL(dst_destroy);
2046 +
2047 ++static void dst_destroy_rcu(struct rcu_head *head)
2048 ++{
2049 ++ struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head);
2050 ++
2051 ++ dst = dst_destroy(dst);
2052 ++ if (dst)
2053 ++ __dst_free(dst);
2054 ++}
2055 ++
2056 + void dst_release(struct dst_entry *dst)
2057 + {
2058 + if (dst) {
2059 +@@ -274,11 +283,8 @@ void dst_release(struct dst_entry *dst)
2060 +
2061 + newrefcnt = atomic_dec_return(&dst->__refcnt);
2062 + WARN_ON(newrefcnt < 0);
2063 +- if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) {
2064 +- dst = dst_destroy(dst);
2065 +- if (dst)
2066 +- __dst_free(dst);
2067 +- }
2068 ++ if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
2069 ++ call_rcu(&dst->rcu_head, dst_destroy_rcu);
2070 + }
2071 + }
2072 + EXPORT_SYMBOL(dst_release);
2073 +diff --git a/net/core/skbuff.c b/net/core/skbuff.c
2074 +index e5ae776ee9b4..7f2e1fce706e 100644
2075 +--- a/net/core/skbuff.c
2076 ++++ b/net/core/skbuff.c
2077 +@@ -2881,12 +2881,13 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
2078 + int pos;
2079 + int dummy;
2080 +
2081 ++ __skb_push(head_skb, doffset);
2082 + proto = skb_network_protocol(head_skb, &dummy);
2083 + if (unlikely(!proto))
2084 + return ERR_PTR(-EINVAL);
2085 +
2086 + csum = !!can_checksum_protocol(features, proto);
2087 +- __skb_push(head_skb, doffset);
2088 ++
2089 + headroom = skb_headroom(head_skb);
2090 + pos = skb_headlen(head_skb);
2091 +
2092 +diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
2093 +index e7b6d53eef88..f005cc760535 100644
2094 +--- a/net/dns_resolver/dns_query.c
2095 ++++ b/net/dns_resolver/dns_query.c
2096 +@@ -149,7 +149,9 @@ int dns_query(const char *type, const char *name, size_t namelen,
2097 + if (!*_result)
2098 + goto put;
2099 +
2100 +- memcpy(*_result, upayload->data, len + 1);
2101 ++ memcpy(*_result, upayload->data, len);
2102 ++ (*_result)[len] = '\0';
2103 ++
2104 + if (_expiry)
2105 + *_expiry = rkey->expiry;
2106 +
2107 +diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
2108 +index 19ab78aca547..07bd8edef417 100644
2109 +--- a/net/ipv4/af_inet.c
2110 ++++ b/net/ipv4/af_inet.c
2111 +@@ -1434,6 +1434,9 @@ static int inet_gro_complete(struct sk_buff *skb, int nhoff)
2112 + int proto = iph->protocol;
2113 + int err = -ENOSYS;
2114 +
2115 ++ if (skb->encapsulation)
2116 ++ skb_set_inner_network_header(skb, nhoff);
2117 ++
2118 + csum_replace2(&iph->check, iph->tot_len, newlen);
2119 + iph->tot_len = newlen;
2120 +
2121 +diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
2122 +index f1d32280cb54..2d24f293f977 100644
2123 +--- a/net/ipv4/gre_offload.c
2124 ++++ b/net/ipv4/gre_offload.c
2125 +@@ -255,6 +255,9 @@ static int gre_gro_complete(struct sk_buff *skb, int nhoff)
2126 + int err = -ENOENT;
2127 + __be16 type;
2128 +
2129 ++ skb->encapsulation = 1;
2130 ++ skb_shinfo(skb)->gso_type = SKB_GSO_GRE;
2131 ++
2132 + type = greh->protocol;
2133 + if (greh->flags & GRE_KEY)
2134 + grehlen += GRE_HEADER_SECTION;
2135 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2136 +index 0134663fdbce..1e4aa8354f93 100644
2137 +--- a/net/ipv4/icmp.c
2138 ++++ b/net/ipv4/icmp.c
2139 +@@ -732,8 +732,6 @@ static void icmp_unreach(struct sk_buff *skb)
2140 + /* fall through */
2141 + case 0:
2142 + info = ntohs(icmph->un.frag.mtu);
2143 +- if (!info)
2144 +- goto out;
2145 + }
2146 + break;
2147 + case ICMP_SR_FAILED:
2148 +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
2149 +index 97e4d1655d26..9db3b877fcaf 100644
2150 +--- a/net/ipv4/igmp.c
2151 ++++ b/net/ipv4/igmp.c
2152 +@@ -1952,6 +1952,10 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
2153 +
2154 + rtnl_lock();
2155 + in_dev = ip_mc_find_dev(net, imr);
2156 ++ if (!in_dev) {
2157 ++ ret = -ENODEV;
2158 ++ goto out;
2159 ++ }
2160 + ifindex = imr->imr_ifindex;
2161 + for (imlp = &inet->mc_list;
2162 + (iml = rtnl_dereference(*imlp)) != NULL;
2163 +@@ -1969,16 +1973,14 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
2164 +
2165 + *imlp = iml->next_rcu;
2166 +
2167 +- if (in_dev)
2168 +- ip_mc_dec_group(in_dev, group);
2169 ++ ip_mc_dec_group(in_dev, group);
2170 + rtnl_unlock();
2171 + /* decrease mem now to avoid the memleak warning */
2172 + atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
2173 + kfree_rcu(iml, rcu);
2174 + return 0;
2175 + }
2176 +- if (!in_dev)
2177 +- ret = -ENODEV;
2178 ++out:
2179 + rtnl_unlock();
2180 + return ret;
2181 + }
2182 +diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
2183 +index f4ab72e19af9..96f90b89df32 100644
2184 +--- a/net/ipv4/ip_options.c
2185 ++++ b/net/ipv4/ip_options.c
2186 +@@ -288,6 +288,10 @@ int ip_options_compile(struct net *net,
2187 + optptr++;
2188 + continue;
2189 + }
2190 ++ if (unlikely(l < 2)) {
2191 ++ pp_ptr = optptr;
2192 ++ goto error;
2193 ++ }
2194 + optlen = optptr[1];
2195 + if (optlen < 2 || optlen > l) {
2196 + pp_ptr = optptr;
2197 +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
2198 +index 0c3a5d17b4a9..62cd9e0ae35b 100644
2199 +--- a/net/ipv4/ip_tunnel.c
2200 ++++ b/net/ipv4/ip_tunnel.c
2201 +@@ -73,12 +73,7 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst,
2202 + {
2203 + struct dst_entry *old_dst;
2204 +
2205 +- if (dst) {
2206 +- if (dst->flags & DST_NOCACHE)
2207 +- dst = NULL;
2208 +- else
2209 +- dst_clone(dst);
2210 +- }
2211 ++ dst_clone(dst);
2212 + old_dst = xchg((__force struct dst_entry **)&idst->dst, dst);
2213 + dst_release(old_dst);
2214 + }
2215 +@@ -108,13 +103,14 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie)
2216 +
2217 + rcu_read_lock();
2218 + dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst);
2219 ++ if (dst && !atomic_inc_not_zero(&dst->__refcnt))
2220 ++ dst = NULL;
2221 + if (dst) {
2222 + if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
2223 +- rcu_read_unlock();
2224 + tunnel_dst_reset(t);
2225 +- return NULL;
2226 ++ dst_release(dst);
2227 ++ dst = NULL;
2228 + }
2229 +- dst_hold(dst);
2230 + }
2231 + rcu_read_unlock();
2232 + return (struct rtable *)dst;
2233 +@@ -173,6 +169,7 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2234 +
2235 + hlist_for_each_entry_rcu(t, head, hash_node) {
2236 + if (remote != t->parms.iph.daddr ||
2237 ++ t->parms.iph.saddr != 0 ||
2238 + !(t->dev->flags & IFF_UP))
2239 + continue;
2240 +
2241 +@@ -189,10 +186,11 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2242 + head = &itn->tunnels[hash];
2243 +
2244 + hlist_for_each_entry_rcu(t, head, hash_node) {
2245 +- if ((local != t->parms.iph.saddr &&
2246 +- (local != t->parms.iph.daddr ||
2247 +- !ipv4_is_multicast(local))) ||
2248 +- !(t->dev->flags & IFF_UP))
2249 ++ if ((local != t->parms.iph.saddr || t->parms.iph.daddr != 0) &&
2250 ++ (local != t->parms.iph.daddr || !ipv4_is_multicast(local)))
2251 ++ continue;
2252 ++
2253 ++ if (!(t->dev->flags & IFF_UP))
2254 + continue;
2255 +
2256 + if (!ip_tunnel_key_match(&t->parms, flags, key))
2257 +@@ -209,6 +207,8 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
2258 +
2259 + hlist_for_each_entry_rcu(t, head, hash_node) {
2260 + if (t->parms.i_key != key ||
2261 ++ t->parms.iph.saddr != 0 ||
2262 ++ t->parms.iph.daddr != 0 ||
2263 + !(t->dev->flags & IFF_UP))
2264 + continue;
2265 +
2266 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
2267 +index 134437309b1e..031553f8a306 100644
2268 +--- a/net/ipv4/route.c
2269 ++++ b/net/ipv4/route.c
2270 +@@ -1029,7 +1029,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2271 + const struct iphdr *iph = (const struct iphdr *) skb->data;
2272 + struct flowi4 fl4;
2273 + struct rtable *rt;
2274 +- struct dst_entry *dst;
2275 ++ struct dst_entry *odst = NULL;
2276 + bool new = false;
2277 +
2278 + bh_lock_sock(sk);
2279 +@@ -1037,16 +1037,17 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2280 + if (!ip_sk_accept_pmtu(sk))
2281 + goto out;
2282 +
2283 +- rt = (struct rtable *) __sk_dst_get(sk);
2284 ++ odst = sk_dst_get(sk);
2285 +
2286 +- if (sock_owned_by_user(sk) || !rt) {
2287 ++ if (sock_owned_by_user(sk) || !odst) {
2288 + __ipv4_sk_update_pmtu(skb, sk, mtu);
2289 + goto out;
2290 + }
2291 +
2292 + __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
2293 +
2294 +- if (!__sk_dst_check(sk, 0)) {
2295 ++ rt = (struct rtable *)odst;
2296 ++ if (odst->obsolete && odst->ops->check(odst, 0) == NULL) {
2297 + rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
2298 + if (IS_ERR(rt))
2299 + goto out;
2300 +@@ -1056,8 +1057,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2301 +
2302 + __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu);
2303 +
2304 +- dst = dst_check(&rt->dst, 0);
2305 +- if (!dst) {
2306 ++ if (!dst_check(&rt->dst, 0)) {
2307 + if (new)
2308 + dst_release(&rt->dst);
2309 +
2310 +@@ -1069,10 +1069,11 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
2311 + }
2312 +
2313 + if (new)
2314 +- __sk_dst_set(sk, &rt->dst);
2315 ++ sk_dst_set(sk, &rt->dst);
2316 +
2317 + out:
2318 + bh_unlock_sock(sk);
2319 ++ dst_release(odst);
2320 + }
2321 + EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu);
2322 +
2323 +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
2324 +index 97c8f5620c43..b48fba0aaa92 100644
2325 +--- a/net/ipv4/tcp.c
2326 ++++ b/net/ipv4/tcp.c
2327 +@@ -1108,7 +1108,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
2328 + if (unlikely(tp->repair)) {
2329 + if (tp->repair_queue == TCP_RECV_QUEUE) {
2330 + copied = tcp_send_rcvq(sk, msg, size);
2331 +- goto out;
2332 ++ goto out_nopush;
2333 + }
2334 +
2335 + err = -EINVAL;
2336 +@@ -1282,6 +1282,7 @@ wait_for_memory:
2337 + out:
2338 + if (copied)
2339 + tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
2340 ++out_nopush:
2341 + release_sock(sk);
2342 + return copied + copied_syn;
2343 +
2344 +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2345 +index e3647465138b..3898694d0300 100644
2346 +--- a/net/ipv4/tcp_input.c
2347 ++++ b/net/ipv4/tcp_input.c
2348 +@@ -1113,7 +1113,7 @@ static bool tcp_check_dsack(struct sock *sk, const struct sk_buff *ack_skb,
2349 + }
2350 +
2351 + /* D-SACK for already forgotten data... Do dumb counting. */
2352 +- if (dup_sack && tp->undo_marker && tp->undo_retrans &&
2353 ++ if (dup_sack && tp->undo_marker && tp->undo_retrans > 0 &&
2354 + !after(end_seq_0, prior_snd_una) &&
2355 + after(end_seq_0, tp->undo_marker))
2356 + tp->undo_retrans--;
2357 +@@ -1169,7 +1169,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb,
2358 + unsigned int new_len = (pkt_len / mss) * mss;
2359 + if (!in_sack && new_len < pkt_len) {
2360 + new_len += mss;
2361 +- if (new_len > skb->len)
2362 ++ if (new_len >= skb->len)
2363 + return 0;
2364 + }
2365 + pkt_len = new_len;
2366 +@@ -1193,7 +1193,7 @@ static u8 tcp_sacktag_one(struct sock *sk,
2367 +
2368 + /* Account D-SACK for retransmitted packet. */
2369 + if (dup_sack && (sacked & TCPCB_RETRANS)) {
2370 +- if (tp->undo_marker && tp->undo_retrans &&
2371 ++ if (tp->undo_marker && tp->undo_retrans > 0 &&
2372 + after(end_seq, tp->undo_marker))
2373 + tp->undo_retrans--;
2374 + if (sacked & TCPCB_SACKED_ACKED)
2375 +@@ -1894,7 +1894,7 @@ static void tcp_clear_retrans_partial(struct tcp_sock *tp)
2376 + tp->lost_out = 0;
2377 +
2378 + tp->undo_marker = 0;
2379 +- tp->undo_retrans = 0;
2380 ++ tp->undo_retrans = -1;
2381 + }
2382 +
2383 + void tcp_clear_retrans(struct tcp_sock *tp)
2384 +@@ -2663,7 +2663,7 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)
2385 +
2386 + tp->prior_ssthresh = 0;
2387 + tp->undo_marker = tp->snd_una;
2388 +- tp->undo_retrans = tp->retrans_out;
2389 ++ tp->undo_retrans = tp->retrans_out ? : -1;
2390 +
2391 + if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
2392 + if (!ece_ack)
2393 +diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
2394 +index b92b81718ca4..c25953a386d0 100644
2395 +--- a/net/ipv4/tcp_offload.c
2396 ++++ b/net/ipv4/tcp_offload.c
2397 +@@ -310,7 +310,7 @@ static int tcp4_gro_complete(struct sk_buff *skb, int thoff)
2398 +
2399 + th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr,
2400 + iph->daddr, 0);
2401 +- skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
2402 ++ skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
2403 +
2404 + return tcp_gro_complete(skb);
2405 + }
2406 +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
2407 +index 17a11e65e57f..b3d1addd816b 100644
2408 +--- a/net/ipv4/tcp_output.c
2409 ++++ b/net/ipv4/tcp_output.c
2410 +@@ -2448,8 +2448,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
2411 + if (!tp->retrans_stamp)
2412 + tp->retrans_stamp = TCP_SKB_CB(skb)->when;
2413 +
2414 +- tp->undo_retrans += tcp_skb_pcount(skb);
2415 +-
2416 + /* snd_nxt is stored to detect loss of retransmitted segment,
2417 + * see tcp_input.c tcp_sacktag_write_queue().
2418 + */
2419 +@@ -2457,6 +2455,10 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
2420 + } else {
2421 + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);
2422 + }
2423 ++
2424 ++ if (tp->undo_retrans < 0)
2425 ++ tp->undo_retrans = 0;
2426 ++ tp->undo_retrans += tcp_skb_pcount(skb);
2427 + return err;
2428 + }
2429 +
2430 +diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c
2431 +index 8517d3cd1aed..01b0ff9a0c2c 100644
2432 +--- a/net/ipv6/tcpv6_offload.c
2433 ++++ b/net/ipv6/tcpv6_offload.c
2434 +@@ -73,7 +73,7 @@ static int tcp6_gro_complete(struct sk_buff *skb, int thoff)
2435 +
2436 + th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr,
2437 + &iph->daddr, 0);
2438 +- skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
2439 ++ skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6;
2440 +
2441 + return tcp_gro_complete(skb);
2442 + }
2443 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
2444 +index 7f40fd25acae..0dfe894afd48 100644
2445 +--- a/net/netlink/af_netlink.c
2446 ++++ b/net/netlink/af_netlink.c
2447 +@@ -636,7 +636,7 @@ static unsigned int netlink_poll(struct file *file, struct socket *sock,
2448 + while (nlk->cb_running && netlink_dump_space(nlk)) {
2449 + err = netlink_dump(sk);
2450 + if (err < 0) {
2451 +- sk->sk_err = err;
2452 ++ sk->sk_err = -err;
2453 + sk->sk_error_report(sk);
2454 + break;
2455 + }
2456 +@@ -2448,7 +2448,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
2457 + atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
2458 + ret = netlink_dump(sk);
2459 + if (ret) {
2460 +- sk->sk_err = ret;
2461 ++ sk->sk_err = -ret;
2462 + sk->sk_error_report(sk);
2463 + }
2464 + }
2465 +diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
2466 +index c82fdc1eab7c..dfa532f00d88 100644
2467 +--- a/net/sctp/sysctl.c
2468 ++++ b/net/sctp/sysctl.c
2469 +@@ -307,41 +307,40 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,
2470 + loff_t *ppos)
2471 + {
2472 + struct net *net = current->nsproxy->net_ns;
2473 +- char tmp[8];
2474 + struct ctl_table tbl;
2475 +- int ret;
2476 +- int changed = 0;
2477 ++ bool changed = false;
2478 + char *none = "none";
2479 ++ char tmp[8];
2480 ++ int ret;
2481 +
2482 + memset(&tbl, 0, sizeof(struct ctl_table));
2483 +
2484 + if (write) {
2485 + tbl.data = tmp;
2486 +- tbl.maxlen = 8;
2487 ++ tbl.maxlen = sizeof(tmp);
2488 + } else {
2489 + tbl.data = net->sctp.sctp_hmac_alg ? : none;
2490 + tbl.maxlen = strlen(tbl.data);
2491 + }
2492 +- ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
2493 +
2494 +- if (write) {
2495 ++ ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
2496 ++ if (write && ret == 0) {
2497 + #ifdef CONFIG_CRYPTO_MD5
2498 + if (!strncmp(tmp, "md5", 3)) {
2499 + net->sctp.sctp_hmac_alg = "md5";
2500 +- changed = 1;
2501 ++ changed = true;
2502 + }
2503 + #endif
2504 + #ifdef CONFIG_CRYPTO_SHA1
2505 + if (!strncmp(tmp, "sha1", 4)) {
2506 + net->sctp.sctp_hmac_alg = "sha1";
2507 +- changed = 1;
2508 ++ changed = true;
2509 + }
2510 + #endif
2511 + if (!strncmp(tmp, "none", 4)) {
2512 + net->sctp.sctp_hmac_alg = NULL;
2513 +- changed = 1;
2514 ++ changed = true;
2515 + }
2516 +-
2517 + if (!changed)
2518 + ret = -EINVAL;
2519 + }
2520 +@@ -354,11 +353,10 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
2521 + loff_t *ppos)
2522 + {
2523 + struct net *net = current->nsproxy->net_ns;
2524 +- int new_value;
2525 +- struct ctl_table tbl;
2526 + unsigned int min = *(unsigned int *) ctl->extra1;
2527 + unsigned int max = *(unsigned int *) ctl->extra2;
2528 +- int ret;
2529 ++ struct ctl_table tbl;
2530 ++ int ret, new_value;
2531 +
2532 + memset(&tbl, 0, sizeof(struct ctl_table));
2533 + tbl.maxlen = sizeof(unsigned int);
2534 +@@ -367,12 +365,15 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
2535 + tbl.data = &new_value;
2536 + else
2537 + tbl.data = &net->sctp.rto_min;
2538 ++
2539 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
2540 +- if (write) {
2541 +- if (ret || new_value > max || new_value < min)
2542 ++ if (write && ret == 0) {
2543 ++ if (new_value > max || new_value < min)
2544 + return -EINVAL;
2545 ++
2546 + net->sctp.rto_min = new_value;
2547 + }
2548 ++
2549 + return ret;
2550 + }
2551 +
2552 +@@ -381,11 +382,10 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
2553 + loff_t *ppos)
2554 + {
2555 + struct net *net = current->nsproxy->net_ns;
2556 +- int new_value;
2557 +- struct ctl_table tbl;
2558 + unsigned int min = *(unsigned int *) ctl->extra1;
2559 + unsigned int max = *(unsigned int *) ctl->extra2;
2560 +- int ret;
2561 ++ struct ctl_table tbl;
2562 ++ int ret, new_value;
2563 +
2564 + memset(&tbl, 0, sizeof(struct ctl_table));
2565 + tbl.maxlen = sizeof(unsigned int);
2566 +@@ -394,12 +394,15 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
2567 + tbl.data = &new_value;
2568 + else
2569 + tbl.data = &net->sctp.rto_max;
2570 ++
2571 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
2572 +- if (write) {
2573 +- if (ret || new_value > max || new_value < min)
2574 ++ if (write && ret == 0) {
2575 ++ if (new_value > max || new_value < min)
2576 + return -EINVAL;
2577 ++
2578 + net->sctp.rto_max = new_value;
2579 + }
2580 ++
2581 + return ret;
2582 + }
2583 +
2584 +@@ -420,8 +423,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
2585 + tbl.data = &net->sctp.auth_enable;
2586 +
2587 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
2588 +-
2589 +- if (write) {
2590 ++ if (write && ret == 0) {
2591 + struct sock *sk = net->sctp.ctl_sock;
2592 +
2593 + net->sctp.auth_enable = new_value;
2594 +diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
2595 +index 85c64658bd0b..b6842fdb53d4 100644
2596 +--- a/net/sctp/ulpevent.c
2597 ++++ b/net/sctp/ulpevent.c
2598 +@@ -366,9 +366,10 @@ fail:
2599 + * specification [SCTP] and any extensions for a list of possible
2600 + * error formats.
2601 + */
2602 +-struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
2603 +- const struct sctp_association *asoc, struct sctp_chunk *chunk,
2604 +- __u16 flags, gfp_t gfp)
2605 ++struct sctp_ulpevent *
2606 ++sctp_ulpevent_make_remote_error(const struct sctp_association *asoc,
2607 ++ struct sctp_chunk *chunk, __u16 flags,
2608 ++ gfp_t gfp)
2609 + {
2610 + struct sctp_ulpevent *event;
2611 + struct sctp_remote_error *sre;
2612 +@@ -387,8 +388,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
2613 + /* Copy the skb to a new skb with room for us to prepend
2614 + * notification with.
2615 + */
2616 +- skb = skb_copy_expand(chunk->skb, sizeof(struct sctp_remote_error),
2617 +- 0, gfp);
2618 ++ skb = skb_copy_expand(chunk->skb, sizeof(*sre), 0, gfp);
2619 +
2620 + /* Pull off the rest of the cause TLV from the chunk. */
2621 + skb_pull(chunk->skb, elen);
2622 +@@ -399,62 +399,21 @@ struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
2623 + event = sctp_skb2event(skb);
2624 + sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
2625 +
2626 +- sre = (struct sctp_remote_error *)
2627 +- skb_push(skb, sizeof(struct sctp_remote_error));
2628 ++ sre = (struct sctp_remote_error *) skb_push(skb, sizeof(*sre));
2629 +
2630 + /* Trim the buffer to the right length. */
2631 +- skb_trim(skb, sizeof(struct sctp_remote_error) + elen);
2632 ++ skb_trim(skb, sizeof(*sre) + elen);
2633 +
2634 +- /* Socket Extensions for SCTP
2635 +- * 5.3.1.3 SCTP_REMOTE_ERROR
2636 +- *
2637 +- * sre_type:
2638 +- * It should be SCTP_REMOTE_ERROR.
2639 +- */
2640 ++ /* RFC6458, Section 6.1.3. SCTP_REMOTE_ERROR */
2641 ++ memset(sre, 0, sizeof(*sre));
2642 + sre->sre_type = SCTP_REMOTE_ERROR;
2643 +-
2644 +- /*
2645 +- * Socket Extensions for SCTP
2646 +- * 5.3.1.3 SCTP_REMOTE_ERROR
2647 +- *
2648 +- * sre_flags: 16 bits (unsigned integer)
2649 +- * Currently unused.
2650 +- */
2651 + sre->sre_flags = 0;
2652 +-
2653 +- /* Socket Extensions for SCTP
2654 +- * 5.3.1.3 SCTP_REMOTE_ERROR
2655 +- *
2656 +- * sre_length: sizeof (__u32)
2657 +- *
2658 +- * This field is the total length of the notification data,
2659 +- * including the notification header.
2660 +- */
2661 + sre->sre_length = skb->len;
2662 +-
2663 +- /* Socket Extensions for SCTP
2664 +- * 5.3.1.3 SCTP_REMOTE_ERROR
2665 +- *
2666 +- * sre_error: 16 bits (unsigned integer)
2667 +- * This value represents one of the Operational Error causes defined in
2668 +- * the SCTP specification, in network byte order.
2669 +- */
2670 + sre->sre_error = cause;
2671 +-
2672 +- /* Socket Extensions for SCTP
2673 +- * 5.3.1.3 SCTP_REMOTE_ERROR
2674 +- *
2675 +- * sre_assoc_id: sizeof (sctp_assoc_t)
2676 +- *
2677 +- * The association id field, holds the identifier for the association.
2678 +- * All notifications for a given association have the same association
2679 +- * identifier. For TCP style socket, this field is ignored.
2680 +- */
2681 + sctp_ulpevent_set_owner(event, asoc);
2682 + sre->sre_assoc_id = sctp_assoc2id(asoc);
2683 +
2684 + return event;
2685 +-
2686 + fail:
2687 + return NULL;
2688 + }
2689 +@@ -899,7 +858,9 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
2690 + return notification->sn_header.sn_type;
2691 + }
2692 +
2693 +-/* Copy out the sndrcvinfo into a msghdr. */
2694 ++/* RFC6458, Section 5.3.2. SCTP Header Information Structure
2695 ++ * (SCTP_SNDRCV, DEPRECATED)
2696 ++ */
2697 + void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
2698 + struct msghdr *msghdr)
2699 + {
2700 +@@ -908,74 +869,21 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
2701 + if (sctp_ulpevent_is_notification(event))
2702 + return;
2703 +
2704 +- /* Sockets API Extensions for SCTP
2705 +- * Section 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
2706 +- *
2707 +- * sinfo_stream: 16 bits (unsigned integer)
2708 +- *
2709 +- * For recvmsg() the SCTP stack places the message's stream number in
2710 +- * this value.
2711 +- */
2712 ++ memset(&sinfo, 0, sizeof(sinfo));
2713 + sinfo.sinfo_stream = event->stream;
2714 +- /* sinfo_ssn: 16 bits (unsigned integer)
2715 +- *
2716 +- * For recvmsg() this value contains the stream sequence number that
2717 +- * the remote endpoint placed in the DATA chunk. For fragmented
2718 +- * messages this is the same number for all deliveries of the message
2719 +- * (if more than one recvmsg() is needed to read the message).
2720 +- */
2721 + sinfo.sinfo_ssn = event->ssn;
2722 +- /* sinfo_ppid: 32 bits (unsigned integer)
2723 +- *
2724 +- * In recvmsg() this value is
2725 +- * the same information that was passed by the upper layer in the peer
2726 +- * application. Please note that byte order issues are NOT accounted
2727 +- * for and this information is passed opaquely by the SCTP stack from
2728 +- * one end to the other.
2729 +- */
2730 + sinfo.sinfo_ppid = event->ppid;
2731 +- /* sinfo_flags: 16 bits (unsigned integer)
2732 +- *
2733 +- * This field may contain any of the following flags and is composed of
2734 +- * a bitwise OR of these values.
2735 +- *
2736 +- * recvmsg() flags:
2737 +- *
2738 +- * SCTP_UNORDERED - This flag is present when the message was sent
2739 +- * non-ordered.
2740 +- */
2741 + sinfo.sinfo_flags = event->flags;
2742 +- /* sinfo_tsn: 32 bit (unsigned integer)
2743 +- *
2744 +- * For the receiving side, this field holds a TSN that was
2745 +- * assigned to one of the SCTP Data Chunks.
2746 +- */
2747 + sinfo.sinfo_tsn = event->tsn;
2748 +- /* sinfo_cumtsn: 32 bit (unsigned integer)
2749 +- *
2750 +- * This field will hold the current cumulative TSN as
2751 +- * known by the underlying SCTP layer. Note this field is
2752 +- * ignored when sending and only valid for a receive
2753 +- * operation when sinfo_flags are set to SCTP_UNORDERED.
2754 +- */
2755 + sinfo.sinfo_cumtsn = event->cumtsn;
2756 +- /* sinfo_assoc_id: sizeof (sctp_assoc_t)
2757 +- *
2758 +- * The association handle field, sinfo_assoc_id, holds the identifier
2759 +- * for the association announced in the COMMUNICATION_UP notification.
2760 +- * All notifications for a given association have the same identifier.
2761 +- * Ignored for one-to-one style sockets.
2762 +- */
2763 + sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc);
2764 +-
2765 +- /* context value that is set via SCTP_CONTEXT socket option. */
2766 ++ /* Context value that is set via SCTP_CONTEXT socket option. */
2767 + sinfo.sinfo_context = event->asoc->default_rcv_context;
2768 +-
2769 + /* These fields are not used while receiving. */
2770 + sinfo.sinfo_timetolive = 0;
2771 +
2772 + put_cmsg(msghdr, IPPROTO_SCTP, SCTP_SNDRCV,
2773 +- sizeof(struct sctp_sndrcvinfo), (void *)&sinfo);
2774 ++ sizeof(sinfo), &sinfo);
2775 + }
2776 +
2777 + /* Do accounting for bytes received and hold a reference to the association
2778 +diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
2779 +index bf860d9e75af..3ca45bf5029f 100644
2780 +--- a/net/tipc/bcast.c
2781 ++++ b/net/tipc/bcast.c
2782 +@@ -537,6 +537,7 @@ receive:
2783 +
2784 + buf = node->bclink.deferred_head;
2785 + node->bclink.deferred_head = buf->next;
2786 ++ buf->next = NULL;
2787 + node->bclink.deferred_size--;
2788 + goto receive;
2789 + }
2790 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
2791 +index 22f7883fcb9a..7ec91424ba22 100644
2792 +--- a/sound/pci/hda/hda_intel.c
2793 ++++ b/sound/pci/hda/hda_intel.c
2794 +@@ -2930,7 +2930,7 @@ static int azx_suspend(struct device *dev)
2795 + struct azx *chip = card->private_data;
2796 + struct azx_pcm *p;
2797 +
2798 +- if (chip->disabled)
2799 ++ if (chip->disabled || chip->init_failed)
2800 + return 0;
2801 +
2802 + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2803 +@@ -2961,7 +2961,7 @@ static int azx_resume(struct device *dev)
2804 + struct snd_card *card = dev_get_drvdata(dev);
2805 + struct azx *chip = card->private_data;
2806 +
2807 +- if (chip->disabled)
2808 ++ if (chip->disabled || chip->init_failed)
2809 + return 0;
2810 +
2811 + if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2812 +@@ -2996,7 +2996,7 @@ static int azx_runtime_suspend(struct device *dev)
2813 + struct snd_card *card = dev_get_drvdata(dev);
2814 + struct azx *chip = card->private_data;
2815 +
2816 +- if (chip->disabled)
2817 ++ if (chip->disabled || chip->init_failed)
2818 + return 0;
2819 +
2820 + if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2821 +@@ -3022,7 +3022,7 @@ static int azx_runtime_resume(struct device *dev)
2822 + struct hda_codec *codec;
2823 + int status;
2824 +
2825 +- if (chip->disabled)
2826 ++ if (chip->disabled || chip->init_failed)
2827 + return 0;
2828 +
2829 + if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2830 +@@ -3057,7 +3057,7 @@ static int azx_runtime_idle(struct device *dev)
2831 + struct snd_card *card = dev_get_drvdata(dev);
2832 + struct azx *chip = card->private_data;
2833 +
2834 +- if (chip->disabled)
2835 ++ if (chip->disabled || chip->init_failed)
2836 + return 0;
2837 +
2838 + if (!power_save_controller ||
2839 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
2840 +index 3abfe2a642ec..d135c906caff 100644
2841 +--- a/sound/pci/hda/patch_hdmi.c
2842 ++++ b/sound/pci/hda/patch_hdmi.c
2843 +@@ -1062,6 +1062,7 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
2844 + {
2845 + union audio_infoframe ai;
2846 +
2847 ++ memset(&ai, 0, sizeof(ai));
2848 + if (conn_type == 0) { /* HDMI */
2849 + struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
2850 +