diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/arm/mach-davinci/pm.c linux-libre-4.11.9-gnu/arch/arm/mach-davinci/pm.c
--- linux-libre-4.11.8-gnu/arch/arm/mach-davinci/pm.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/arm/mach-davinci/pm.c	2017-07-05 08:41:57.000000000 -0400
@@ -154,7 +154,8 @@ int __init davinci_pm_init(void)
 	davinci_sram_suspend = sram_alloc(davinci_cpu_suspend_sz, NULL);
 	if (!davinci_sram_suspend) {
 		pr_err("PM: cannot allocate SRAM memory\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto no_sram_mem;
 	}
 
 	davinci_sram_push(davinci_sram_suspend, davinci_cpu_suspend,
@@ -162,6 +163,10 @@ int __init davinci_pm_init(void)
 
 	suspend_set_ops(&davinci_pm_ops);
 
+	return 0;
+
+no_sram_mem:
+	iounmap(pm_config.ddrpsc_reg_base);
 no_ddrpsc_mem:
 	iounmap(pm_config.ddrpll_reg_base);
 no_ddrpll_mem:
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/arm/mm/mmu.c linux-libre-4.11.9-gnu/arch/arm/mm/mmu.c
--- linux-libre-4.11.8-gnu/arch/arm/mm/mmu.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/arm/mm/mmu.c	2017-07-05 08:41:57.000000000 -0400
@@ -1216,15 +1216,15 @@ void __init adjust_lowmem_bounds(void)
 
 	high_memory = __va(arm_lowmem_limit - 1) + 1;
 
+	if (!memblock_limit)
+		memblock_limit = arm_lowmem_limit;
+
 	/*
 	 * Round the memblock limit down to a pmd size.  This
 	 * helps to ensure that we will allocate memory from the
 	 * last full pmd, which should be mapped.
 	 */
-	if (memblock_limit)
-		memblock_limit = round_down(memblock_limit, PMD_SIZE);
-	if (!memblock_limit)
-		memblock_limit = arm_lowmem_limit;
+	memblock_limit = round_down(memblock_limit, PMD_SIZE);
 
 	if (!IS_ENABLED(CONFIG_HIGHMEM) || cache_is_vipt_aliasing()) {
 		if (memblock_end_of_DRAM() > arm_lowmem_limit) {
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/arm64/include/asm/acpi.h linux-libre-4.11.9-gnu/arch/arm64/include/asm/acpi.h
--- linux-libre-4.11.8-gnu/arch/arm64/include/asm/acpi.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/arm64/include/asm/acpi.h	2017-07-05 08:41:57.000000000 -0400
@@ -23,9 +23,9 @@
 #define ACPI_MADT_GICC_LENGTH	\
 	(acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
 
-#define BAD_MADT_GICC_ENTRY(entry, end)						\
-	(!(entry) || (unsigned long)(entry) + sizeof(*(entry)) > (end) ||	\
-	 (entry)->header.length != ACPI_MADT_GICC_LENGTH)
+#define BAD_MADT_GICC_ENTRY(entry, end)					\
+	(!(entry) || (entry)->header.length != ACPI_MADT_GICC_LENGTH ||	\
+	(unsigned long)(entry) + ACPI_MADT_GICC_LENGTH > (end))
 
 /* Basic configuration for ACPI */
 #ifdef	CONFIG_ACPI
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/arm64/kernel/pci.c linux-libre-4.11.9-gnu/arch/arm64/kernel/pci.c
--- linux-libre-4.11.8-gnu/arch/arm64/kernel/pci.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/arm64/kernel/pci.c	2017-07-05 08:41:57.000000000 -0400
@@ -191,8 +191,10 @@ struct pci_bus *pci_acpi_scan_root(struc
 		return NULL;
 
 	root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node);
-	if (!root_ops)
+	if (!root_ops) {
+		kfree(ri);
 		return NULL;
+	}
 
 	ri->cfg = pci_acpi_setup_ecam_mapping(root);
 	if (!ri->cfg) {
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/mips/kernel/entry.S linux-libre-4.11.9-gnu/arch/mips/kernel/entry.S
--- linux-libre-4.11.8-gnu/arch/mips/kernel/entry.S	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/mips/kernel/entry.S	2017-07-05 08:41:57.000000000 -0400
@@ -11,6 +11,7 @@
 #include <asm/asm.h>
 #include <asm/asmmacro.h>
 #include <asm/compiler.h>
+#include <asm/irqflags.h>
 #include <asm/regdef.h>
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
@@ -119,6 +120,7 @@ work_pending:
 	andi	t0, a2, _TIF_NEED_RESCHED # a2 is preloaded with TI_FLAGS
 	beqz	t0, work_notifysig
 work_resched:
+	TRACE_IRQS_OFF
 	jal	schedule
 
 	local_irq_disable		# make sure need_resched and
@@ -155,6 +157,7 @@ syscall_exit_work:
 	beqz	t0, work_pending	# trace bit set?
 	local_irq_enable		# could let syscall_trace_leave()
 					# call schedule() instead
+	TRACE_IRQS_ON
 	move	a0, sp
 	jal	syscall_trace_leave
 	b	resume_userspace
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/mips/kernel/head.S linux-libre-4.11.9-gnu/arch/mips/kernel/head.S
--- linux-libre-4.11.8-gnu/arch/mips/kernel/head.S	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/mips/kernel/head.S	2017-07-05 08:41:57.000000000 -0400
@@ -106,8 +106,8 @@ NESTED(kernel_entry, 16, sp)			# kernel
 	beq		t0, t1, dtb_found
 #endif
 	li		t1, -2
-	beq		a0, t1, dtb_found
 	move		t2, a1
+	beq		a0, t1, dtb_found
 
 	li		t2, 0
 dtb_found:
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/mips/kernel/pm-cps.c linux-libre-4.11.9-gnu/arch/mips/kernel/pm-cps.c
--- linux-libre-4.11.8-gnu/arch/mips/kernel/pm-cps.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/mips/kernel/pm-cps.c	2017-07-05 08:41:57.000000000 -0400
@@ -56,7 +56,6 @@ DECLARE_BITMAP(state_support, CPS_PM_STA
  * state. Actually per-core rather than per-CPU.
  */
 static DEFINE_PER_CPU_ALIGNED(u32*, ready_count);
-static DEFINE_PER_CPU_ALIGNED(void*, ready_count_alloc);
 
 /* Indicates online CPUs coupled with the current CPU */
 static DEFINE_PER_CPU_ALIGNED(cpumask_t, online_coupled);
@@ -642,7 +641,6 @@ static int cps_pm_online_cpu(unsigned in
 {
 	enum cps_pm_state state;
 	unsigned core = cpu_data[cpu].core;
-	unsigned dlinesz = cpu_data[cpu].dcache.linesz;
 	void *entry_fn, *core_rc;
 
 	for (state = CPS_PM_NC_WAIT; state < CPS_PM_STATE_COUNT; state++) {
@@ -662,16 +660,11 @@ static int cps_pm_online_cpu(unsigned in
 	}
 
 	if (!per_cpu(ready_count, core)) {
-		core_rc = kmalloc(dlinesz * 2, GFP_KERNEL);
+		core_rc = kmalloc(sizeof(u32), GFP_KERNEL);
 		if (!core_rc) {
 			pr_err("Failed allocate core %u ready_count\n", core);
 			return -ENOMEM;
 		}
-		per_cpu(ready_count_alloc, core) = core_rc;
-
-		/* Ensure ready_count is aligned to a cacheline boundary */
-		core_rc += dlinesz - 1;
-		core_rc = (void *)((unsigned long)core_rc & ~(dlinesz - 1));
 		per_cpu(ready_count, core) = core_rc;
 	}
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/mips/kernel/traps.c linux-libre-4.11.9-gnu/arch/mips/kernel/traps.c
--- linux-libre-4.11.8-gnu/arch/mips/kernel/traps.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/mips/kernel/traps.c	2017-07-05 08:41:57.000000000 -0400
@@ -201,6 +201,8 @@ void show_stack(struct task_struct *task
 {
 	struct pt_regs regs;
 	mm_segment_t old_fs = get_fs();
+
+	regs.cp0_status = KSU_KERNEL;
 	if (sp) {
 		regs.regs[29] = (unsigned long)sp;
 		regs.regs[31] = 0;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/boot/compressed/kaslr.c linux-libre-4.11.9-gnu/arch/x86/boot/compressed/kaslr.c
--- linux-libre-4.11.8-gnu/arch/x86/boot/compressed/kaslr.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/boot/compressed/kaslr.c	2017-07-05 08:41:57.000000000 -0400
@@ -564,9 +564,6 @@ void choose_random_location(unsigned lon
 {
 	unsigned long random_addr, min_addr;
 
-	/* By default, keep output position unchanged. */
-	*virt_addr = *output;
-
 	if (cmdline_find_option_bool("nokaslr")) {
 		warn("KASLR disabled: 'nokaslr' on cmdline.");
 		return;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/boot/compressed/misc.c linux-libre-4.11.9-gnu/arch/x86/boot/compressed/misc.c
--- linux-libre-4.11.8-gnu/arch/x86/boot/compressed/misc.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/boot/compressed/misc.c	2017-07-05 08:41:57.000000000 -0400
@@ -338,7 +338,7 @@ asmlinkage __visible void *extract_kerne
 				  unsigned long output_len)
 {
 	const unsigned long kernel_total_size = VO__end - VO__text;
-	unsigned long virt_addr = (unsigned long)output;
+	unsigned long virt_addr = LOAD_PHYSICAL_ADDR;
 
 	/* Retain x86 boot parameters pointer passed from startup_32/64. */
 	boot_params = rmode;
@@ -397,7 +397,7 @@ asmlinkage __visible void *extract_kerne
 #ifndef CONFIG_RELOCATABLE
 	if ((unsigned long)output != LOAD_PHYSICAL_ADDR)
 		error("Destination address does not match LOAD_PHYSICAL_ADDR");
-	if ((unsigned long)output != virt_addr)
+	if (virt_addr != LOAD_PHYSICAL_ADDR)
 		error("Destination virtual address changed when not relocatable");
 #endif
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/boot/compressed/misc.h linux-libre-4.11.9-gnu/arch/x86/boot/compressed/misc.h
--- linux-libre-4.11.8-gnu/arch/x86/boot/compressed/misc.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/boot/compressed/misc.h	2017-07-05 08:41:57.000000000 -0400
@@ -81,8 +81,6 @@ static inline void choose_random_locatio
 					  unsigned long output_size,
 					  unsigned long *virt_addr)
 {
-	/* No change from existing output location. */
-	*virt_addr = *output;
 }
 #endif
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/entry/entry_32.S linux-libre-4.11.9-gnu/arch/x86/entry/entry_32.S
--- linux-libre-4.11.8-gnu/arch/x86/entry/entry_32.S	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/entry/entry_32.S	2017-07-05 08:41:57.000000000 -0400
@@ -255,6 +255,23 @@ ENTRY(__switch_to_asm)
 END(__switch_to_asm)
 
 /*
+ * The unwinder expects the last frame on the stack to always be at the same
+ * offset from the end of the page, which allows it to validate the stack.
+ * Calling schedule_tail() directly would break that convention because its an
+ * asmlinkage function so its argument has to be pushed on the stack.  This
+ * wrapper creates a proper "end of stack" frame header before the call.
+ */
+ENTRY(schedule_tail_wrapper)
+	FRAME_BEGIN
+
+	pushl	%eax
+	call	schedule_tail
+	popl	%eax
+
+	FRAME_END
+	ret
+ENDPROC(schedule_tail_wrapper)
+/*
  * A newly forked process directly context switches into this address.
  *
  * eax: prev task we switched from
@@ -262,24 +279,15 @@ END(__switch_to_asm)
  * edi: kernel thread arg
  */
 ENTRY(ret_from_fork)
-	FRAME_BEGIN		/* help unwinder find end of stack */
-
-	/*
-	 * schedule_tail() is asmlinkage so we have to put its 'prev' argument
-	 * on the stack.
-	 */
-	pushl	%eax
-	call	schedule_tail
-	popl	%eax
+	call	schedule_tail_wrapper
 
 	testl	%ebx, %ebx
 	jnz	1f		/* kernel threads are uncommon */
 
 2:
 	/* When we fork, we trace the syscall return in the child, too. */
-	leal	FRAME_OFFSET(%esp), %eax
+	movl    %esp, %eax
 	call    syscall_return_slowpath
-	FRAME_END
 	jmp     restore_all
 
 	/* kernel thread */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/entry/entry_64.S linux-libre-4.11.9-gnu/arch/x86/entry/entry_64.S
--- linux-libre-4.11.8-gnu/arch/x86/entry/entry_64.S	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/entry/entry_64.S	2017-07-05 08:41:57.000000000 -0400
@@ -36,7 +36,6 @@
 #include <asm/smap.h>
 #include <asm/pgtable_types.h>
 #include <asm/export.h>
-#include <asm/frame.h>
 #include <linux/err.h>
 
 .code64
@@ -409,19 +408,17 @@ END(__switch_to_asm)
  * r12: kernel thread arg
  */
 ENTRY(ret_from_fork)
-	FRAME_BEGIN			/* help unwinder find end of stack */
 	movq	%rax, %rdi
-	call	schedule_tail		/* rdi: 'prev' task parameter */
+	call	schedule_tail			/* rdi: 'prev' task parameter */
 
-	testq	%rbx, %rbx		/* from kernel_thread? */
-	jnz	1f			/* kernel threads are uncommon */
+	testq	%rbx, %rbx			/* from kernel_thread? */
+	jnz	1f				/* kernel threads are uncommon */
 
 2:
-	leaq	FRAME_OFFSET(%rsp),%rdi	/* pt_regs pointer */
+	movq	%rsp, %rdi
 	call	syscall_return_slowpath	/* returns with IRQs disabled */
 	TRACE_IRQS_ON			/* user mode is traced as IRQS on */
 	SWAPGS
-	FRAME_END
 	jmp	restore_regs_and_iret
 
 1:
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/events/intel/core.c linux-libre-4.11.9-gnu/arch/x86/events/intel/core.c
--- linux-libre-4.11.8-gnu/arch/x86/events/intel/core.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/events/intel/core.c	2017-07-05 08:41:57.000000000 -0400
@@ -2130,7 +2130,7 @@ again:
 	 * counters from the GLOBAL_STATUS mask and we always process PEBS
 	 * events via drain_pebs().
 	 */
-	status &= ~cpuc->pebs_enabled;
+	status &= ~(cpuc->pebs_enabled & PEBS_COUNTER_MASK);
 
 	/*
 	 * PEBS overflow sets bit 62 in the global status register
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/events/intel/ds.c linux-libre-4.11.9-gnu/arch/x86/events/intel/ds.c
--- linux-libre-4.11.8-gnu/arch/x86/events/intel/ds.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/events/intel/ds.c	2017-07-05 08:41:57.000000000 -0400
@@ -1222,7 +1222,7 @@ get_next_pebs_record_by_bit(void *base,
 
 			/* clear non-PEBS bit and re-check */
 			pebs_status = p->status & cpuc->pebs_enabled;
-			pebs_status &= (1ULL << MAX_PEBS_EVENTS) - 1;
+			pebs_status &= PEBS_COUNTER_MASK;
 			if (pebs_status == (1 << bit))
 				return at;
 		}
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/events/intel/uncore.c linux-libre-4.11.9-gnu/arch/x86/events/intel/uncore.c
--- linux-libre-4.11.8-gnu/arch/x86/events/intel/uncore.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/events/intel/uncore.c	2017-07-05 08:41:57.000000000 -0400
@@ -1170,7 +1170,7 @@ static int uncore_event_cpu_online(unsig
 		pmu = type->pmus;
 		for (i = 0; i < type->num_boxes; i++, pmu++) {
 			box = pmu->boxes[pkg];
-			if (!box && atomic_inc_return(&box->refcnt) == 1)
+			if (box && atomic_inc_return(&box->refcnt) == 1)
 				uncore_box_init(box);
 		}
 	}
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/events/perf_event.h linux-libre-4.11.9-gnu/arch/x86/events/perf_event.h
--- linux-libre-4.11.8-gnu/arch/x86/events/perf_event.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/events/perf_event.h	2017-07-05 08:41:57.000000000 -0400
@@ -79,6 +79,7 @@ struct amd_nb {
 
 /* The maximal number of PEBS events: */
 #define MAX_PEBS_EVENTS		8
+#define PEBS_COUNTER_MASK	((1ULL << MAX_PEBS_EVENTS) - 1)
 
 /*
  * Flags PEBS can handle without an PMI.
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/include/asm/kvm_emulate.h linux-libre-4.11.9-gnu/arch/x86/include/asm/kvm_emulate.h
--- linux-libre-4.11.8-gnu/arch/x86/include/asm/kvm_emulate.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/include/asm/kvm_emulate.h	2017-07-05 08:41:57.000000000 -0400
@@ -221,6 +221,9 @@ struct x86_emulate_ops {
 	void (*get_cpuid)(struct x86_emulate_ctxt *ctxt,
 			  u32 *eax, u32 *ebx, u32 *ecx, u32 *edx);
 	void (*set_nmi_mask)(struct x86_emulate_ctxt *ctxt, bool masked);
+
+	unsigned (*get_hflags)(struct x86_emulate_ctxt *ctxt);
+	void (*set_hflags)(struct x86_emulate_ctxt *ctxt, unsigned hflags);
 };
 
 typedef u32 __attribute__((vector_size(16))) sse128_t;
@@ -290,7 +293,6 @@ struct x86_emulate_ctxt {
 
 	/* interruptibility state, as a result of execution of STI or MOV SS */
 	int interruptibility;
-	int emul_flags;
 
 	bool perm_ok; /* do not check permissions if true */
 	bool ud;	/* inject an #UD if host doesn't support insn */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/include/asm/mshyperv.h linux-libre-4.11.9-gnu/arch/x86/include/asm/mshyperv.h
--- linux-libre-4.11.8-gnu/arch/x86/include/asm/mshyperv.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/include/asm/mshyperv.h	2017-07-05 08:41:57.000000000 -0400
@@ -2,8 +2,7 @@
 #define _ASM_X86_MSHYPER_H
 
 #include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/clocksource.h>
+#include <linux/atomic.h>
 #include <asm/hyperv.h>
 
 /*
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c linux-libre-4.11.9-gnu/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
--- linux-libre-4.11.8-gnu/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c	2017-07-05 08:41:57.000000000 -0400
@@ -767,11 +767,13 @@ static struct dentry *rdt_mount(struct f
 	dentry = kernfs_mount(fs_type, flags, rdt_root,
 			      RDTGROUP_SUPER_MAGIC, NULL);
 	if (IS_ERR(dentry))
-		goto out_cdp;
+		goto out_destroy;
 
 	static_branch_enable(&rdt_enable_key);
 	goto out;
 
+out_destroy:
+	kernfs_remove(kn_info);
 out_cdp:
 	cdp_disable();
 out:
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/kvm/emulate.c linux-libre-4.11.9-gnu/arch/x86/kvm/emulate.c
--- linux-libre-4.11.8-gnu/arch/x86/kvm/emulate.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/kvm/emulate.c	2017-07-05 08:41:57.000000000 -0400
@@ -2547,7 +2547,7 @@ static int em_rsm(struct x86_emulate_ctx
 	u64 smbase;
 	int ret;
 
-	if ((ctxt->emul_flags & X86EMUL_SMM_MASK) == 0)
+	if ((ctxt->ops->get_hflags(ctxt) & X86EMUL_SMM_MASK) == 0)
 		return emulate_ud(ctxt);
 
 	/*
@@ -2596,11 +2596,11 @@ static int em_rsm(struct x86_emulate_ctx
 		return X86EMUL_UNHANDLEABLE;
 	}
 
-	if ((ctxt->emul_flags & X86EMUL_SMM_INSIDE_NMI_MASK) == 0)
+	if ((ctxt->ops->get_hflags(ctxt) & X86EMUL_SMM_INSIDE_NMI_MASK) == 0)
 		ctxt->ops->set_nmi_mask(ctxt, false);
 
-	ctxt->emul_flags &= ~X86EMUL_SMM_INSIDE_NMI_MASK;
-	ctxt->emul_flags &= ~X86EMUL_SMM_MASK;
+	ctxt->ops->set_hflags(ctxt, ctxt->ops->get_hflags(ctxt) &
+		~(X86EMUL_SMM_INSIDE_NMI_MASK | X86EMUL_SMM_MASK));
 	return X86EMUL_CONTINUE;
 }
 
@@ -5317,6 +5317,7 @@ int x86_emulate_insn(struct x86_emulate_
 	const struct x86_emulate_ops *ops = ctxt->ops;
 	int rc = X86EMUL_CONTINUE;
 	int saved_dst_type = ctxt->dst.type;
+	unsigned emul_flags;
 
 	ctxt->mem_read.pos = 0;
 
@@ -5331,6 +5332,7 @@ int x86_emulate_insn(struct x86_emulate_
 		goto done;
 	}
 
+	emul_flags = ctxt->ops->get_hflags(ctxt);
 	if (unlikely(ctxt->d &
 		     (No64|Undefined|Sse|Mmx|Intercept|CheckPerm|Priv|Prot|String))) {
 		if ((ctxt->mode == X86EMUL_MODE_PROT64 && (ctxt->d & No64)) ||
@@ -5364,7 +5366,7 @@ int x86_emulate_insn(struct x86_emulate_
 				fetch_possible_mmx_operand(ctxt, &ctxt->dst);
 		}
 
-		if (unlikely(ctxt->emul_flags & X86EMUL_GUEST_MASK) && ctxt->intercept) {
+		if (unlikely(emul_flags & X86EMUL_GUEST_MASK) && ctxt->intercept) {
 			rc = emulator_check_intercept(ctxt, ctxt->intercept,
 						      X86_ICPT_PRE_EXCEPT);
 			if (rc != X86EMUL_CONTINUE)
@@ -5393,7 +5395,7 @@ int x86_emulate_insn(struct x86_emulate_
 				goto done;
 		}
 
-		if (unlikely(ctxt->emul_flags & X86EMUL_GUEST_MASK) && (ctxt->d & Intercept)) {
+		if (unlikely(emul_flags & X86EMUL_GUEST_MASK) && (ctxt->d & Intercept)) {
 			rc = emulator_check_intercept(ctxt, ctxt->intercept,
 						      X86_ICPT_POST_EXCEPT);
 			if (rc != X86EMUL_CONTINUE)
@@ -5447,7 +5449,7 @@ int x86_emulate_insn(struct x86_emulate_
 
 special_insn:
 
-	if (unlikely(ctxt->emul_flags & X86EMUL_GUEST_MASK) && (ctxt->d & Intercept)) {
+	if (unlikely(emul_flags & X86EMUL_GUEST_MASK) && (ctxt->d & Intercept)) {
 		rc = emulator_check_intercept(ctxt, ctxt->intercept,
 					      X86_ICPT_POST_MEMACCESS);
 		if (rc != X86EMUL_CONTINUE)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/kvm/pmu_intel.c linux-libre-4.11.9-gnu/arch/x86/kvm/pmu_intel.c
--- linux-libre-4.11.8-gnu/arch/x86/kvm/pmu_intel.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/kvm/pmu_intel.c	2017-07-05 08:41:57.000000000 -0400
@@ -294,7 +294,7 @@ static void intel_pmu_refresh(struct kvm
 			((u64)1 << edx.split.bit_width_fixed) - 1;
 	}
 
-	pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
+	pmu->global_ctrl = ((1ull << pmu->nr_arch_gp_counters) - 1) |
 		(((1ull << pmu->nr_arch_fixed_counters) - 1) << INTEL_PMC_IDX_FIXED);
 	pmu->global_ctrl_mask = ~pmu->global_ctrl;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/kvm/vmx.c linux-libre-4.11.9-gnu/arch/x86/kvm/vmx.c
--- linux-libre-4.11.8-gnu/arch/x86/kvm/vmx.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/kvm/vmx.c	2017-07-05 08:41:57.000000000 -0400
@@ -2436,7 +2436,7 @@ static int nested_vmx_check_exception(st
 	if (!(vmcs12->exception_bitmap & (1u << nr)))
 		return 0;
 
-	nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason,
+	nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI,
 			  vmcs_read32(VM_EXIT_INTR_INFO),
 			  vmcs_readl(EXIT_QUALIFICATION));
 	return 1;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/kvm/x86.c linux-libre-4.11.9-gnu/arch/x86/kvm/x86.c
--- linux-libre-4.11.8-gnu/arch/x86/kvm/x86.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/kvm/x86.c	2017-07-05 08:41:57.000000000 -0400
@@ -5098,6 +5098,8 @@ static bool emulator_get_segment(struct
 
 	if (var.unusable) {
 		memset(desc, 0, sizeof(*desc));
+		if (base3)
+			*base3 = 0;
 		return false;
 	}
 
@@ -5248,6 +5250,16 @@ static void emulator_set_nmi_mask(struct
 	kvm_x86_ops->set_nmi_mask(emul_to_vcpu(ctxt), masked);
 }
 
+static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt)
+{
+	return emul_to_vcpu(ctxt)->arch.hflags;
+}
+
+static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags)
+{
+	kvm_set_hflags(emul_to_vcpu(ctxt), emul_flags);
+}
+
 static const struct x86_emulate_ops emulate_ops = {
 	.read_gpr            = emulator_read_gpr,
 	.write_gpr           = emulator_write_gpr,
@@ -5287,6 +5299,8 @@ static const struct x86_emulate_ops emul
 	.intercept           = emulator_intercept,
 	.get_cpuid           = emulator_get_cpuid,
 	.set_nmi_mask        = emulator_set_nmi_mask,
+	.get_hflags          = emulator_get_hflags,
+	.set_hflags          = emulator_set_hflags,
 };
 
 static void toggle_interruptibility(struct kvm_vcpu *vcpu, u32 mask)
@@ -5341,7 +5355,6 @@ static void init_emulate_ctxt(struct kvm
 	BUILD_BUG_ON(HF_GUEST_MASK != X86EMUL_GUEST_MASK);
 	BUILD_BUG_ON(HF_SMM_MASK != X86EMUL_SMM_MASK);
 	BUILD_BUG_ON(HF_SMM_INSIDE_NMI_MASK != X86EMUL_SMM_INSIDE_NMI_MASK);
-	ctxt->emul_flags = vcpu->arch.hflags;
 
 	init_decode_cache(ctxt);
 	vcpu->arch.emulate_regs_need_sync_from_vcpu = false;
@@ -5744,8 +5757,6 @@ restart:
 		unsigned long rflags = kvm_x86_ops->get_rflags(vcpu);
 		toggle_interruptibility(vcpu, ctxt->interruptibility);
 		vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
-		if (vcpu->arch.hflags != ctxt->emul_flags)
-			kvm_set_hflags(vcpu, ctxt->emul_flags);
 		kvm_rip_write(vcpu, ctxt->eip);
 		if (r == EMULATE_DONE &&
 		    (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)))
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/mm/init_64.c linux-libre-4.11.9-gnu/arch/x86/mm/init_64.c
--- linux-libre-4.11.8-gnu/arch/x86/mm/init_64.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/mm/init_64.c	2017-07-05 08:41:57.000000000 -0400
@@ -94,10 +94,10 @@ __setup("noexec32=", nonx32_setup);
  */
 void sync_global_pgds(unsigned long start, unsigned long end)
 {
-	unsigned long address;
+	unsigned long addr;
 
-	for (address = start; address <= end; address += PGDIR_SIZE) {
-		const pgd_t *pgd_ref = pgd_offset_k(address);
+	for (addr = start; addr <= end; addr = ALIGN(addr + 1, PGDIR_SIZE)) {
+		const pgd_t *pgd_ref = pgd_offset_k(addr);
 		struct page *page;
 
 		if (pgd_none(*pgd_ref))
@@ -108,7 +108,7 @@ void sync_global_pgds(unsigned long star
 			pgd_t *pgd;
 			spinlock_t *pgt_lock;
 
-			pgd = (pgd_t *)page_address(page) + pgd_index(address);
+			pgd = (pgd_t *)page_address(page) + pgd_index(addr);
 			/* the pgt_lock only for Xen */
 			pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
 			spin_lock(pgt_lock);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/mm/mpx.c linux-libre-4.11.9-gnu/arch/x86/mm/mpx.c
--- linux-libre-4.11.8-gnu/arch/x86/mm/mpx.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/mm/mpx.c	2017-07-05 08:41:57.000000000 -0400
@@ -526,15 +526,7 @@ int mpx_handle_bd_fault(void)
 	if (!kernel_managing_mpx_tables(current->mm))
 		return -EINVAL;
 
-	if (do_mpx_bt_fault()) {
-		force_sig(SIGSEGV, current);
-		/*
-		 * The force_sig() is essentially "handling" this
-		 * exception, so we do not pass up the error
-		 * from do_mpx_bt_fault().
-		 */
-	}
-	return 0;
+	return do_mpx_bt_fault();
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.11.8-gnu/arch/x86/mm/tlb.c linux-libre-4.11.9-gnu/arch/x86/mm/tlb.c
--- linux-libre-4.11.8-gnu/arch/x86/mm/tlb.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/arch/x86/mm/tlb.c	2017-07-05 08:41:57.000000000 -0400
@@ -263,8 +263,6 @@ void native_flush_tlb_others(const struc
 {
 	struct flush_tlb_info info;
 
-	if (end == 0)
-		end = start + PAGE_SIZE;
 	info.flush_mm = mm;
 	info.flush_start = start;
 	info.flush_end = end;
@@ -393,7 +391,7 @@ void flush_tlb_page(struct vm_area_struc
 	}
 
 	if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)
-		flush_tlb_others(mm_cpumask(mm), mm, start, 0UL);
+		flush_tlb_others(mm_cpumask(mm), mm, start, start + PAGE_SIZE);
 
 	preempt_enable();
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/block/xen-blkback/blkback.c linux-libre-4.11.9-gnu/drivers/block/xen-blkback/blkback.c
--- linux-libre-4.11.8-gnu/drivers/block/xen-blkback/blkback.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/block/xen-blkback/blkback.c	2017-07-05 08:41:57.000000000 -0400
@@ -609,8 +609,6 @@ int xen_blkif_schedule(void *arg)
 	unsigned long timeout;
 	int ret;
 
-	xen_blkif_get(blkif);
-
 	set_freezable();
 	while (!kthread_should_stop()) {
 		if (try_to_freeze())
@@ -665,7 +663,6 @@ purge_gnt_list:
 		print_stats(ring);
 
 	ring->xenblkd = NULL;
-	xen_blkif_put(blkif);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/block/xen-blkback/xenbus.c linux-libre-4.11.9-gnu/drivers/block/xen-blkback/xenbus.c
--- linux-libre-4.11.8-gnu/drivers/block/xen-blkback/xenbus.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/block/xen-blkback/xenbus.c	2017-07-05 08:41:57.000000000 -0400
@@ -255,7 +255,6 @@ static int xen_blkif_disconnect(struct x
 		if (ring->xenblkd) {
 			kthread_stop(ring->xenblkd);
 			wake_up(&ring->shutdown_wq);
-			ring->xenblkd = NULL;
 		}
 
 		/* The above kthread_stop() guarantees that at this point we
@@ -316,8 +315,10 @@ static int xen_blkif_disconnect(struct x
 static void xen_blkif_free(struct xen_blkif *blkif)
 {
 
-	xen_blkif_disconnect(blkif);
+	WARN_ON(xen_blkif_disconnect(blkif));
 	xen_vbd_free(&blkif->vbd);
+	kfree(blkif->be->mode);
+	kfree(blkif->be);
 
 	/* Make sure everything is drained before shutting down */
 	kmem_cache_free(xen_blkif_cachep, blkif);
@@ -512,8 +513,6 @@ static int xen_blkbk_remove(struct xenbu
 
 	/* Put the reference we set in xen_blkif_alloc(). */
 	xen_blkif_put(be->blkif);
-	kfree(be->mode);
-	kfree(be);
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/gpio/gpiolib.c linux-libre-4.11.9-gnu/drivers/gpio/gpiolib.c
--- linux-libre-4.11.8-gnu/drivers/gpio/gpiolib.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/gpio/gpiolib.c	2017-07-05 08:41:57.000000000 -0400
@@ -708,7 +708,8 @@ static irqreturn_t lineevent_irq_thread(
 
 	ge.timestamp = ktime_get_real_ns();
 
-	if (le->eflags & GPIOEVENT_REQUEST_BOTH_EDGES) {
+	if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE
+	    && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) {
 		int level = gpiod_get_value_cansleep(le->desc);
 
 		if (level)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c linux-libre-4.11.9-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
--- linux-libre-4.11.8-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c	2017-07-05 08:41:57.000000000 -0400
@@ -321,6 +321,7 @@ void vmw_cmdbuf_res_man_destroy(struct v
 	list_for_each_entry_safe(entry, next, &man->list, head)
 		vmw_cmdbuf_res_free(man, entry);
 
+	drm_ht_remove(&man->resources);
 	kfree(man);
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/hsi/clients/ssi_protocol.c linux-libre-4.11.9-gnu/drivers/hsi/clients/ssi_protocol.c
--- linux-libre-4.11.8-gnu/drivers/hsi/clients/ssi_protocol.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/hsi/clients/ssi_protocol.c	2017-07-05 08:41:57.000000000 -0400
@@ -1065,7 +1065,7 @@ static void ssip_pn_setup(struct net_dev
 	dev->addr_len		= 1;
 	dev->tx_queue_len	= SSIP_TXQUEUE_LEN;
 
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->header_ops		= &phonet_header_ops;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/infiniband/hw/hns/hns_roce_hw_v1.c linux-libre-4.11.9-gnu/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
--- linux-libre-4.11.8-gnu/drivers/infiniband/hw/hns/hns_roce_hw_v1.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/infiniband/hw/hns/hns_roce_hw_v1.c	2017-07-05 08:41:57.000000000 -0400
@@ -1851,6 +1851,7 @@ void hns_roce_v1_cq_set_ci(struct hns_ro
 	u32 doorbell[2];
 
 	doorbell[0] = cons_index & ((hr_cq->cq_depth << 1) - 1);
+	doorbell[1] = 0;
 	roce_set_bit(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_HW_SYNS_S, 1);
 	roce_set_field(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_CMD_M,
 		       ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_CMD_S, 3);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/iommu/amd_iommu.c linux-libre-4.11.9-gnu/drivers/iommu/amd_iommu.c
--- linux-libre-4.11.8-gnu/drivers/iommu/amd_iommu.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/iommu/amd_iommu.c	2017-07-05 08:41:57.000000000 -0400
@@ -3879,11 +3879,9 @@ static void irte_ga_prepare(void *entry,
 			    u8 vector, u32 dest_apicid, int devid)
 {
 	struct irte_ga *irte = (struct irte_ga *) entry;
-	struct iommu_dev_data *dev_data = search_dev_data(devid);
 
 	irte->lo.val                      = 0;
 	irte->hi.val                      = 0;
-	irte->lo.fields_remap.guest_mode  = dev_data ? dev_data->use_vapic : 0;
 	irte->lo.fields_remap.int_type    = delivery_mode;
 	irte->lo.fields_remap.dm          = dest_mode;
 	irte->hi.fields.vector            = vector;
@@ -3939,10 +3937,10 @@ static void irte_ga_set_affinity(void *e
 	struct irte_ga *irte = (struct irte_ga *) entry;
 	struct iommu_dev_data *dev_data = search_dev_data(devid);
 
-	if (!dev_data || !dev_data->use_vapic) {
+	if (!dev_data || !dev_data->use_vapic ||
+	    !irte->lo.fields_remap.guest_mode) {
 		irte->hi.fields.vector = vector;
 		irte->lo.fields_remap.destination = dest_apicid;
-		irte->lo.fields_remap.guest_mode = 0;
 		modify_irte_ga(devid, index, irte, NULL);
 	}
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/iommu/amd_iommu_v2.c linux-libre-4.11.9-gnu/drivers/iommu/amd_iommu_v2.c
--- linux-libre-4.11.8-gnu/drivers/iommu/amd_iommu_v2.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/iommu/amd_iommu_v2.c	2017-07-05 08:41:57.000000000 -0400
@@ -696,9 +696,9 @@ out_clear_state:
 
 out_unregister:
 	mmu_notifier_unregister(&pasid_state->mn, mm);
+	mmput(mm);
 
 out_free:
-	mmput(mm);
 	free_pasid_state(pasid_state);
 
 out:
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/iommu/dma-iommu.c linux-libre-4.11.9-gnu/drivers/iommu/dma-iommu.c
--- linux-libre-4.11.8-gnu/drivers/iommu/dma-iommu.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/iommu/dma-iommu.c	2017-07-05 08:41:57.000000000 -0400
@@ -175,8 +175,7 @@ static void iova_reserve_pci_windows(str
 	unsigned long lo, hi;
 
 	resource_list_for_each_entry(window, &bridge->windows) {
-		if (resource_type(window->res) != IORESOURCE_MEM &&
-		    resource_type(window->res) != IORESOURCE_IO)
+		if (resource_type(window->res) != IORESOURCE_MEM)
 			continue;
 
 		lo = iova_pfn(iovad, window->res->start - window->offset);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/md/dm-thin.c linux-libre-4.11.9-gnu/drivers/md/dm-thin.c
--- linux-libre-4.11.8-gnu/drivers/md/dm-thin.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/md/dm-thin.c	2017-07-05 08:41:57.000000000 -0400
@@ -1094,6 +1094,19 @@ static void process_prepared_discard_pas
 		return;
 	}
 
+	/*
+	 * Increment the unmapped blocks.  This prevents a race between the
+	 * passdown io and reallocation of freed blocks.
+	 */
+	r = dm_pool_inc_data_range(pool->pmd, m->data_block, data_end);
+	if (r) {
+		metadata_operation_failed(pool, "dm_pool_inc_data_range", r);
+		bio_io_error(m->bio);
+		cell_defer_no_holder(tc, m->cell);
+		mempool_free(m, pool->mapping_pool);
+		return;
+	}
+
 	discard_parent = bio_alloc(GFP_NOIO, 1);
 	if (!discard_parent) {
 		DMWARN("%s: unable to allocate top level discard bio for passdown. Skipping passdown.",
@@ -1114,19 +1127,6 @@ static void process_prepared_discard_pas
 			end_discard(&op, r);
 		}
 	}
-
-	/*
-	 * Increment the unmapped blocks.  This prevents a race between the
-	 * passdown io and reallocation of freed blocks.
-	 */
-	r = dm_pool_inc_data_range(pool->pmd, m->data_block, data_end);
-	if (r) {
-		metadata_operation_failed(pool, "dm_pool_inc_data_range", r);
-		bio_io_error(m->bio);
-		cell_defer_no_holder(tc, m->cell);
-		mempool_free(m, pool->mapping_pool);
-		return;
-	}
 }
 
 static void process_prepared_discard_passdown_pt2(struct dm_thin_new_mapping *m)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/mtd/nand/brcmnand/brcmnand.c linux-libre-4.11.9-gnu/drivers/mtd/nand/brcmnand/brcmnand.c
--- linux-libre-4.11.8-gnu/drivers/mtd/nand/brcmnand/brcmnand.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/mtd/nand/brcmnand/brcmnand.c	2017-07-05 08:41:57.000000000 -0400
@@ -101,6 +101,9 @@ struct brcm_nand_dma_desc {
 #define BRCMNAND_MIN_BLOCKSIZE	(8 * 1024)
 #define BRCMNAND_MIN_DEVSIZE	(4ULL * 1024 * 1024)
 
+#define NAND_CTRL_RDY			(INTFC_CTLR_READY | INTFC_FLASH_READY)
+#define NAND_POLL_STATUS_TIMEOUT_MS	100
+
 /* Controller feature flags */
 enum {
 	BRCMNAND_HAS_1K_SECTORS			= BIT(0),
@@ -765,6 +768,31 @@ enum {
 	CS_SELECT_AUTO_DEVICE_ID_CFG		= BIT(30),
 };
 
+static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl,
+				    u32 mask, u32 expected_val,
+				    unsigned long timeout_ms)
+{
+	unsigned long limit;
+	u32 val;
+
+	if (!timeout_ms)
+		timeout_ms = NAND_POLL_STATUS_TIMEOUT_MS;
+
+	limit = jiffies + msecs_to_jiffies(timeout_ms);
+	do {
+		val = brcmnand_read_reg(ctrl, BRCMNAND_INTFC_STATUS);
+		if ((val & mask) == expected_val)
+			return 0;
+
+		cpu_relax();
+	} while (time_after(limit, jiffies));
+
+	dev_warn(ctrl->dev, "timeout on status poll (expected %x got %x)\n",
+		 expected_val, val & mask);
+
+	return -ETIMEDOUT;
+}
+
 static inline void brcmnand_set_wp(struct brcmnand_controller *ctrl, bool en)
 {
 	u32 val = en ? CS_SELECT_NAND_WP : 0;
@@ -1024,12 +1052,39 @@ static void brcmnand_wp(struct mtd_info
 
 	if ((ctrl->features & BRCMNAND_HAS_WP) && wp_on == 1) {
 		static int old_wp = -1;
+		int ret;
 
 		if (old_wp != wp) {
 			dev_dbg(ctrl->dev, "WP %s\n", wp ? "on" : "off");
 			old_wp = wp;
 		}
+
+		/*
+		 * make sure ctrl/flash ready before and after
+		 * changing state of #WP pin
+		 */
+		ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY |
+					       NAND_STATUS_READY,
+					       NAND_CTRL_RDY |
+					       NAND_STATUS_READY, 0);
+		if (ret)
+			return;
+
 		brcmnand_set_wp(ctrl, wp);
+		chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
+		/* NAND_STATUS_WP 0x00 = protected, 0x80 = not protected */
+		ret = bcmnand_ctrl_poll_status(ctrl,
+					       NAND_CTRL_RDY |
+					       NAND_STATUS_READY |
+					       NAND_STATUS_WP,
+					       NAND_CTRL_RDY |
+					       NAND_STATUS_READY |
+					       (wp ? 0 : NAND_STATUS_WP), 0);
+
+		if (ret)
+			dev_err_ratelimited(&host->pdev->dev,
+					    "nand #WP expected %s\n",
+					    wp ? "on" : "off");
 	}
 }
 
@@ -1157,15 +1212,15 @@ static irqreturn_t brcmnand_dma_irq(int
 static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd)
 {
 	struct brcmnand_controller *ctrl = host->ctrl;
-	u32 intfc;
+	int ret;
 
 	dev_dbg(ctrl->dev, "send native cmd %d addr_lo 0x%x\n", cmd,
 		brcmnand_read_reg(ctrl, BRCMNAND_CMD_ADDRESS));
 	BUG_ON(ctrl->cmd_pending != 0);
 	ctrl->cmd_pending = cmd;
 
-	intfc = brcmnand_read_reg(ctrl, BRCMNAND_INTFC_STATUS);
-	WARN_ON(!(intfc & INTFC_CTLR_READY));
+	ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);
+	WARN_ON(ret);
 
 	mb(); /* flush previous writes */
 	brcmnand_write_reg(ctrl, BRCMNAND_CMD_START,
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/mtd/nand/fsmc_nand.c linux-libre-4.11.9-gnu/drivers/mtd/nand/fsmc_nand.c
--- linux-libre-4.11.8-gnu/drivers/mtd/nand/fsmc_nand.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/mtd/nand/fsmc_nand.c	2017-07-05 08:41:57.000000000 -0400
@@ -150,7 +150,6 @@ struct fsmc_nand_platform_data {
 	struct mtd_partition	*partitions;
 	unsigned int		nr_partitions;
 	unsigned int		options;
-	unsigned int		width;
 	unsigned int		bank;
 
 	enum access_mode	mode;
@@ -844,18 +843,19 @@ static int fsmc_nand_probe_config_dt(str
 	u32 val;
 	int ret;
 
-	/* Set default NAND width to 8 bits */
-	pdata->width = 8;
+	pdata->options = 0;
+
 	if (!of_property_read_u32(np, "bank-width", &val)) {
 		if (val == 2) {
-			pdata->width = 16;
+			pdata->options |= NAND_BUSWIDTH_16;
 		} else if (val != 1) {
 			dev_err(&pdev->dev, "invalid bank-width %u\n", val);
 			return -EINVAL;
 		}
 	}
+
 	if (of_get_property(np, "nand-skip-bbtscan", NULL))
-		pdata->options = NAND_SKIP_BBTSCAN;
+		pdata->options |= NAND_SKIP_BBTSCAN;
 
 	pdata->nand_timings = devm_kzalloc(&pdev->dev,
 				sizeof(*pdata->nand_timings), GFP_KERNEL);
@@ -992,9 +992,6 @@ static int __init fsmc_nand_probe(struct
 	nand->badblockbits = 7;
 	nand_set_flash_node(nand, np);
 
-	if (pdata->width == FSMC_NAND_BW16)
-		nand->options |= NAND_BUSWIDTH_16;
-
 	switch (host->mode) {
 	case USE_DMA_ACCESS:
 		dma_cap_zero(mask);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/bonding/bond_main.c linux-libre-4.11.9-gnu/drivers/net/bonding/bond_main.c
--- linux-libre-4.11.8-gnu/drivers/net/bonding/bond_main.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/bonding/bond_main.c	2017-07-05 08:41:57.000000000 -0400
@@ -4163,7 +4163,6 @@ static void bond_destructor(struct net_d
 	struct bonding *bond = netdev_priv(bond_dev);
 	if (bond->wq)
 		destroy_workqueue(bond->wq);
-	free_netdev(bond_dev);
 }
 
 void bond_setup(struct net_device *bond_dev)
@@ -4183,7 +4182,8 @@ void bond_setup(struct net_device *bond_
 	bond_dev->netdev_ops = &bond_netdev_ops;
 	bond_dev->ethtool_ops = &bond_ethtool_ops;
 
-	bond_dev->destructor = bond_destructor;
+	bond_dev->needs_free_netdev = true;
+	bond_dev->priv_destructor = bond_destructor;
 
 	SET_NETDEV_DEVTYPE(bond_dev, &bond_type);
 
@@ -4689,7 +4689,7 @@ int bond_create(struct net *net, const c
 
 	rtnl_unlock();
 	if (res < 0)
-		bond_destructor(bond_dev);
+		free_netdev(bond_dev);
 	return res;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/caif/caif_hsi.c linux-libre-4.11.9-gnu/drivers/net/caif/caif_hsi.c
--- linux-libre-4.11.8-gnu/drivers/net/caif/caif_hsi.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/caif/caif_hsi.c	2017-07-05 08:41:57.000000000 -0400
@@ -1121,7 +1121,7 @@ static void cfhsi_setup(struct net_devic
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
 	dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ;
 	dev->priv_flags |= IFF_NO_QUEUE;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	dev->netdev_ops = &cfhsi_netdevops;
 	for (i = 0; i < CFHSI_PRIO_LAST; ++i)
 		skb_queue_head_init(&cfhsi->qhead[i]);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/caif/caif_serial.c linux-libre-4.11.9-gnu/drivers/net/caif/caif_serial.c
--- linux-libre-4.11.8-gnu/drivers/net/caif/caif_serial.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/caif/caif_serial.c	2017-07-05 08:41:57.000000000 -0400
@@ -428,7 +428,7 @@ static void caifdev_setup(struct net_dev
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
 	dev->mtu = CAIF_MAX_MTU;
 	dev->priv_flags |= IFF_NO_QUEUE;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	skb_queue_head_init(&serdev->head);
 	serdev->common.link_select = CAIF_LINK_LOW_LATENCY;
 	serdev->common.use_frag = true;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/caif/caif_spi.c linux-libre-4.11.9-gnu/drivers/net/caif/caif_spi.c
--- linux-libre-4.11.8-gnu/drivers/net/caif/caif_spi.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/caif/caif_spi.c	2017-07-05 08:41:57.000000000 -0400
@@ -712,7 +712,7 @@ static void cfspi_setup(struct net_devic
 	dev->flags = IFF_NOARP | IFF_POINTOPOINT;
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->mtu = SPI_MAX_PAYLOAD_SIZE;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	skb_queue_head_init(&cfspi->qhead);
 	skb_queue_head_init(&cfspi->chead);
 	cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/caif/caif_virtio.c linux-libre-4.11.9-gnu/drivers/net/caif/caif_virtio.c
--- linux-libre-4.11.8-gnu/drivers/net/caif/caif_virtio.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/caif/caif_virtio.c	2017-07-05 08:41:57.000000000 -0400
@@ -617,7 +617,7 @@ static void cfv_netdev_setup(struct net_
 	netdev->tx_queue_len = 100;
 	netdev->flags = IFF_POINTOPOINT | IFF_NOARP;
 	netdev->mtu = CFV_DEF_MTU_SIZE;
-	netdev->destructor = free_netdev;
+	netdev->needs_free_netdev = true;
 }
 
 /* Create debugfs counters for the device */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/can/slcan.c linux-libre-4.11.9-gnu/drivers/net/can/slcan.c
--- linux-libre-4.11.8-gnu/drivers/net/can/slcan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/can/slcan.c	2017-07-05 08:41:57.000000000 -0400
@@ -417,7 +417,7 @@ static int slc_open(struct net_device *d
 static void slc_free_netdev(struct net_device *dev)
 {
 	int i = dev->base_addr;
-	free_netdev(dev);
+
 	slcan_devs[i] = NULL;
 }
 
@@ -436,7 +436,8 @@ static const struct net_device_ops slc_n
 static void slc_setup(struct net_device *dev)
 {
 	dev->netdev_ops		= &slc_netdev_ops;
-	dev->destructor		= slc_free_netdev;
+	dev->needs_free_netdev	= true;
+	dev->priv_destructor	= slc_free_netdev;
 
 	dev->hard_header_len	= 0;
 	dev->addr_len		= 0;
@@ -761,8 +762,6 @@ static void __exit slcan_exit(void)
 		if (sl->tty) {
 			printk(KERN_ERR "%s: tty discipline still running\n",
 			       dev->name);
-			/* Intentionally leak the control block. */
-			dev->destructor = NULL;
 		}
 
 		unregister_netdev(dev);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/can/vcan.c linux-libre-4.11.9-gnu/drivers/net/can/vcan.c
--- linux-libre-4.11.8-gnu/drivers/net/can/vcan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/can/vcan.c	2017-07-05 08:41:57.000000000 -0400
@@ -160,7 +160,7 @@ static void vcan_setup(struct net_device
 		dev->flags |= IFF_ECHO;
 
 	dev->netdev_ops		= &vcan_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 }
 
 static struct rtnl_link_ops vcan_link_ops __read_mostly = {
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/dummy.c linux-libre-4.11.9-gnu/drivers/net/dummy.c
--- linux-libre-4.11.8-gnu/drivers/net/dummy.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/dummy.c	2017-07-05 08:41:57.000000000 -0400
@@ -313,7 +313,6 @@ static void dummy_free_netdev(struct net
 	struct dummy_priv *priv = netdev_priv(dev);
 
 	kfree(priv->vfinfo);
-	free_netdev(dev);
 }
 
 static void dummy_setup(struct net_device *dev)
@@ -323,7 +322,8 @@ static void dummy_setup(struct net_devic
 	/* Initialize the device structure. */
 	dev->netdev_ops = &dummy_netdev_ops;
 	dev->ethtool_ops = &dummy_ethtool_ops;
-	dev->destructor = dummy_free_netdev;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = dummy_free_netdev;
 
 	/* Fill in device structure with ethernet-generic values. */
 	dev->flags |= IFF_NOARP;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c linux-libre-4.11.9-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c	2017-06-29 10:34:05.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c	2017-07-05 13:15:29.000000000 -0400
@@ -4528,7 +4528,7 @@ static void dummy_setup(struct net_devic
 	/* Initialize the device structure. */
 	dev->netdev_ops = &cxgb4_mgmt_netdev_ops;
 	dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 }
 
 static int config_mgmt_dev(struct pci_dev *pdev)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c	2017-07-05 08:41:57.000000000 -0400
@@ -1205,11 +1205,11 @@ static int mlx5e_get_ts_info(struct net_
 				 SOF_TIMESTAMPING_RX_HARDWARE |
 				 SOF_TIMESTAMPING_RAW_HARDWARE;
 
-	info->tx_types = (BIT(1) << HWTSTAMP_TX_OFF) |
-			 (BIT(1) << HWTSTAMP_TX_ON);
+	info->tx_types = BIT(HWTSTAMP_TX_OFF) |
+			 BIT(HWTSTAMP_TX_ON);
 
-	info->rx_filters = (BIT(1) << HWTSTAMP_FILTER_NONE) |
-			   (BIT(1) << HWTSTAMP_FILTER_ALL);
+	info->rx_filters = BIT(HWTSTAMP_FILTER_NONE) |
+			   BIT(HWTSTAMP_FILTER_ALL);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h	2017-07-05 08:41:57.000000000 -0400
@@ -313,13 +313,15 @@ struct mlx5e_dma_info {
 
 struct mlx5e_rx_am_stats {
 	int ppms; /* packets per msec */
+	int bpms; /* bytes per msec */
 	int epms; /* events per msec */
 };
 
 struct mlx5e_rx_am_sample {
-	ktime_t		time;
-	unsigned int	pkt_ctr;
-	u16		event_ctr;
+	ktime_t	time;
+	u32	pkt_ctr;
+	u32	byte_ctr;
+	u16	event_ctr;
 };
 
 struct mlx5e_rx_am { /* Adaptive Moderation */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c	2017-07-05 08:41:57.000000000 -0400
@@ -3885,7 +3885,8 @@ struct net_device *mlx5e_create_netdev(s
 	return netdev;
 
 err_cleanup_nic:
-	profile->cleanup(priv);
+	if (profile->cleanup)
+		profile->cleanup(priv);
 	free_netdev(netdev);
 
 	return NULL;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c	2017-07-05 08:41:57.000000000 -0400
@@ -424,6 +424,8 @@ static void mlx5e_build_rep_netdev_priv(
 	priv->params.lro_wqe_sz            =
 		MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
 
+	mlx5_query_min_inline(mdev, &priv->params.tx_min_inline_mode);
+
 	priv->mdev                         = mdev;
 	priv->netdev                       = netdev;
 	priv->params.num_channels          = profile->max_nch(mdev);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c	2017-07-05 08:41:57.000000000 -0400
@@ -183,28 +183,27 @@ static void mlx5e_am_exit_parking(struct
 	mlx5e_am_step(am);
 }
 
+#define IS_SIGNIFICANT_DIFF(val, ref) \
+	(((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
+
 static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr,
 				  struct mlx5e_rx_am_stats *prev)
 {
-	int diff;
-
-	if (!prev->ppms)
-		return curr->ppms ? MLX5E_AM_STATS_BETTER :
+	if (!prev->bpms)
+		return curr->bpms ? MLX5E_AM_STATS_BETTER :
 				    MLX5E_AM_STATS_SAME;
 
-	diff = curr->ppms - prev->ppms;
-	if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */
-		return (diff > 0) ? MLX5E_AM_STATS_BETTER :
-				    MLX5E_AM_STATS_WORSE;
+	if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
+		return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER :
+						   MLX5E_AM_STATS_WORSE;
 
-	if (!prev->epms)
-		return curr->epms ? MLX5E_AM_STATS_WORSE :
-				    MLX5E_AM_STATS_SAME;
+	if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
+		return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER :
+						   MLX5E_AM_STATS_WORSE;
 
-	diff = curr->epms - prev->epms;
-	if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */
-		return (diff < 0) ? MLX5E_AM_STATS_BETTER :
-				    MLX5E_AM_STATS_WORSE;
+	if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
+		return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
+						   MLX5E_AM_STATS_WORSE;
 
 	return MLX5E_AM_STATS_SAME;
 }
@@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e
 {
 	s->time	     = ktime_get();
 	s->pkt_ctr   = rq->stats.packets;
+	s->byte_ctr  = rq->stats.bytes;
 	s->event_ctr = rq->cq.event_ctr;
 }
 
 #define MLX5E_AM_NEVENTS 64
+#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
+#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
 
 static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
 				struct mlx5e_rx_am_sample *end,
@@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct m
 {
 	/* u32 holds up to 71 minutes, should be enough */
 	u32 delta_us = ktime_us_delta(end->time, start->time);
-	unsigned int npkts = end->pkt_ctr - start->pkt_ctr;
+	u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
+	u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
+			     start->byte_ctr);
 
 	if (!delta_us)
 		return;
 
-	curr_stats->ppms =            (npkts * USEC_PER_MSEC) / delta_us;
-	curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us;
+	curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us);
+	curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
+	curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC,
+					delta_us);
 }
 
 void mlx5e_rx_am_work(struct work_struct *work)
@@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq)
 
 	switch (am->state) {
 	case MLX5E_AM_MEASURE_IN_PROGRESS:
-		nevents = rq->cq.event_ctr - am->start_sample.event_ctr;
+		nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr,
+				  am->start_sample.event_ctr);
 		if (nevents < MLX5E_AM_NEVENTS)
 			break;
 		mlx5e_am_sample(rq, &end_sample);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h	2017-07-05 08:41:57.000000000 -0400
@@ -417,20 +417,13 @@ struct mlx5e_stats {
 };
 
 static const struct counter_desc mlx5e_pme_status_desc[] = {
-	{ "module_plug", 0 },
 	{ "module_unplug", 8 },
 };
 
 static const struct counter_desc mlx5e_pme_error_desc[] = {
-	{ "module_pwr_budget_exd", 0 },  /* power budget exceed */
-	{ "module_long_range", 8 },      /* long range for non MLNX cable */
-	{ "module_bus_stuck", 16 },      /* bus stuck (I2C or data shorted) */
-	{ "module_no_eeprom", 24 },      /* no eeprom/retry time out */
-	{ "module_enforce_part", 32 },   /* enforce part number list */
-	{ "module_unknown_id", 40 },     /* unknown identifier */
-	{ "module_high_temp", 48 },      /* high temperature */
+	{ "module_bus_stuck", 16 },       /* bus stuck (I2C or data shorted) */
+	{ "module_high_temp", 48 },       /* high temperature */
 	{ "module_bad_shorted", 56 },    /* bad or shorted cable/module */
-	{ "module_unknown_status", 64 },
 };
 
 #endif /* __MLX5_EN_STATS_H__ */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c
--- linux-libre-4.11.8-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2017-07-05 08:41:57.000000000 -0400
@@ -175,8 +175,9 @@ static struct mlx5_profile profile[] = {
 	},
 };
 
-#define FW_INIT_TIMEOUT_MILI	2000
-#define FW_INIT_WAIT_MS		2
+#define FW_INIT_TIMEOUT_MILI		2000
+#define FW_INIT_WAIT_MS			2
+#define FW_PRE_INIT_TIMEOUT_MILI	10000
 
 static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili)
 {
@@ -537,8 +538,10 @@ static int handle_hca_cap(struct mlx5_co
 	/* disable cmdif checksum */
 	MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
 
-	/* If the HCA supports 4K UARs use it */
-	if (MLX5_CAP_GEN_MAX(dev, uar_4k))
+	/* Enable 4K UAR only when HCA supports it and page size is bigger
+	 * than 4K.
+	 */
+	if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096)
 		MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1);
 
 	MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
@@ -1019,6 +1022,15 @@ static int mlx5_load_one(struct mlx5_cor
 	 */
 	dev->state = MLX5_DEVICE_STATE_UP;
 
+	/* wait for firmware to accept initialization segments configurations
+	 */
+	err = wait_fw_init(dev, FW_PRE_INIT_TIMEOUT_MILI);
+	if (err) {
+		dev_err(&dev->pdev->dev, "Firmware over %d MS in pre-initializing state, aborting\n",
+			FW_PRE_INIT_TIMEOUT_MILI);
+		goto out;
+	}
+
 	err = mlx5_cmd_init(dev);
 	if (err) {
 		dev_err(&pdev->dev, "Failed initializing command interface, aborting\n");
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/geneve.c linux-libre-4.11.9-gnu/drivers/net/geneve.c
--- linux-libre-4.11.8-gnu/drivers/net/geneve.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/geneve.c	2017-07-05 08:41:57.000000000 -0400
@@ -1007,7 +1007,7 @@ static void geneve_setup(struct net_devi
 
 	dev->netdev_ops = &geneve_netdev_ops;
 	dev->ethtool_ops = &geneve_ethtool_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 
 	SET_NETDEV_DEVTYPE(dev, &geneve_type);
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/gtp.c linux-libre-4.11.9-gnu/drivers/net/gtp.c
--- linux-libre-4.11.8-gnu/drivers/net/gtp.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/gtp.c	2017-07-05 08:41:57.000000000 -0400
@@ -618,7 +618,7 @@ static const struct net_device_ops gtp_n
 static void gtp_link_setup(struct net_device *dev)
 {
 	dev->netdev_ops		= &gtp_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 
 	dev->hard_header_len = 0;
 	dev->addr_len = 0;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/hamradio/6pack.c linux-libre-4.11.9-gnu/drivers/net/hamradio/6pack.c
--- linux-libre-4.11.8-gnu/drivers/net/hamradio/6pack.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/hamradio/6pack.c	2017-07-05 08:41:57.000000000 -0400
@@ -311,7 +311,7 @@ static void sp_setup(struct net_device *
 {
 	/* Finish setting up the DEVICE info. */
 	dev->netdev_ops		= &sp_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->mtu		= SIXP_MTU;
 	dev->hard_header_len	= AX25_MAX_HEADER_LEN;
 	dev->header_ops 	= &ax25_header_ops;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/hamradio/bpqether.c linux-libre-4.11.9-gnu/drivers/net/hamradio/bpqether.c
--- linux-libre-4.11.8-gnu/drivers/net/hamradio/bpqether.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/hamradio/bpqether.c	2017-07-05 08:41:57.000000000 -0400
@@ -476,7 +476,7 @@ static const struct net_device_ops bpq_n
 static void bpq_setup(struct net_device *dev)
 {
 	dev->netdev_ops	     = &bpq_netdev_ops;
-	dev->destructor	     = free_netdev;
+	dev->needs_free_netdev = true;
 
 	memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
 	memcpy(dev->dev_addr,  &ax25_defaddr, AX25_ADDR_LEN);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ifb.c linux-libre-4.11.9-gnu/drivers/net/ifb.c
--- linux-libre-4.11.8-gnu/drivers/net/ifb.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ifb.c	2017-07-05 08:41:57.000000000 -0400
@@ -207,7 +207,6 @@ static void ifb_dev_free(struct net_devi
 		__skb_queue_purge(&txp->tq);
 	}
 	kfree(dp->tx_private);
-	free_netdev(dev);
 }
 
 static void ifb_setup(struct net_device *dev)
@@ -230,7 +229,8 @@ static void ifb_setup(struct net_device
 	dev->priv_flags &= ~IFF_TX_SKB_SHARING;
 	netif_keep_dst(dev);
 	eth_hw_addr_random(dev);
-	dev->destructor = ifb_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = ifb_dev_free;
 }
 
 static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/ipvlan/ipvlan_main.c linux-libre-4.11.9-gnu/drivers/net/ipvlan/ipvlan_main.c
--- linux-libre-4.11.8-gnu/drivers/net/ipvlan/ipvlan_main.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/ipvlan/ipvlan_main.c	2017-07-05 08:41:57.000000000 -0400
@@ -621,7 +621,7 @@ void ipvlan_link_setup(struct net_device
 	dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
 	dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE;
 	dev->netdev_ops = &ipvlan_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	dev->header_ops = &ipvlan_header_ops;
 	dev->ethtool_ops = &ipvlan_ethtool_ops;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/loopback.c linux-libre-4.11.9-gnu/drivers/net/loopback.c
--- linux-libre-4.11.8-gnu/drivers/net/loopback.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/loopback.c	2017-07-05 08:41:57.000000000 -0400
@@ -145,7 +145,6 @@ static void loopback_dev_free(struct net
 {
 	dev_net(dev)->loopback_dev = NULL;
 	free_percpu(dev->lstats);
-	free_netdev(dev);
 }
 
 static const struct net_device_ops loopback_ops = {
@@ -183,7 +182,8 @@ static void loopback_setup(struct net_de
 	dev->ethtool_ops	= &loopback_ethtool_ops;
 	dev->header_ops		= &eth_header_ops;
 	dev->netdev_ops		= &loopback_ops;
-	dev->destructor		= loopback_dev_free;
+	dev->needs_free_netdev	= true;
+	dev->priv_destructor	= loopback_dev_free;
 }
 
 /* Setup and register the loopback device. */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/macsec.c linux-libre-4.11.9-gnu/drivers/net/macsec.c
--- linux-libre-4.11.8-gnu/drivers/net/macsec.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/macsec.c	2017-07-05 08:41:57.000000000 -0400
@@ -2994,7 +2994,6 @@ static void macsec_free_netdev(struct ne
 	free_percpu(macsec->secy.tx_sc.stats);
 
 	dev_put(real_dev);
-	free_netdev(dev);
 }
 
 static void macsec_setup(struct net_device *dev)
@@ -3004,7 +3003,8 @@ static void macsec_setup(struct net_devi
 	dev->max_mtu = ETH_MAX_MTU;
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->netdev_ops = &macsec_netdev_ops;
-	dev->destructor = macsec_free_netdev;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = macsec_free_netdev;
 	SET_NETDEV_DEVTYPE(dev, &macsec_type);
 
 	eth_zero_addr(dev->broadcast);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/macvlan.c linux-libre-4.11.9-gnu/drivers/net/macvlan.c
--- linux-libre-4.11.8-gnu/drivers/net/macvlan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/macvlan.c	2017-07-05 08:41:57.000000000 -0400
@@ -1089,7 +1089,7 @@ void macvlan_common_setup(struct net_dev
 	netif_keep_dst(dev);
 	dev->priv_flags	       |= IFF_UNICAST_FLT;
 	dev->netdev_ops		= &macvlan_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->header_ops		= &macvlan_hard_header_ops;
 	dev->ethtool_ops	= &macvlan_ethtool_ops;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/nlmon.c linux-libre-4.11.9-gnu/drivers/net/nlmon.c
--- linux-libre-4.11.8-gnu/drivers/net/nlmon.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/nlmon.c	2017-07-05 08:41:57.000000000 -0400
@@ -113,7 +113,7 @@ static void nlmon_setup(struct net_devic
 
 	dev->netdev_ops	= &nlmon_ops;
 	dev->ethtool_ops = &nlmon_ethtool_ops;
-	dev->destructor	= free_netdev;
+	dev->needs_free_netdev = true;
 
 	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST |
 			NETIF_F_HIGHDMA | NETIF_F_LLTX;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/slip/slip.c linux-libre-4.11.9-gnu/drivers/net/slip/slip.c
--- linux-libre-4.11.8-gnu/drivers/net/slip/slip.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/slip/slip.c	2017-07-05 08:41:57.000000000 -0400
@@ -629,7 +629,7 @@ static void sl_uninit(struct net_device
 static void sl_free_netdev(struct net_device *dev)
 {
 	int i = dev->base_addr;
-	free_netdev(dev);
+
 	slip_devs[i] = NULL;
 }
 
@@ -651,7 +651,8 @@ static const struct net_device_ops sl_ne
 static void sl_setup(struct net_device *dev)
 {
 	dev->netdev_ops		= &sl_netdev_ops;
-	dev->destructor		= sl_free_netdev;
+	dev->needs_free_netdev	= true;
+	dev->priv_destructor	= sl_free_netdev;
 
 	dev->hard_header_len	= 0;
 	dev->addr_len		= 0;
@@ -1369,8 +1370,6 @@ static void __exit slip_exit(void)
 		if (sl->tty) {
 			printk(KERN_ERR "%s: tty discipline still running\n",
 			       dev->name);
-			/* Intentionally leak the control block. */
-			dev->destructor = NULL;
 		}
 
 		unregister_netdev(dev);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/team/team.c linux-libre-4.11.9-gnu/drivers/net/team/team.c
--- linux-libre-4.11.8-gnu/drivers/net/team/team.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/team/team.c	2017-07-05 08:41:57.000000000 -0400
@@ -1643,7 +1643,6 @@ static void team_destructor(struct net_d
 	struct team *team = netdev_priv(dev);
 
 	free_percpu(team->pcpu_stats);
-	free_netdev(dev);
 }
 
 static int team_open(struct net_device *dev)
@@ -2079,7 +2078,8 @@ static void team_setup(struct net_device
 
 	dev->netdev_ops = &team_netdev_ops;
 	dev->ethtool_ops = &team_ethtool_ops;
-	dev->destructor	= team_destructor;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = team_destructor;
 	dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->priv_flags |= IFF_TEAM;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/tun.c linux-libre-4.11.9-gnu/drivers/net/tun.c
--- linux-libre-4.11.8-gnu/drivers/net/tun.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/tun.c	2017-07-05 08:41:57.000000000 -0400
@@ -1560,7 +1560,6 @@ static void tun_free_netdev(struct net_d
 	free_percpu(tun->pcpu_stats);
 	tun_flow_uninit(tun);
 	security_tun_dev_free_security(tun->security);
-	free_netdev(dev);
 }
 
 static void tun_setup(struct net_device *dev)
@@ -1571,7 +1570,8 @@ static void tun_setup(struct net_device
 	tun->group = INVALID_GID;
 
 	dev->ethtool_ops = &tun_ethtool_ops;
-	dev->destructor = tun_free_netdev;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = tun_free_netdev;
 	/* We prefer our own queue length */
 	dev->tx_queue_len = TUN_READQ_SIZE;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/usb/cdc-phonet.c linux-libre-4.11.9-gnu/drivers/net/usb/cdc-phonet.c
--- linux-libre-4.11.8-gnu/drivers/net/usb/cdc-phonet.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/usb/cdc-phonet.c	2017-07-05 08:41:57.000000000 -0400
@@ -298,7 +298,7 @@ static void usbpn_setup(struct net_devic
 	dev->addr_len		= 1;
 	dev->tx_queue_len	= 3;
 
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/usb/qmi_wwan.c linux-libre-4.11.9-gnu/drivers/net/usb/qmi_wwan.c
--- linux-libre-4.11.8-gnu/drivers/net/usb/qmi_wwan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/usb/qmi_wwan.c	2017-07-05 08:41:57.000000000 -0400
@@ -898,6 +898,8 @@ static const struct usb_device_id produc
 	{QMI_FIXED_INTF(0x1199, 0x9056, 8)},	/* Sierra Wireless Modem */
 	{QMI_FIXED_INTF(0x1199, 0x9057, 8)},
 	{QMI_FIXED_INTF(0x1199, 0x9061, 8)},	/* Sierra Wireless Modem */
+	{QMI_FIXED_INTF(0x1199, 0x9063, 8)},	/* Sierra Wireless EM7305 */
+	{QMI_FIXED_INTF(0x1199, 0x9063, 10)},	/* Sierra Wireless EM7305 */
 	{QMI_FIXED_INTF(0x1199, 0x9071, 8)},	/* Sierra Wireless MC74xx */
 	{QMI_FIXED_INTF(0x1199, 0x9071, 10)},	/* Sierra Wireless MC74xx */
 	{QMI_FIXED_INTF(0x1199, 0x9079, 8)},	/* Sierra Wireless EM74xx */
@@ -912,6 +914,8 @@ static const struct usb_device_id produc
 	{QMI_FIXED_INTF(0x1bc7, 0x1100, 3)},	/* Telit ME910 */
 	{QMI_FIXED_INTF(0x1bc7, 0x1200, 5)},	/* Telit LE920 */
 	{QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)},	/* Telit LE920, LE920A4 */
+	{QMI_FIXED_INTF(0x1c9e, 0x9801, 3)},	/* Telewell TW-3G HSPA+ */
+	{QMI_FIXED_INTF(0x1c9e, 0x9803, 4)},	/* Telewell TW-3G HSPA+ */
 	{QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)},	/* XS Stick W100-2 from 4G Systems */
 	{QMI_FIXED_INTF(0x0b3c, 0xc000, 4)},	/* Olivetti Olicard 100 */
 	{QMI_FIXED_INTF(0x0b3c, 0xc001, 4)},	/* Olivetti Olicard 120 */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/veth.c linux-libre-4.11.9-gnu/drivers/net/veth.c
--- linux-libre-4.11.8-gnu/drivers/net/veth.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/veth.c	2017-07-05 08:41:57.000000000 -0400
@@ -227,7 +227,6 @@ static int veth_dev_init(struct net_devi
 static void veth_dev_free(struct net_device *dev)
 {
 	free_percpu(dev->vstats);
-	free_netdev(dev);
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -322,7 +321,8 @@ static void veth_setup(struct net_device
 			       NETIF_F_HW_VLAN_STAG_TX |
 			       NETIF_F_HW_VLAN_CTAG_RX |
 			       NETIF_F_HW_VLAN_STAG_RX);
-	dev->destructor = veth_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = veth_dev_free;
 	dev->max_mtu = ETH_MAX_MTU;
 
 	dev->hw_features = VETH_FEATURES;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/vrf.c linux-libre-4.11.9-gnu/drivers/net/vrf.c
--- linux-libre-4.11.8-gnu/drivers/net/vrf.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/vrf.c	2017-07-05 08:41:57.000000000 -0400
@@ -36,12 +36,14 @@
 #include <net/addrconf.h>
 #include <net/l3mdev.h>
 #include <net/fib_rules.h>
+#include <net/netns/generic.h>
 
 #define DRV_NAME	"vrf"
 #define DRV_VERSION	"1.0"
 
 #define FIB_RULE_PREF  1000       /* default preference for FIB rules */
-static bool add_fib_rules = true;
+
+static unsigned int vrf_net_id;
 
 struct net_vrf {
 	struct rtable __rcu	*rth;
@@ -1206,7 +1208,7 @@ static void vrf_setup(struct net_device
 	dev->netdev_ops = &vrf_netdev_ops;
 	dev->l3mdev_ops = &vrf_l3mdev_ops;
 	dev->ethtool_ops = &vrf_ethtool_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 
 	/* Fill in device structure with ethernet-generic values. */
 	eth_hw_addr_random(dev);
@@ -1252,6 +1254,8 @@ static int vrf_newlink(struct net *src_n
 		       struct nlattr *tb[], struct nlattr *data[])
 {
 	struct net_vrf *vrf = netdev_priv(dev);
+	bool *add_fib_rules;
+	struct net *net;
 	int err;
 
 	if (!data || !data[IFLA_VRF_TABLE])
@@ -1267,13 +1271,15 @@ static int vrf_newlink(struct net *src_n
 	if (err)
 		goto out;
 
-	if (add_fib_rules) {
+	net = dev_net(dev);
+	add_fib_rules = net_generic(net, vrf_net_id);
+	if (*add_fib_rules) {
 		err = vrf_add_fib_rules(dev);
 		if (err) {
 			unregister_netdevice(dev);
 			goto out;
 		}
-		add_fib_rules = false;
+		*add_fib_rules = false;
 	}
 
 out:
@@ -1356,16 +1362,38 @@ static struct notifier_block vrf_notifie
 	.notifier_call = vrf_device_event,
 };
 
+/* Initialize per network namespace state */
+static int __net_init vrf_netns_init(struct net *net)
+{
+	bool *add_fib_rules = net_generic(net, vrf_net_id);
+
+	*add_fib_rules = true;
+
+	return 0;
+}
+
+static struct pernet_operations vrf_net_ops __net_initdata = {
+	.init = vrf_netns_init,
+	.id   = &vrf_net_id,
+	.size = sizeof(bool),
+};
+
 static int __init vrf_init_module(void)
 {
 	int rc;
 
 	register_netdevice_notifier(&vrf_notifier_block);
 
-	rc = rtnl_link_register(&vrf_link_ops);
+	rc = register_pernet_subsys(&vrf_net_ops);
 	if (rc < 0)
 		goto error;
 
+	rc = rtnl_link_register(&vrf_link_ops);
+	if (rc < 0) {
+		unregister_pernet_subsys(&vrf_net_ops);
+		goto error;
+	}
+
 	return 0;
 
 error:
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/vxlan.c linux-libre-4.11.9-gnu/drivers/net/vxlan.c
--- linux-libre-4.11.8-gnu/drivers/net/vxlan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/vxlan.c	2017-07-05 08:41:57.000000000 -0400
@@ -2607,7 +2607,7 @@ static void vxlan_setup(struct net_devic
 	eth_hw_addr_random(dev);
 	ether_setup(dev);
 
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	SET_NETDEV_DEVTYPE(dev, &vxlan_type);
 
 	dev->features	|= NETIF_F_LLTX;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wan/dlci.c linux-libre-4.11.9-gnu/drivers/net/wan/dlci.c
--- linux-libre-4.11.8-gnu/drivers/net/wan/dlci.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wan/dlci.c	2017-07-05 08:41:57.000000000 -0400
@@ -475,7 +475,7 @@ static void dlci_setup(struct net_device
 	dev->flags		= 0;
 	dev->header_ops		= &dlci_header_ops;
 	dev->netdev_ops		= &dlci_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 
 	dlp->receive		= dlci_receive;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wan/hdlc_fr.c linux-libre-4.11.9-gnu/drivers/net/wan/hdlc_fr.c
--- linux-libre-4.11.8-gnu/drivers/net/wan/hdlc_fr.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wan/hdlc_fr.c	2017-07-05 08:41:57.000000000 -0400
@@ -1106,7 +1106,7 @@ static int fr_add_pvc(struct net_device
 		return -EIO;
 	}
 
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	*get_dev_p(pvc, type) = dev;
 	if (!used) {
 		state(hdlc)->dce_changed = 1;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wan/lapbether.c linux-libre-4.11.9-gnu/drivers/net/wan/lapbether.c
--- linux-libre-4.11.8-gnu/drivers/net/wan/lapbether.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wan/lapbether.c	2017-07-05 08:41:57.000000000 -0400
@@ -306,7 +306,7 @@ static const struct net_device_ops lapbe
 static void lapbeth_setup(struct net_device *dev)
 {
 	dev->netdev_ops	     = &lapbeth_netdev_ops;
-	dev->destructor	     = free_netdev;
+	dev->needs_free_netdev = true;
 	dev->type            = ARPHRD_X25;
 	dev->hard_header_len = 3;
 	dev->mtu             = 1000;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wireless/ath/ath6kl/main.c linux-libre-4.11.9-gnu/drivers/net/wireless/ath/ath6kl/main.c
--- linux-libre-4.11.8-gnu/drivers/net/wireless/ath/ath6kl/main.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wireless/ath/ath6kl/main.c	2017-07-05 08:41:57.000000000 -0400
@@ -1287,7 +1287,7 @@ void init_netdev(struct net_device *dev)
 	struct ath6kl *ar = ath6kl_priv(dev);
 
 	dev->netdev_ops = &ath6kl_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	dev->watchdog_timeo = ATH6KL_TX_TIMEOUT;
 
 	dev->needed_headroom = ETH_HLEN;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c linux-libre-4.11.9-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
--- linux-libre-4.11.8-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c	2017-07-05 08:41:57.000000000 -0400
@@ -5209,7 +5209,6 @@ void brcmf_cfg80211_free_netdev(struct n
 
 	if (vif)
 		brcmf_free_vif(vif);
-	free_netdev(ndev);
 }
 
 static bool brcmf_is_linkup(const struct brcmf_event_msg *e)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c linux-libre-4.11.9-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
--- linux-libre-4.11.8-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c	2017-07-05 08:41:57.000000000 -0400
@@ -652,7 +652,8 @@ struct brcmf_if *brcmf_add_if(struct brc
 		if (!ndev)
 			return ERR_PTR(-ENOMEM);
 
-		ndev->destructor = brcmf_cfg80211_free_netdev;
+		ndev->needs_free_netdev = true;
+		ndev->priv_destructor = brcmf_cfg80211_free_netdev;
 		ifp = netdev_priv(ndev);
 		ifp->ndev = ndev;
 		/* store mapping ifidx to bsscfgidx */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wireless/intersil/hostap/hostap_main.c linux-libre-4.11.9-gnu/drivers/net/wireless/intersil/hostap/hostap_main.c
--- linux-libre-4.11.8-gnu/drivers/net/wireless/intersil/hostap/hostap_main.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wireless/intersil/hostap/hostap_main.c	2017-07-05 08:41:57.000000000 -0400
@@ -73,7 +73,7 @@ struct net_device * hostap_add_interface
 	dev->mem_end = mdev->mem_end;
 
 	hostap_setup_dev(dev, local, type);
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 
 	sprintf(dev->name, "%s%s", prefix, name);
 	if (!rtnl_locked)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wireless/mac80211_hwsim.c linux-libre-4.11.9-gnu/drivers/net/wireless/mac80211_hwsim.c
--- linux-libre-4.11.8-gnu/drivers/net/wireless/mac80211_hwsim.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wireless/mac80211_hwsim.c	2017-07-05 08:41:57.000000000 -0400
@@ -2807,7 +2807,7 @@ static const struct net_device_ops hwsim
 static void hwsim_mon_setup(struct net_device *dev)
 {
 	dev->netdev_ops = &hwsim_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	ether_setup(dev);
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->type = ARPHRD_IEEE80211_RADIOTAP;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/net/wireless/marvell/mwifiex/main.c linux-libre-4.11.9-gnu/drivers/net/wireless/marvell/mwifiex/main.c
--- linux-libre-4.11.8-gnu/drivers/net/wireless/marvell/mwifiex/main.c	2017-06-29 10:42:42.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/net/wireless/marvell/mwifiex/main.c	2017-07-05 13:24:55.000000000 -0400
@@ -1277,7 +1277,7 @@ void mwifiex_init_priv_params(struct mwi
 			      struct net_device *dev)
 {
 	dev->netdev_ops = &mwifiex_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	/* Initialize private structure */
 	priv->current_key_index = 0;
 	priv->media_connected = false;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/pinctrl/pinctrl-amd.c linux-libre-4.11.9-gnu/drivers/pinctrl/pinctrl-amd.c
--- linux-libre-4.11.8-gnu/drivers/pinctrl/pinctrl-amd.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/pinctrl/pinctrl-amd.c	2017-07-05 08:41:57.000000000 -0400
@@ -495,64 +495,54 @@ static struct irq_chip amd_gpio_irqchip
 	.flags        = IRQCHIP_SKIP_SET_WAKE,
 };
 
-static void amd_gpio_irq_handler(struct irq_desc *desc)
+#define PIN_IRQ_PENDING	(BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF))
+
+static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
 {
-	u32 i;
-	u32 off;
-	u32 reg;
-	u32 pin_reg;
-	u64 reg64;
-	int handled = 0;
-	unsigned int irq;
+	struct amd_gpio *gpio_dev = dev_id;
+	struct gpio_chip *gc = &gpio_dev->gc;
+	irqreturn_t ret = IRQ_NONE;
+	unsigned int i, irqnr;
 	unsigned long flags;
-	struct irq_chip *chip = irq_desc_get_chip(desc);
-	struct gpio_chip *gc = irq_desc_get_handler_data(desc);
-	struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
+	u32 *regs, regval;
+	u64 status, mask;
 
-	chained_irq_enter(chip, desc);
-	/*enable GPIO interrupt again*/
+	/* Read the wake status */
 	spin_lock_irqsave(&gpio_dev->lock, flags);
-	reg = readl(gpio_dev->base + WAKE_INT_STATUS_REG1);
-	reg64 = reg;
-	reg64 = reg64 << 32;
-
-	reg = readl(gpio_dev->base + WAKE_INT_STATUS_REG0);
-	reg64 |= reg;
+	status = readl(gpio_dev->base + WAKE_INT_STATUS_REG1);
+	status <<= 32;
+	status |= readl(gpio_dev->base + WAKE_INT_STATUS_REG0);
 	spin_unlock_irqrestore(&gpio_dev->lock, flags);
 
-	/*
-	 * first 46 bits indicates interrupt status.
-	 * one bit represents four interrupt sources.
-	*/
-	for (off = 0; off < 46 ; off++) {
-		if (reg64 & BIT(off)) {
-			for (i = 0; i < 4; i++) {
-				pin_reg = readl(gpio_dev->base +
-						(off * 4 + i) * 4);
-				if ((pin_reg & BIT(INTERRUPT_STS_OFF)) ||
-					(pin_reg & BIT(WAKE_STS_OFF))) {
-					irq = irq_find_mapping(gc->irqdomain,
-								off * 4 + i);
-					generic_handle_irq(irq);
-					writel(pin_reg,
-						gpio_dev->base
-						+ (off * 4 + i) * 4);
-					handled++;
-				}
-			}
+	/* Bit 0-45 contain the relevant status bits */
+	status &= (1ULL << 46) - 1;
+	regs = gpio_dev->base;
+	for (mask = 1, irqnr = 0; status; mask <<= 1, regs += 4, irqnr += 4) {
+		if (!(status & mask))
+			continue;
+		status &= ~mask;
+
+		/* Each status bit covers four pins */
+		for (i = 0; i < 4; i++) {
+			regval = readl(regs + i);
+			if (!(regval & PIN_IRQ_PENDING))
+				continue;
+			irq = irq_find_mapping(gc->irqdomain, irqnr + i);
+			generic_handle_irq(irq);
+			/* Clear interrupt */
+			writel(regval, regs + i);
+			ret = IRQ_HANDLED;
 		}
 	}
 
-	if (handled == 0)
-		handle_bad_irq(desc);
-
+	/* Signal EOI to the GPIO unit */
 	spin_lock_irqsave(&gpio_dev->lock, flags);
-	reg = readl(gpio_dev->base + WAKE_INT_MASTER_REG);
-	reg |= EOI_MASK;
-	writel(reg, gpio_dev->base + WAKE_INT_MASTER_REG);
+	regval = readl(gpio_dev->base + WAKE_INT_MASTER_REG);
+	regval |= EOI_MASK;
+	writel(regval, gpio_dev->base + WAKE_INT_MASTER_REG);
 	spin_unlock_irqrestore(&gpio_dev->lock, flags);
 
-	chained_irq_exit(chip, desc);
+	return ret;
 }
 
 static int amd_get_groups_count(struct pinctrl_dev *pctldev)
@@ -821,10 +811,11 @@ static int amd_gpio_probe(struct platfor
 		goto out2;
 	}
 
-	gpiochip_set_chained_irqchip(&gpio_dev->gc,
-				 &amd_gpio_irqchip,
-				 irq_base,
-				 amd_gpio_irq_handler);
+	ret = devm_request_irq(&pdev->dev, irq_base, amd_gpio_irq_handler, 0,
+			       KBUILD_MODNAME, gpio_dev);
+	if (ret)
+		goto out2;
+
 	platform_set_drvdata(pdev, gpio_dev);
 
 	dev_dbg(&pdev->dev, "amd gpio driver loaded\n");
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/s390/net/netiucv.c linux-libre-4.11.9-gnu/drivers/s390/net/netiucv.c
--- linux-libre-4.11.8-gnu/drivers/s390/net/netiucv.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/s390/net/netiucv.c	2017-07-05 08:41:57.000000000 -0400
@@ -1954,7 +1954,6 @@ static void netiucv_free_netdevice(struc
 		privptr->conn = NULL; privptr->fsm = NULL;
 		/* privptr gets freed by free_netdev() */
 	}
-	free_netdev(dev);
 }
 
 /**
@@ -1972,7 +1971,8 @@ static void netiucv_setup_netdevice(stru
 	dev->mtu	         = NETIUCV_MTU_DEFAULT;
 	dev->min_mtu		 = 576;
 	dev->max_mtu		 = NETIUCV_MTU_MAX;
-	dev->destructor          = netiucv_free_netdevice;
+	dev->needs_free_netdev   = true;
+	dev->priv_destructor     = netiucv_free_netdevice;
 	dev->hard_header_len     = NETIUCV_HDRLEN;
 	dev->addr_len            = 0;
 	dev->type                = ARPHRD_SLIP;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/staging/rtl8188eu/os_dep/mon.c linux-libre-4.11.9-gnu/drivers/staging/rtl8188eu/os_dep/mon.c
--- linux-libre-4.11.8-gnu/drivers/staging/rtl8188eu/os_dep/mon.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/staging/rtl8188eu/os_dep/mon.c	2017-07-05 08:41:57.000000000 -0400
@@ -152,7 +152,7 @@ static const struct net_device_ops mon_n
 static void mon_setup(struct net_device *dev)
 {
 	dev->netdev_ops = &mon_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	ether_setup(dev);
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->type = ARPHRD_IEEE80211;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/usb/gadget/function/f_phonet.c linux-libre-4.11.9-gnu/drivers/usb/gadget/function/f_phonet.c
--- linux-libre-4.11.8-gnu/drivers/usb/gadget/function/f_phonet.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/usb/gadget/function/f_phonet.c	2017-07-05 08:41:57.000000000 -0400
@@ -281,7 +281,7 @@ static void pn_net_setup(struct net_devi
 	dev->tx_queue_len	= 1;
 
 	dev->netdev_ops		= &pn_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->header_ops		= &phonet_header_ops;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/drivers/watchdog/bcm_kona_wdt.c linux-libre-4.11.9-gnu/drivers/watchdog/bcm_kona_wdt.c
--- linux-libre-4.11.8-gnu/drivers/watchdog/bcm_kona_wdt.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/drivers/watchdog/bcm_kona_wdt.c	2017-07-05 08:41:57.000000000 -0400
@@ -304,6 +304,8 @@ static int bcm_kona_wdt_probe(struct pla
 	if (!wdt)
 		return -ENOMEM;
 
+	spin_lock_init(&wdt->lock);
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	wdt->base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(wdt->base))
@@ -316,7 +318,6 @@ static int bcm_kona_wdt_probe(struct pla
 		return ret;
 	}
 
-	spin_lock_init(&wdt->lock);
 	platform_set_drvdata(pdev, wdt);
 	watchdog_set_drvdata(&bcm_kona_wdt_wdd, wdt);
 	bcm_kona_wdt_wdd.parent = &pdev->dev;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/nfs/callback.c linux-libre-4.11.9-gnu/fs/nfs/callback.c
--- linux-libre-4.11.8-gnu/fs/nfs/callback.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/nfs/callback.c	2017-07-05 08:41:57.000000000 -0400
@@ -280,7 +280,7 @@ static struct svc_serv *nfs_callback_cre
 		printk(KERN_WARNING "nfs_callback_create_svc: no kthread, %d users??\n",
 			cb_info->users);
 
-	serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, sv_ops);
+	serv = svc_create_pooled(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, sv_ops);
 	if (!serv) {
 		printk(KERN_ERR "nfs_callback_create_svc: create service failed\n");
 		return ERR_PTR(-ENOMEM);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/nfs/dir.c linux-libre-4.11.9-gnu/fs/nfs/dir.c
--- linux-libre-4.11.8-gnu/fs/nfs/dir.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/nfs/dir.c	2017-07-05 08:41:57.000000000 -0400
@@ -2002,29 +2002,6 @@ nfs_link(struct dentry *old_dentry, stru
 }
 EXPORT_SYMBOL_GPL(nfs_link);
 
-static void
-nfs_complete_rename(struct rpc_task *task, struct nfs_renamedata *data)
-{
-	struct dentry *old_dentry = data->old_dentry;
-	struct dentry *new_dentry = data->new_dentry;
-	struct inode *old_inode = d_inode(old_dentry);
-	struct inode *new_inode = d_inode(new_dentry);
-
-	nfs_mark_for_revalidate(old_inode);
-
-	switch (task->tk_status) {
-	case 0:
-		if (new_inode != NULL)
-			nfs_drop_nlink(new_inode);
-		d_move(old_dentry, new_dentry);
-		nfs_set_verifier(new_dentry,
-					nfs_save_change_attribute(data->new_dir));
-		break;
-	case -ENOENT:
-		nfs_dentry_handle_enoent(old_dentry);
-	}
-}
-
 /*
  * RENAME
  * FIXME: Some nfsds, like the Linux user space nfsd, may generate a
@@ -2055,7 +2032,7 @@ int nfs_rename(struct inode *old_dir, st
 {
 	struct inode *old_inode = d_inode(old_dentry);
 	struct inode *new_inode = d_inode(new_dentry);
-	struct dentry *dentry = NULL;
+	struct dentry *dentry = NULL, *rehash = NULL;
 	struct rpc_task *task;
 	int error = -EBUSY;
 
@@ -2078,8 +2055,10 @@ int nfs_rename(struct inode *old_dir, st
 		 * To prevent any new references to the target during the
 		 * rename, we unhash the dentry in advance.
 		 */
-		if (!d_unhashed(new_dentry))
+		if (!d_unhashed(new_dentry)) {
 			d_drop(new_dentry);
+			rehash = new_dentry;
+		}
 
 		if (d_count(new_dentry) > 2) {
 			int err;
@@ -2096,6 +2075,7 @@ int nfs_rename(struct inode *old_dir, st
 				goto out;
 
 			new_dentry = dentry;
+			rehash = NULL;
 			new_inode = NULL;
 		}
 	}
@@ -2104,8 +2084,7 @@ int nfs_rename(struct inode *old_dir, st
 	if (new_inode != NULL)
 		NFS_PROTO(new_inode)->return_delegation(new_inode);
 
-	task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry,
-					nfs_complete_rename);
+	task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL);
 	if (IS_ERR(task)) {
 		error = PTR_ERR(task);
 		goto out;
@@ -2115,9 +2094,27 @@ int nfs_rename(struct inode *old_dir, st
 	if (error == 0)
 		error = task->tk_status;
 	rpc_put_task(task);
+	nfs_mark_for_revalidate(old_inode);
 out:
+	if (rehash)
+		d_rehash(rehash);
 	trace_nfs_rename_exit(old_dir, old_dentry,
 			new_dir, new_dentry, error);
+	if (!error) {
+		if (new_inode != NULL)
+			nfs_drop_nlink(new_inode);
+		/*
+		 * The d_move() should be here instead of in an async RPC completion
+		 * handler because we need the proper locks to move the dentry.  If
+		 * we're interrupted by a signal, the async RPC completion handler
+		 * should mark the directories for revalidation.
+		 */
+		d_move(old_dentry, new_dentry);
+		nfs_set_verifier(new_dentry,
+					nfs_save_change_attribute(new_dir));
+	} else if (error == -ENOENT)
+		nfs_dentry_handle_enoent(old_dentry);
+
 	/* new dentry created? */
 	if (dentry)
 		dput(dentry);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/nfs/nfs4proc.c linux-libre-4.11.9-gnu/fs/nfs/nfs4proc.c
--- linux-libre-4.11.8-gnu/fs/nfs/nfs4proc.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/nfs/nfs4proc.c	2017-07-05 08:41:57.000000000 -0400
@@ -2588,7 +2588,8 @@ static inline void nfs4_exclusive_attrse
 
 	/* Except MODE, it seems harmless of setting twice. */
 	if (opendata->o_arg.createmode != NFS4_CREATE_EXCLUSIVE &&
-		attrset[1] & FATTR4_WORD1_MODE)
+		(attrset[1] & FATTR4_WORD1_MODE ||
+		 attrset[2] & FATTR4_WORD2_MODE_UMASK))
 		sattr->ia_valid &= ~ATTR_MODE;
 
 	if (attrset[2] & FATTR4_WORD2_SECURITY_LABEL)
@@ -8429,6 +8430,7 @@ static void nfs4_layoutget_release(void
 	size_t max_pages = max_response_pages(server);
 
 	dprintk("--> %s\n", __func__);
+	nfs4_sequence_free_slot(&lgp->res.seq_res);
 	nfs4_free_pages(lgp->args.layout.pages, max_pages);
 	pnfs_put_layout_hdr(NFS_I(inode)->layout);
 	put_nfs_open_context(lgp->args.ctx);
@@ -8503,7 +8505,6 @@ nfs4_proc_layoutget(struct nfs4_layoutge
 	/* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */
 	if (status == 0 && lgp->res.layoutp->len)
 		lseg = pnfs_layout_process(lgp);
-	nfs4_sequence_free_slot(&lgp->res.seq_res);
 	rpc_put_task(task);
 	dprintk("<-- %s status=%d\n", __func__, status);
 	if (status)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/ocfs2/cluster/heartbeat.c linux-libre-4.11.9-gnu/fs/ocfs2/cluster/heartbeat.c
--- linux-libre-4.11.8-gnu/fs/ocfs2/cluster/heartbeat.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/ocfs2/cluster/heartbeat.c	2017-07-05 08:41:57.000000000 -0400
@@ -2242,13 +2242,13 @@ unlock:
 	spin_unlock(&o2hb_live_lock);
 }
 
-static ssize_t o2hb_heartbeat_group_threshold_show(struct config_item *item,
+static ssize_t o2hb_heartbeat_group_dead_threshold_show(struct config_item *item,
 		char *page)
 {
 	return sprintf(page, "%u\n", o2hb_dead_threshold);
 }
 
-static ssize_t o2hb_heartbeat_group_threshold_store(struct config_item *item,
+static ssize_t o2hb_heartbeat_group_dead_threshold_store(struct config_item *item,
 		const char *page, size_t count)
 {
 	unsigned long tmp;
@@ -2297,11 +2297,11 @@ static ssize_t o2hb_heartbeat_group_mode
 
 }
 
-CONFIGFS_ATTR(o2hb_heartbeat_group_, threshold);
+CONFIGFS_ATTR(o2hb_heartbeat_group_, dead_threshold);
 CONFIGFS_ATTR(o2hb_heartbeat_group_, mode);
 
 static struct configfs_attribute *o2hb_heartbeat_group_attrs[] = {
-	&o2hb_heartbeat_group_attr_threshold,
+	&o2hb_heartbeat_group_attr_dead_threshold,
 	&o2hb_heartbeat_group_attr_mode,
 	NULL,
 };
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/ocfs2/dlmglue.c linux-libre-4.11.9-gnu/fs/ocfs2/dlmglue.c
--- linux-libre-4.11.8-gnu/fs/ocfs2/dlmglue.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/ocfs2/dlmglue.c	2017-07-05 08:41:57.000000000 -0400
@@ -2591,6 +2591,10 @@ void ocfs2_inode_unlock_tracker(struct i
 	struct ocfs2_lock_res *lockres;
 
 	lockres = &OCFS2_I(inode)->ip_inode_lockres;
+	/* had_lock means that the currect process already takes the cluster
+	 * lock previously. If had_lock is 1, we have nothing to do here, and
+	 * it will get unlocked where we got the lock.
+	 */
 	if (!had_lock) {
 		ocfs2_remove_holder(lockres, oh);
 		ocfs2_inode_unlock(inode, ex);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/ocfs2/xattr.c linux-libre-4.11.9-gnu/fs/ocfs2/xattr.c
--- linux-libre-4.11.8-gnu/fs/ocfs2/xattr.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/ocfs2/xattr.c	2017-07-05 08:41:57.000000000 -0400
@@ -1328,20 +1328,21 @@ static int ocfs2_xattr_get(struct inode
 			   void *buffer,
 			   size_t buffer_size)
 {
-	int ret;
+	int ret, had_lock;
 	struct buffer_head *di_bh = NULL;
+	struct ocfs2_lock_holder oh;
 
-	ret = ocfs2_inode_lock(inode, &di_bh, 0);
-	if (ret < 0) {
-		mlog_errno(ret);
-		return ret;
+	had_lock = ocfs2_inode_lock_tracker(inode, &di_bh, 0, &oh);
+	if (had_lock < 0) {
+		mlog_errno(had_lock);
+		return had_lock;
 	}
 	down_read(&OCFS2_I(inode)->ip_xattr_sem);
 	ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index,
 				     name, buffer, buffer_size);
 	up_read(&OCFS2_I(inode)->ip_xattr_sem);
 
-	ocfs2_inode_unlock(inode, 0);
+	ocfs2_inode_unlock_tracker(inode, 0, &oh, had_lock);
 
 	brelse(di_bh);
 
@@ -3537,11 +3538,12 @@ int ocfs2_xattr_set(struct inode *inode,
 {
 	struct buffer_head *di_bh = NULL;
 	struct ocfs2_dinode *di;
-	int ret, credits, ref_meta = 0, ref_credits = 0;
+	int ret, credits, had_lock, ref_meta = 0, ref_credits = 0;
 	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 	struct inode *tl_inode = osb->osb_tl_inode;
 	struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, NULL, };
 	struct ocfs2_refcount_tree *ref_tree = NULL;
+	struct ocfs2_lock_holder oh;
 
 	struct ocfs2_xattr_info xi = {
 		.xi_name_index = name_index,
@@ -3572,8 +3574,9 @@ int ocfs2_xattr_set(struct inode *inode,
 		return -ENOMEM;
 	}
 
-	ret = ocfs2_inode_lock(inode, &di_bh, 1);
-	if (ret < 0) {
+	had_lock = ocfs2_inode_lock_tracker(inode, &di_bh, 1, &oh);
+	if (had_lock < 0) {
+		ret = had_lock;
 		mlog_errno(ret);
 		goto cleanup_nolock;
 	}
@@ -3670,7 +3673,7 @@ cleanup:
 		if (ret)
 			mlog_errno(ret);
 	}
-	ocfs2_inode_unlock(inode, 1);
+	ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock);
 cleanup_nolock:
 	brelse(di_bh);
 	brelse(xbs.xattr_bh);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/fs/overlayfs/copy_up.c linux-libre-4.11.9-gnu/fs/overlayfs/copy_up.c
--- linux-libre-4.11.8-gnu/fs/overlayfs/copy_up.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/fs/overlayfs/copy_up.c	2017-07-05 08:41:57.000000000 -0400
@@ -252,15 +252,9 @@ static int ovl_copy_up_locked(struct den
 		.link = link
 	};
 
-	upper = lookup_one_len(dentry->d_name.name, upperdir,
-			       dentry->d_name.len);
-	err = PTR_ERR(upper);
-	if (IS_ERR(upper))
-		goto out;
-
 	err = security_inode_copy_up(dentry, &new_creds);
 	if (err < 0)
-		goto out1;
+		goto out;
 
 	if (new_creds)
 		old_creds = override_creds(new_creds);
@@ -284,7 +278,7 @@ static int ovl_copy_up_locked(struct den
 	}
 
 	if (err)
-		goto out2;
+		goto out;
 
 	if (S_ISREG(stat->mode)) {
 		struct path upperpath;
@@ -317,6 +311,14 @@ static int ovl_copy_up_locked(struct den
 	if (err)
 		goto out_cleanup;
 
+	upper = lookup_one_len(dentry->d_name.name, upperdir,
+			       dentry->d_name.len);
+	if (IS_ERR(upper)) {
+		err = PTR_ERR(upper);
+		upper = NULL;
+		goto out_cleanup;
+	}
+
 	if (tmpfile)
 		err = ovl_do_link(temp, udir, upper, true);
 	else
@@ -330,17 +332,15 @@ static int ovl_copy_up_locked(struct den
 
 	/* Restore timestamps on parent (best effort) */
 	ovl_set_timestamps(upperdir, pstat);
-out2:
+out:
 	dput(temp);
-out1:
 	dput(upper);
-out:
 	return err;
 
 out_cleanup:
 	if (!tmpfile)
 		ovl_cleanup(wdir, temp);
-	goto out2;
+	goto out;
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.11.8-gnu/include/linux/netdevice.h linux-libre-4.11.9-gnu/include/linux/netdevice.h
--- linux-libre-4.11.8-gnu/include/linux/netdevice.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/include/linux/netdevice.h	2017-07-05 08:41:57.000000000 -0400
@@ -1581,8 +1581,8 @@ enum netdev_priv_flags {
  *	@rtnl_link_state:	This enum represents the phases of creating
  *				a new link
  *
- *	@destructor:		Called from unregister,
- *				can be used to call free_netdev
+ *	@needs_free_netdev:	Should unregister perform free_netdev?
+ *	@priv_destructor:	Called from unregister
  *	@npinfo:		XXX: need comments on this one
  * 	@nd_net:		Network namespace this network device is inside
  *
@@ -1838,7 +1838,8 @@ struct net_device {
 		RTNL_LINK_INITIALIZING,
 	} rtnl_link_state:16;
 
-	void (*destructor)(struct net_device *dev);
+	bool needs_free_netdev;
+	void (*priv_destructor)(struct net_device *dev);
 
 #ifdef CONFIG_NETPOLL
 	struct netpoll_info __rcu	*npinfo;
@@ -4231,6 +4232,11 @@ static inline const char *netdev_name(co
 	return dev->name;
 }
 
+static inline bool netdev_unregistering(const struct net_device *dev)
+{
+	return dev->reg_state == NETREG_UNREGISTERING;
+}
+
 static inline const char *netdev_reg_state(const struct net_device *dev)
 {
 	switch (dev->reg_state) {
diff -druNp --no-dereference linux-libre-4.11.8-gnu/include/net/xfrm.h linux-libre-4.11.9-gnu/include/net/xfrm.h
--- linux-libre-4.11.8-gnu/include/net/xfrm.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/include/net/xfrm.h	2017-07-05 08:41:57.000000000 -0400
@@ -945,10 +945,6 @@ struct xfrm_dst {
 	struct flow_cache_object flo;
 	struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
 	int num_pols, num_xfrms;
-#ifdef CONFIG_XFRM_SUB_POLICY
-	struct flowi *origin;
-	struct xfrm_selector *partner;
-#endif
 	u32 xfrm_genid;
 	u32 policy_genid;
 	u32 route_mtu_cached;
@@ -964,12 +960,6 @@ static inline void xfrm_dst_destroy(stru
 	dst_release(xdst->route);
 	if (likely(xdst->u.dst.xfrm))
 		xfrm_state_put(xdst->u.dst.xfrm);
-#ifdef CONFIG_XFRM_SUB_POLICY
-	kfree(xdst->origin);
-	xdst->origin = NULL;
-	kfree(xdst->partner);
-	xdst->partner = NULL;
-#endif
 }
 #endif
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/Makefile linux-libre-4.11.9-gnu/Makefile
--- linux-libre-4.11.8-gnu/Makefile	2017-06-29 10:08:59.000000000 -0400
+++ linux-libre-4.11.9-gnu/Makefile	2017-07-05 12:43:42.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 11
-SUBLEVEL = 8
+SUBLEVEL = 9
 EXTRAVERSION = -gnu
 NAME = Fearless Coyote
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/mm/vmalloc.c linux-libre-4.11.9-gnu/mm/vmalloc.c
--- linux-libre-4.11.8-gnu/mm/vmalloc.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/mm/vmalloc.c	2017-07-05 08:41:57.000000000 -0400
@@ -287,10 +287,21 @@ struct page *vmalloc_to_page(const void
 	if (p4d_none(*p4d))
 		return NULL;
 	pud = pud_offset(p4d, addr);
-	if (pud_none(*pud))
+
+	/*
+	 * Don't dereference bad PUD or PMD (below) entries. This will also
+	 * identify huge mappings, which we may encounter on architectures
+	 * that define CONFIG_HAVE_ARCH_HUGE_VMAP=y. Such regions will be
+	 * identified as vmalloc addresses by is_vmalloc_addr(), but are
+	 * not [unambiguously] associated with a struct page, so there is
+	 * no correct value to return for them.
+	 */
+	WARN_ON_ONCE(pud_bad(*pud));
+	if (pud_none(*pud) || pud_bad(*pud))
 		return NULL;
 	pmd = pmd_offset(pud, addr);
-	if (pmd_none(*pmd))
+	WARN_ON_ONCE(pmd_bad(*pmd));
+	if (pmd_none(*pmd) || pmd_bad(*pmd))
 		return NULL;
 
 	ptep = pte_offset_map(pmd, addr);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/8021q/vlan.c linux-libre-4.11.9-gnu/net/8021q/vlan.c
--- linux-libre-4.11.8-gnu/net/8021q/vlan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/8021q/vlan.c	2017-07-05 08:41:57.000000000 -0400
@@ -277,7 +277,8 @@ static int register_vlan_device(struct n
 	return 0;
 
 out_free_newdev:
-	free_netdev(new_dev);
+	if (new_dev->reg_state == NETREG_UNINITIALIZED)
+		free_netdev(new_dev);
 	return err;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/8021q/vlan_dev.c linux-libre-4.11.9-gnu/net/8021q/vlan_dev.c
--- linux-libre-4.11.8-gnu/net/8021q/vlan_dev.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/8021q/vlan_dev.c	2017-07-05 08:41:57.000000000 -0400
@@ -807,7 +807,6 @@ static void vlan_dev_free(struct net_dev
 
 	free_percpu(vlan->vlan_pcpu_stats);
 	vlan->vlan_pcpu_stats = NULL;
-	free_netdev(dev);
 }
 
 void vlan_setup(struct net_device *dev)
@@ -820,7 +819,8 @@ void vlan_setup(struct net_device *dev)
 	netif_keep_dst(dev);
 
 	dev->netdev_ops		= &vlan_netdev_ops;
-	dev->destructor		= vlan_dev_free;
+	dev->needs_free_netdev	= true;
+	dev->priv_destructor	= vlan_dev_free;
 	dev->ethtool_ops	= &vlan_ethtool_ops;
 
 	dev->min_mtu		= 0;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/batman-adv/soft-interface.c linux-libre-4.11.9-gnu/net/batman-adv/soft-interface.c
--- linux-libre-4.11.8-gnu/net/batman-adv/soft-interface.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/batman-adv/soft-interface.c	2017-07-05 08:41:57.000000000 -0400
@@ -961,8 +961,6 @@ static void batadv_softif_free(struct ne
 	 * netdev and its private data (bat_priv)
 	 */
 	rcu_barrier();
-
-	free_netdev(dev);
 }
 
 /**
@@ -976,7 +974,8 @@ static void batadv_softif_init_early(str
 	ether_setup(dev);
 
 	dev->netdev_ops = &batadv_netdev_ops;
-	dev->destructor = batadv_softif_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = batadv_softif_free;
 	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL;
 	dev->priv_flags |= IFF_NO_QUEUE;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/bluetooth/6lowpan.c linux-libre-4.11.9-gnu/net/bluetooth/6lowpan.c
--- linux-libre-4.11.8-gnu/net/bluetooth/6lowpan.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/bluetooth/6lowpan.c	2017-07-05 08:41:57.000000000 -0400
@@ -653,7 +653,7 @@ static void netdev_setup(struct net_devi
 
 	dev->netdev_ops		= &netdev_ops;
 	dev->header_ops		= &header_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 }
 
 static struct device_type bt_type = {
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/bridge/br_device.c linux-libre-4.11.9-gnu/net/bridge/br_device.c
--- linux-libre-4.11.8-gnu/net/bridge/br_device.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/bridge/br_device.c	2017-07-05 08:41:57.000000000 -0400
@@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev
 	ether_setup(dev);
 
 	dev->netdev_ops = &br_netdev_ops;
-	dev->destructor = free_netdev;
+	dev->needs_free_netdev = true;
 	dev->ethtool_ops = &br_ethtool_ops;
 	SET_NETDEV_DEVTYPE(dev, &br_type);
 	dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/caif/cfpkt_skbuff.c linux-libre-4.11.9-gnu/net/caif/cfpkt_skbuff.c
--- linux-libre-4.11.8-gnu/net/caif/cfpkt_skbuff.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/caif/cfpkt_skbuff.c	2017-07-05 08:41:57.000000000 -0400
@@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u1
 {
 	struct sk_buff *skb;
 
-	if (likely(in_interrupt()))
-		skb = alloc_skb(len + pfx, GFP_ATOMIC);
-	else
-		skb = alloc_skb(len + pfx, GFP_KERNEL);
-
+	skb = alloc_skb(len + pfx, GFP_ATOMIC);
 	if (unlikely(skb == NULL))
 		return NULL;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/caif/chnl_net.c linux-libre-4.11.9-gnu/net/caif/chnl_net.c
--- linux-libre-4.11.8-gnu/net/caif/chnl_net.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/caif/chnl_net.c	2017-07-05 08:41:57.000000000 -0400
@@ -392,14 +392,14 @@ static void chnl_net_destructor(struct n
 {
 	struct chnl_net *priv = netdev_priv(dev);
 	caif_free_client(&priv->chnl);
-	free_netdev(dev);
 }
 
 static void ipcaif_net_setup(struct net_device *dev)
 {
 	struct chnl_net *priv;
 	dev->netdev_ops = &netdev_ops;
-	dev->destructor = chnl_net_destructor;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = chnl_net_destructor;
 	dev->flags |= IFF_NOARP;
 	dev->flags |= IFF_POINTOPOINT;
 	dev->mtu = GPRS_PDP_MTU;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/core/dev.c linux-libre-4.11.9-gnu/net/core/dev.c
--- linux-libre-4.11.8-gnu/net/core/dev.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/core/dev.c	2017-07-05 08:41:57.000000000 -0400
@@ -1251,8 +1251,9 @@ int dev_set_alias(struct net_device *dev
 	if (!new_ifalias)
 		return -ENOMEM;
 	dev->ifalias = new_ifalias;
+	memcpy(dev->ifalias, alias, len);
+	dev->ifalias[len] = 0;
 
-	strlcpy(dev->ifalias, alias, len+1);
 	return len;
 }
 
@@ -7345,6 +7346,8 @@ out:
 err_uninit:
 	if (dev->netdev_ops->ndo_uninit)
 		dev->netdev_ops->ndo_uninit(dev);
+	if (dev->priv_destructor)
+		dev->priv_destructor(dev);
 	goto out;
 }
 EXPORT_SYMBOL(register_netdevice);
@@ -7552,8 +7555,10 @@ void netdev_run_todo(void)
 		WARN_ON(rcu_access_pointer(dev->ip6_ptr));
 		WARN_ON(dev->dn_ptr);
 
-		if (dev->destructor)
-			dev->destructor(dev);
+		if (dev->priv_destructor)
+			dev->priv_destructor(dev);
+		if (dev->needs_free_netdev)
+			free_netdev(dev);
 
 		/* Report a network device has been unregistered */
 		rtnl_lock();
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/core/dst.c linux-libre-4.11.9-gnu/net/core/dst.c
--- linux-libre-4.11.8-gnu/net/core/dst.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/core/dst.c	2017-07-05 08:41:57.000000000 -0400
@@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier
 		spin_lock_bh(&dst_garbage.lock);
 		dst = dst_garbage.list;
 		dst_garbage.list = NULL;
+		/* The code in dst_ifdown places a hold on the loopback device.
+		 * If the gc entry processing is set to expire after a lengthy
+		 * interval, this hold can cause netdev_wait_allrefs() to hang
+		 * out and wait for a long time -- until the the loopback
+		 * interface is released.  If we're really unlucky, it'll emit
+		 * pr_emerg messages to console too.  Reset the interval here,
+		 * so dst cleanups occur in a more timely fashion.
+		 */
+		if (dst_garbage.timer_inc > DST_GC_INC) {
+			dst_garbage.timer_inc = DST_GC_INC;
+			dst_garbage.timer_expires = DST_GC_MIN;
+			mod_delayed_work(system_wq, &dst_gc_work,
+					 dst_garbage.timer_expires);
+		}
 		spin_unlock_bh(&dst_garbage.lock);
 
 		if (last)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/core/rtnetlink.c linux-libre-4.11.9-gnu/net/core/rtnetlink.c
--- linux-libre-4.11.8-gnu/net/core/rtnetlink.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/core/rtnetlink.c	2017-07-05 08:41:57.000000000 -0400
@@ -934,6 +934,7 @@ static noinline size_t if_nlmsg_size(con
 	       + nla_total_size(1) /* IFLA_LINKMODE */
 	       + nla_total_size(4) /* IFLA_CARRIER_CHANGES */
 	       + nla_total_size(4) /* IFLA_LINK_NETNSID */
+	       + nla_total_size(4) /* IFLA_GROUP */
 	       + nla_total_size(ext_filter_mask
 			        & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */
 	       + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */
@@ -1127,6 +1128,8 @@ static noinline_for_stack int rtnl_fill_
 	struct ifla_vf_mac vf_mac;
 	struct ifla_vf_info ivi;
 
+	memset(&ivi, 0, sizeof(ivi));
+
 	/* Not all SR-IOV capable drivers support the
 	 * spoofcheck and "RSS query enable" query.  Preset to
 	 * -1 so the user space tool can detect that the driver
@@ -1135,7 +1138,6 @@ static noinline_for_stack int rtnl_fill_
 	ivi.spoofchk = -1;
 	ivi.rss_query_en = -1;
 	ivi.trusted = -1;
-	memset(ivi.mac, 0, sizeof(ivi.mac));
 	/* The default value for VF link state is "auto"
 	 * IFLA_VF_LINK_STATE_AUTO which equals zero
 	 */
@@ -1461,6 +1463,7 @@ static const struct nla_policy ifla_poli
 	[IFLA_LINK_NETNSID]	= { .type = NLA_S32 },
 	[IFLA_PROTO_DOWN]	= { .type = NLA_U8 },
 	[IFLA_XDP]		= { .type = NLA_NESTED },
+	[IFLA_GROUP]		= { .type = NLA_U32 },
 };
 
 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/decnet/dn_route.c linux-libre-4.11.9-gnu/net/decnet/dn_route.c
--- linux-libre-4.11.8-gnu/net/decnet/dn_route.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/decnet/dn_route.c	2017-07-05 08:41:57.000000000 -0400
@@ -188,12 +188,6 @@ static inline void dnrt_free(struct dn_r
 	call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
 }
 
-static inline void dnrt_drop(struct dn_route *rt)
-{
-	dst_release(&rt->dst);
-	call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
-}
-
 static void dn_dst_check_expire(unsigned long dummy)
 {
 	int i;
@@ -248,7 +242,7 @@ static int dn_dst_gc(struct dst_ops *ops
 			}
 			*rtp = rt->dst.dn_next;
 			rt->dst.dn_next = NULL;
-			dnrt_drop(rt);
+			dnrt_free(rt);
 			break;
 		}
 		spin_unlock_bh(&dn_rt_hash_table[i].lock);
@@ -350,7 +344,7 @@ static int dn_insert_route(struct dn_rou
 			dst_use(&rth->dst, now);
 			spin_unlock_bh(&dn_rt_hash_table[hash].lock);
 
-			dnrt_drop(rt);
+			dst_free(&rt->dst);
 			*rp = rth;
 			return 0;
 		}
@@ -380,7 +374,7 @@ static void dn_run_flush(unsigned long d
 		for(; rt; rt = next) {
 			next = rcu_dereference_raw(rt->dst.dn_next);
 			RCU_INIT_POINTER(rt->dst.dn_next, NULL);
-			dst_free((struct dst_entry *)rt);
+			dnrt_free(rt);
 		}
 
 nothing_to_declare:
@@ -1187,7 +1181,7 @@ make_route:
 	if (dev_out->flags & IFF_LOOPBACK)
 		flags |= RTCF_LOCAL;
 
-	rt = dst_alloc(&dn_dst_ops, dev_out, 1, DST_OBSOLETE_NONE, DST_HOST);
+	rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, DST_HOST);
 	if (rt == NULL)
 		goto e_nobufs;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/decnet/netfilter/dn_rtmsg.c linux-libre-4.11.9-gnu/net/decnet/netfilter/dn_rtmsg.c
--- linux-libre-4.11.8-gnu/net/decnet/netfilter/dn_rtmsg.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/decnet/netfilter/dn_rtmsg.c	2017-07-05 08:41:57.000000000 -0400
@@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_sk
 {
 	struct nlmsghdr *nlh = nlmsg_hdr(skb);
 
-	if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+	if (skb->len < sizeof(*nlh) ||
+	    nlh->nlmsg_len < sizeof(*nlh) ||
+	    skb->len < nlh->nlmsg_len)
 		return;
 
 	if (!netlink_capable(skb, CAP_NET_ADMIN))
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/hsr/hsr_device.c linux-libre-4.11.9-gnu/net/hsr/hsr_device.c
--- linux-libre-4.11.8-gnu/net/hsr/hsr_device.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/hsr/hsr_device.c	2017-07-05 08:41:57.000000000 -0400
@@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_d
 	del_timer_sync(&hsr->announce_timer);
 
 	synchronize_rcu();
-	free_netdev(hsr_dev);
 }
 
 static const struct net_device_ops hsr_device_ops = {
@@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *de
 	SET_NETDEV_DEVTYPE(dev, &hsr_type);
 	dev->priv_flags |= IFF_NO_QUEUE;
 
-	dev->destructor = hsr_dev_destroy;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = hsr_dev_destroy;
 
 	dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
 			   NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ieee802154/6lowpan/core.c linux-libre-4.11.9-gnu/net/ieee802154/6lowpan/core.c
--- linux-libre-4.11.8-gnu/net/ieee802154/6lowpan/core.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ieee802154/6lowpan/core.c	2017-07-05 08:41:57.000000000 -0400
@@ -107,7 +107,7 @@ static void lowpan_setup(struct net_devi
 
 	ldev->netdev_ops	= &lowpan_netdev_ops;
 	ldev->header_ops	= &lowpan_header_ops;
-	ldev->destructor	= free_netdev;
+	ldev->needs_free_netdev	= true;
 	ldev->features		|= NETIF_F_NETNS_LOCAL;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv4/esp4.c linux-libre-4.11.9-gnu/net/ipv4/esp4.c
--- linux-libre-4.11.8-gnu/net/ipv4/esp4.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv4/esp4.c	2017-07-05 08:41:57.000000000 -0400
@@ -212,6 +212,7 @@ static int esp_output(struct xfrm_state
 	u8 *iv;
 	u8 *tail;
 	u8 *vaddr;
+	int esph_offset;
 	int blksize;
 	int clen;
 	int alen;
@@ -392,12 +393,14 @@ static int esp_output(struct xfrm_state
 	}
 
 cow:
+	esph_offset = (unsigned char *)esph - skb_transport_header(skb);
+
 	err = skb_cow_data(skb, tailen, &trailer);
 	if (err < 0)
 		goto error;
 	nfrags = err;
 	tail = skb_tail_pointer(trailer);
-	esph = ip_esp_hdr(skb);
+	esph = (struct ip_esp_hdr *)(skb_transport_header(skb) + esph_offset);
 
 skip_cow:
 	esp_output_fill_trailer(tail, tfclen, plen, proto);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv4/icmp.c linux-libre-4.11.9-gnu/net/ipv4/icmp.c
--- linux-libre-4.11.8-gnu/net/ipv4/icmp.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv4/icmp.c	2017-07-05 08:41:57.000000000 -0400
@@ -674,8 +674,12 @@ void icmp_send(struct sk_buff *skb_in, i
 	/* Needed by both icmp_global_allow and icmp_xmit_lock */
 	local_bh_disable();
 
-	/* Check global sysctl_icmp_msgs_per_sec ratelimit */
-	if (!icmpv4_global_allow(net, type, code))
+	/* Check global sysctl_icmp_msgs_per_sec ratelimit, unless
+	 * incoming dev is loopback.  If outgoing dev change to not be
+	 * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow)
+	 */
+	if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) &&
+	      !icmpv4_global_allow(net, type, code))
 		goto out_bh_enable;
 
 	sk = icmp_xmit_lock(net);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv4/igmp.c linux-libre-4.11.9-gnu/net/ipv4/igmp.c
--- linux-libre-4.11.8-gnu/net/ipv4/igmp.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv4/igmp.c	2017-07-05 08:41:57.000000000 -0400
@@ -1112,6 +1112,7 @@ static void igmpv3_add_delrec(struct in_
 	pmc = kzalloc(sizeof(*pmc), GFP_KERNEL);
 	if (!pmc)
 		return;
+	spin_lock_init(&pmc->lock);
 	spin_lock_bh(&im->lock);
 	pmc->interface = im->interface;
 	in_dev_hold(in_dev);
@@ -2071,21 +2072,26 @@ static int ip_mc_add_src(struct in_devic
 
 static void ip_mc_clear_src(struct ip_mc_list *pmc)
 {
-	struct ip_sf_list *psf, *nextpsf;
+	struct ip_sf_list *psf, *nextpsf, *tomb, *sources;
 
-	for (psf = pmc->tomb; psf; psf = nextpsf) {
+	spin_lock_bh(&pmc->lock);
+	tomb = pmc->tomb;
+	pmc->tomb = NULL;
+	sources = pmc->sources;
+	pmc->sources = NULL;
+	pmc->sfmode = MCAST_EXCLUDE;
+	pmc->sfcount[MCAST_INCLUDE] = 0;
+	pmc->sfcount[MCAST_EXCLUDE] = 1;
+	spin_unlock_bh(&pmc->lock);
+
+	for (psf = tomb; psf; psf = nextpsf) {
 		nextpsf = psf->sf_next;
 		kfree(psf);
 	}
-	pmc->tomb = NULL;
-	for (psf = pmc->sources; psf; psf = nextpsf) {
+	for (psf = sources; psf; psf = nextpsf) {
 		nextpsf = psf->sf_next;
 		kfree(psf);
 	}
-	pmc->sources = NULL;
-	pmc->sfmode = MCAST_EXCLUDE;
-	pmc->sfcount[MCAST_INCLUDE] = 0;
-	pmc->sfcount[MCAST_EXCLUDE] = 1;
 }
 
 /* Join a multicast group
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv4/ipmr.c linux-libre-4.11.9-gnu/net/ipv4/ipmr.c
--- linux-libre-4.11.8-gnu/net/ipv4/ipmr.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv4/ipmr.c	2017-07-05 08:41:57.000000000 -0400
@@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_dev
 	dev->mtu		= ETH_DATA_LEN - sizeof(struct iphdr) - 8;
 	dev->flags		= IFF_NOARP;
 	dev->netdev_ops		= &reg_vif_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->features		|= NETIF_F_NETNS_LOCAL;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv4/ip_tunnel.c linux-libre-4.11.9-gnu/net/ipv4/ip_tunnel.c
--- linux-libre-4.11.8-gnu/net/ipv4/ip_tunnel.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv4/ip_tunnel.c	2017-07-05 08:41:57.000000000 -0400
@@ -961,7 +961,6 @@ static void ip_tunnel_dev_free(struct ne
 	gro_cells_destroy(&tunnel->gro_cells);
 	dst_cache_destroy(&tunnel->dst_cache);
 	free_percpu(dev->tstats);
-	free_netdev(dev);
 }
 
 void ip_tunnel_dellink(struct net_device *dev, struct list_head *head)
@@ -1148,7 +1147,8 @@ int ip_tunnel_init(struct net_device *de
 	struct iphdr *iph = &tunnel->parms.iph;
 	int err;
 
-	dev->destructor	= ip_tunnel_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = ip_tunnel_dev_free;
 	dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
 	if (!dev->tstats)
 		return -ENOMEM;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/addrconf.c linux-libre-4.11.9-gnu/net/ipv6/addrconf.c
--- linux-libre-4.11.8-gnu/net/ipv6/addrconf.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/addrconf.c	2017-07-05 08:41:57.000000000 -0400
@@ -328,9 +328,9 @@ static void addrconf_mod_rs_timer(struct
 static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp,
 				   unsigned long delay)
 {
-	if (!delayed_work_pending(&ifp->dad_work))
-		in6_ifa_hold(ifp);
-	mod_delayed_work(addrconf_wq, &ifp->dad_work, delay);
+	in6_ifa_hold(ifp);
+	if (mod_delayed_work(addrconf_wq, &ifp->dad_work, delay))
+		in6_ifa_put(ifp);
 }
 
 static int snmp6_alloc_dev(struct inet6_dev *idev)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/fib6_rules.c linux-libre-4.11.9-gnu/net/ipv6/fib6_rules.c
--- linux-libre-4.11.8-gnu/net/ipv6/fib6_rules.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/fib6_rules.c	2017-07-05 08:41:57.000000000 -0400
@@ -32,7 +32,6 @@ struct fib6_rule {
 struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
 				   int flags, pol_lookup_t lookup)
 {
-	struct rt6_info *rt;
 	struct fib_lookup_arg arg = {
 		.lookup_ptr = lookup,
 		.flags = FIB_LOOKUP_NOREF,
@@ -44,21 +43,11 @@ struct dst_entry *fib6_rule_lookup(struc
 	fib_rules_lookup(net->ipv6.fib6_rules_ops,
 			 flowi6_to_flowi(fl6), flags, &arg);
 
-	rt = arg.result;
-
-	if (!rt) {
-		dst_hold(&net->ipv6.ip6_null_entry->dst);
-		return &net->ipv6.ip6_null_entry->dst;
-	}
-
-	if (rt->rt6i_flags & RTF_REJECT &&
-	    rt->dst.error == -EAGAIN) {
-		ip6_rt_put(rt);
-		rt = net->ipv6.ip6_null_entry;
-		dst_hold(&rt->dst);
-	}
+	if (arg.result)
+		return arg.result;
 
-	return &rt->dst;
+	dst_hold(&net->ipv6.ip6_null_entry->dst);
+	return &net->ipv6.ip6_null_entry->dst;
 }
 
 static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
@@ -121,7 +110,8 @@ static int fib6_rule_action(struct fib_r
 			flp6->saddr = saddr;
 		}
 		err = rt->dst.error;
-		goto out;
+		if (err != -EAGAIN)
+			goto out;
 	}
 again:
 	ip6_rt_put(rt);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/icmp.c linux-libre-4.11.9-gnu/net/ipv6/icmp.c
--- linux-libre-4.11.8-gnu/net/ipv6/icmp.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/icmp.c	2017-07-05 08:41:57.000000000 -0400
@@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *s
 	local_bh_disable();
 
 	/* Check global sysctl_icmp_msgs_per_sec ratelimit */
-	if (!icmpv6_global_allow(type))
+	if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type))
 		goto out_bh_enable;
 
 	mip6_addr_swap(skb);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/ip6_fib.c linux-libre-4.11.9-gnu/net/ipv6/ip6_fib.c
--- linux-libre-4.11.8-gnu/net/ipv6/ip6_fib.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/ip6_fib.c	2017-07-05 08:41:57.000000000 -0400
@@ -289,8 +289,7 @@ struct dst_entry *fib6_rule_lookup(struc
 	struct rt6_info *rt;
 
 	rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags);
-	if (rt->rt6i_flags & RTF_REJECT &&
-	    rt->dst.error == -EAGAIN) {
+	if (rt->dst.error == -EAGAIN) {
 		ip6_rt_put(rt);
 		rt = net->ipv6.ip6_null_entry;
 		dst_hold(&rt->dst);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/ip6_gre.c linux-libre-4.11.9-gnu/net/ipv6/ip6_gre.c
--- linux-libre-4.11.8-gnu/net/ipv6/ip6_gre.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/ip6_gre.c	2017-07-05 08:41:57.000000000 -0400
@@ -986,13 +986,13 @@ static void ip6gre_dev_free(struct net_d
 
 	dst_cache_destroy(&t->dst_cache);
 	free_percpu(dev->tstats);
-	free_netdev(dev);
 }
 
 static void ip6gre_tunnel_setup(struct net_device *dev)
 {
 	dev->netdev_ops = &ip6gre_netdev_ops;
-	dev->destructor = ip6gre_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = ip6gre_dev_free;
 
 	dev->type = ARPHRD_IP6GRE;
 
@@ -1143,7 +1143,7 @@ static int __net_init ip6gre_init_net(st
 	return 0;
 
 err_reg_dev:
-	ip6gre_dev_free(ign->fb_tunnel_dev);
+	free_netdev(ign->fb_tunnel_dev);
 err_alloc_dev:
 	return err;
 }
@@ -1292,7 +1292,8 @@ static void ip6gre_tap_setup(struct net_
 	ether_setup(dev);
 
 	dev->netdev_ops = &ip6gre_tap_netdev_ops;
-	dev->destructor = ip6gre_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = ip6gre_dev_free;
 
 	dev->features |= NETIF_F_NETNS_LOCAL;
 	dev->priv_flags &= ~IFF_TX_SKB_SHARING;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/ip6mr.c linux-libre-4.11.9-gnu/net/ipv6/ip6mr.c
--- linux-libre-4.11.8-gnu/net/ipv6/ip6mr.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/ip6mr.c	2017-07-05 08:41:57.000000000 -0400
@@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_dev
 	dev->mtu		= 1500 - sizeof(struct ipv6hdr) - 8;
 	dev->flags		= IFF_NOARP;
 	dev->netdev_ops		= &reg_vif_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->features		|= NETIF_F_NETNS_LOCAL;
 }
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/ip6_tunnel.c linux-libre-4.11.9-gnu/net/ipv6/ip6_tunnel.c
--- linux-libre-4.11.8-gnu/net/ipv6/ip6_tunnel.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/ip6_tunnel.c	2017-07-05 08:41:57.000000000 -0400
@@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_devi
 	gro_cells_destroy(&t->gro_cells);
 	dst_cache_destroy(&t->dst_cache);
 	free_percpu(dev->tstats);
-	free_netdev(dev);
 }
 
 static int ip6_tnl_create2(struct net_device *dev)
@@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(st
 	return t;
 
 failed_free:
-	ip6_dev_free(dev);
+	free_netdev(dev);
 failed:
 	return ERR_PTR(err);
 }
@@ -1772,7 +1771,8 @@ static const struct net_device_ops ip6_t
 static void ip6_tnl_dev_setup(struct net_device *dev)
 {
 	dev->netdev_ops = &ip6_tnl_netdev_ops;
-	dev->destructor = ip6_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = ip6_dev_free;
 
 	dev->type = ARPHRD_TUNNEL6;
 	dev->flags |= IFF_NOARP;
@@ -2211,7 +2211,7 @@ static int __net_init ip6_tnl_init_net(s
 	return 0;
 
 err_register:
-	ip6_dev_free(ip6n->fb_tnl_dev);
+	free_netdev(ip6n->fb_tnl_dev);
 err_alloc_dev:
 	return err;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/ip6_vti.c linux-libre-4.11.9-gnu/net/ipv6/ip6_vti.c
--- linux-libre-4.11.8-gnu/net/ipv6/ip6_vti.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/ip6_vti.c	2017-07-05 08:41:57.000000000 -0400
@@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, s
 static void vti6_dev_free(struct net_device *dev)
 {
 	free_percpu(dev->tstats);
-	free_netdev(dev);
 }
 
 static int vti6_tnl_create2(struct net_device *dev)
@@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(s
 	return t;
 
 failed_free:
-	vti6_dev_free(dev);
+	free_netdev(dev);
 failed:
 	return NULL;
 }
@@ -841,7 +840,8 @@ static const struct net_device_ops vti6_
 static void vti6_dev_setup(struct net_device *dev)
 {
 	dev->netdev_ops = &vti6_netdev_ops;
-	dev->destructor = vti6_dev_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = vti6_dev_free;
 
 	dev->type = ARPHRD_TUNNEL6;
 	dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr);
@@ -1092,7 +1092,7 @@ static int __net_init vti6_init_net(stru
 	return 0;
 
 err_register:
-	vti6_dev_free(ip6n->fb_tnl_dev);
+	free_netdev(ip6n->fb_tnl_dev);
 err_alloc_dev:
 	return err;
 }
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/proc.c linux-libre-4.11.9-gnu/net/ipv6/proc.c
--- linux-libre-4.11.8-gnu/net/ipv6/proc.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/proc.c	2017-07-05 08:41:57.000000000 -0400
@@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct
 	u64 buff64[SNMP_MIB_MAX];
 	int i;
 
-	memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX);
+	memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX);
 
 	snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff);
 	for (i = 0; itemlist[i].name; i++)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/route.c linux-libre-4.11.9-gnu/net/ipv6/route.c
--- linux-libre-4.11.8-gnu/net/ipv6/route.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/route.c	2017-07-05 08:41:57.000000000 -0400
@@ -2804,6 +2804,7 @@ static int fib6_ifdown(struct rt6_info *
 	if ((rt->dst.dev == dev || !dev) &&
 	    rt != adn->net->ipv6.ip6_null_entry &&
 	    (rt->rt6i_nsiblings == 0 ||
+	     (dev && netdev_unregistering(dev)) ||
 	     !rt->rt6i_idev->cnf.ignore_routes_with_linkdown))
 		return -1;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/sit.c linux-libre-4.11.9-gnu/net/ipv6/sit.c
--- linux-libre-4.11.8-gnu/net/ipv6/sit.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/sit.c	2017-07-05 08:41:57.000000000 -0400
@@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_lo
 	return nt;
 
 failed_free:
-	ipip6_dev_free(dev);
+	free_netdev(dev);
 failed:
 	return NULL;
 }
@@ -1333,7 +1333,6 @@ static void ipip6_dev_free(struct net_de
 
 	dst_cache_destroy(&tunnel->dst_cache);
 	free_percpu(dev->tstats);
-	free_netdev(dev);
 }
 
 #define SIT_FEATURES (NETIF_F_SG	   | \
@@ -1348,7 +1347,8 @@ static void ipip6_tunnel_setup(struct ne
 	int t_hlen = tunnel->hlen + sizeof(struct iphdr);
 
 	dev->netdev_ops		= &ipip6_netdev_ops;
-	dev->destructor		= ipip6_dev_free;
+	dev->needs_free_netdev	= true;
+	dev->priv_destructor	= ipip6_dev_free;
 
 	dev->type		= ARPHRD_SIT;
 	dev->hard_header_len	= LL_MAX_HEADER + t_hlen;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/ipv6/xfrm6_input.c linux-libre-4.11.9-gnu/net/ipv6/xfrm6_input.c
--- linux-libre-4.11.8-gnu/net/ipv6/xfrm6_input.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/ipv6/xfrm6_input.c	2017-07-05 08:41:57.000000000 -0400
@@ -43,8 +43,8 @@ int xfrm6_transport_finish(struct sk_buf
 		return 1;
 #endif
 
-	ipv6_hdr(skb)->payload_len = htons(skb->len);
 	__skb_push(skb, skb->data - skb_network_header(skb));
+	ipv6_hdr(skb)->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
 
 	if (xo && (xo->flags & XFRM_GRO)) {
 		skb_mac_header_rebuild(skb);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/irda/irlan/irlan_eth.c linux-libre-4.11.9-gnu/net/irda/irlan/irlan_eth.c
--- linux-libre-4.11.8-gnu/net/irda/irlan/irlan_eth.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/irda/irlan/irlan_eth.c	2017-07-05 08:41:57.000000000 -0400
@@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_d
 	ether_setup(dev);
 
 	dev->netdev_ops		= &irlan_eth_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 	dev->min_mtu		= 0;
 	dev->max_mtu		= ETH_MAX_MTU;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/key/af_key.c linux-libre-4.11.9-gnu/net/key/af_key.c
--- linux-libre-4.11.8-gnu/net/key/af_key.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/key/af_key.c	2017-07-05 08:41:57.000000000 -0400
@@ -1157,6 +1157,7 @@ static struct xfrm_state * pfkey_msg2xfr
 			goto out;
 	}
 
+	err = -ENOBUFS;
 	key = ext_hdrs[SADB_EXT_KEY_AUTH - 1];
 	if (sa->sadb_sa_auth) {
 		int keysize = 0;
@@ -1168,8 +1169,10 @@ static struct xfrm_state * pfkey_msg2xfr
 		if (key)
 			keysize = (key->sadb_key_bits + 7) / 8;
 		x->aalg = kmalloc(sizeof(*x->aalg) + keysize, GFP_KERNEL);
-		if (!x->aalg)
+		if (!x->aalg) {
+			err = -ENOMEM;
 			goto out;
+		}
 		strcpy(x->aalg->alg_name, a->name);
 		x->aalg->alg_key_len = 0;
 		if (key) {
@@ -1188,8 +1191,10 @@ static struct xfrm_state * pfkey_msg2xfr
 				goto out;
 			}
 			x->calg = kmalloc(sizeof(*x->calg), GFP_KERNEL);
-			if (!x->calg)
+			if (!x->calg) {
+				err = -ENOMEM;
 				goto out;
+			}
 			strcpy(x->calg->alg_name, a->name);
 			x->props.calgo = sa->sadb_sa_encrypt;
 		} else {
@@ -1203,8 +1208,10 @@ static struct xfrm_state * pfkey_msg2xfr
 			if (key)
 				keysize = (key->sadb_key_bits + 7) / 8;
 			x->ealg = kmalloc(sizeof(*x->ealg) + keysize, GFP_KERNEL);
-			if (!x->ealg)
+			if (!x->ealg) {
+				err = -ENOMEM;
 				goto out;
+			}
 			strcpy(x->ealg->alg_name, a->name);
 			x->ealg->alg_key_len = 0;
 			if (key) {
@@ -1249,8 +1256,10 @@ static struct xfrm_state * pfkey_msg2xfr
 		struct xfrm_encap_tmpl *natt;
 
 		x->encap = kmalloc(sizeof(*x->encap), GFP_KERNEL);
-		if (!x->encap)
+		if (!x->encap) {
+			err = -ENOMEM;
 			goto out;
+		}
 
 		natt = x->encap;
 		n_type = ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1];
@@ -2755,6 +2764,8 @@ static int pfkey_spdflush(struct sock *s
 	int err, err2;
 
 	err = xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, true);
+	if (!err)
+		xfrm_garbage_collect(net);
 	err2 = unicast_flush_resp(sk, hdr);
 	if (err || err2) {
 		if (err == -ESRCH) /* empty table - old silent behavior */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/l2tp/l2tp_eth.c linux-libre-4.11.9-gnu/net/l2tp/l2tp_eth.c
--- linux-libre-4.11.8-gnu/net/l2tp/l2tp_eth.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/l2tp/l2tp_eth.c	2017-07-05 08:41:57.000000000 -0400
@@ -133,7 +133,7 @@ static void l2tp_eth_dev_setup(struct ne
 	dev->priv_flags		&= ~IFF_TX_SKB_SHARING;
 	dev->features		|= NETIF_F_LLTX;
 	dev->netdev_ops		= &l2tp_eth_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 }
 
 static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/mac80211/iface.c linux-libre-4.11.9-gnu/net/mac80211/iface.c
--- linux-libre-4.11.8-gnu/net/mac80211/iface.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/mac80211/iface.c	2017-07-05 08:41:57.000000000 -0400
@@ -1198,7 +1198,6 @@ static const struct net_device_ops ieee8
 static void ieee80211_if_free(struct net_device *dev)
 {
 	free_percpu(dev->tstats);
-	free_netdev(dev);
 }
 
 static void ieee80211_if_setup(struct net_device *dev)
@@ -1206,7 +1205,8 @@ static void ieee80211_if_setup(struct ne
 	ether_setup(dev);
 	dev->priv_flags &= ~IFF_TX_SKB_SHARING;
 	dev->netdev_ops = &ieee80211_dataif_ops;
-	dev->destructor = ieee80211_if_free;
+	dev->needs_free_netdev = true;
+	dev->priv_destructor = ieee80211_if_free;
 }
 
 static void ieee80211_if_setup_no_queue(struct net_device *dev)
@@ -1810,6 +1810,7 @@ int ieee80211_if_add(struct ieee80211_lo
 		ret = dev_alloc_name(ndev, ndev->name);
 		if (ret < 0) {
 			ieee80211_if_free(ndev);
+			free_netdev(ndev);
 			return ret;
 		}
 
@@ -1899,7 +1900,7 @@ int ieee80211_if_add(struct ieee80211_lo
 
 		ret = register_netdevice(ndev);
 		if (ret) {
-			ieee80211_if_free(ndev);
+			free_netdev(ndev);
 			return ret;
 		}
 	}
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/mac802154/iface.c linux-libre-4.11.9-gnu/net/mac802154/iface.c
--- linux-libre-4.11.8-gnu/net/mac802154/iface.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/mac802154/iface.c	2017-07-05 08:41:57.000000000 -0400
@@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct n
 	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
 
 	mac802154_llsec_destroy(&sdata->sec);
-
-	free_netdev(dev);
 }
 
 static void ieee802154_if_setup(struct net_device *dev)
@@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154
 					sdata->dev->dev_addr);
 
 		sdata->dev->header_ops = &mac802154_header_ops;
-		sdata->dev->destructor = mac802154_wpan_free;
+		sdata->dev->needs_free_netdev = true;
+		sdata->dev->priv_destructor = mac802154_wpan_free;
 		sdata->dev->netdev_ops = &mac802154_wpan_ops;
 		sdata->dev->ml_priv = &mac802154_mlme_wpan;
 		wpan_dev->promiscuous_mode = false;
@@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154
 
 		break;
 	case NL802154_IFTYPE_MONITOR:
-		sdata->dev->destructor = free_netdev;
+		sdata->dev->needs_free_netdev = true;
 		sdata->dev->netdev_ops = &mac802154_monitor_ops;
 		wpan_dev->promiscuous_mode = true;
 		break;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/netfilter/nf_conntrack_netlink.c linux-libre-4.11.9-gnu/net/netfilter/nf_conntrack_netlink.c
--- linux-libre-4.11.8-gnu/net/netfilter/nf_conntrack_netlink.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/netfilter/nf_conntrack_netlink.c	2017-07-05 08:41:57.000000000 -0400
@@ -45,6 +45,8 @@
 #include <net/netfilter/nf_conntrack_zones.h>
 #include <net/netfilter/nf_conntrack_timestamp.h>
 #include <net/netfilter/nf_conntrack_labels.h>
+#include <net/netfilter/nf_conntrack_seqadj.h>
+#include <net/netfilter/nf_conntrack_synproxy.h>
 #ifdef CONFIG_NF_NAT_NEEDED
 #include <net/netfilter/nf_nat_core.h>
 #include <net/netfilter/nf_nat_l4proto.h>
@@ -1814,6 +1816,8 @@ ctnetlink_create_conntrack(struct net *n
 	nf_ct_tstamp_ext_add(ct, GFP_ATOMIC);
 	nf_ct_ecache_ext_add(ct, 0, 0, GFP_ATOMIC);
 	nf_ct_labels_ext_add(ct);
+	nfct_seqadj_ext_add(ct);
+	nfct_synproxy_ext_add(ct);
 
 	/* we must add conntrack extensions before confirmation. */
 	ct->status |= IPS_CONFIRMED;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/openvswitch/vport-internal_dev.c linux-libre-4.11.9-gnu/net/openvswitch/vport-internal_dev.c
--- linux-libre-4.11.8-gnu/net/openvswitch/vport-internal_dev.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/openvswitch/vport-internal_dev.c	2017-07-05 08:41:57.000000000 -0400
@@ -94,7 +94,6 @@ static void internal_dev_destructor(stru
 	struct vport *vport = ovs_internal_dev_get_vport(dev);
 
 	ovs_vport_free(vport);
-	free_netdev(dev);
 }
 
 static void
@@ -156,7 +155,8 @@ static void do_setup(struct net_device *
 	netdev->priv_flags &= ~IFF_TX_SKB_SHARING;
 	netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH |
 			      IFF_PHONY_HEADROOM | IFF_NO_QUEUE;
-	netdev->destructor = internal_dev_destructor;
+	netdev->needs_free_netdev = true;
+	netdev->priv_destructor = internal_dev_destructor;
 	netdev->ethtool_ops = &internal_dev_ethtool_ops;
 	netdev->rtnl_link_ops = &internal_dev_link_ops;
 
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/phonet/pep-gprs.c linux-libre-4.11.9-gnu/net/phonet/pep-gprs.c
--- linux-libre-4.11.8-gnu/net/phonet/pep-gprs.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/phonet/pep-gprs.c	2017-07-05 08:41:57.000000000 -0400
@@ -236,7 +236,7 @@ static void gprs_setup(struct net_device
 	dev->tx_queue_len	= 10;
 
 	dev->netdev_ops		= &gprs_netdev_ops;
-	dev->destructor		= free_netdev;
+	dev->needs_free_netdev	= true;
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/sctp/socket.c linux-libre-4.11.9-gnu/net/sctp/socket.c
--- linux-libre-4.11.8-gnu/net/sctp/socket.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/sctp/socket.c	2017-07-05 08:41:57.000000000 -0400
@@ -4586,13 +4586,13 @@ int sctp_for_each_endpoint(int (*cb)(str
 
 	for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize;
 	     hash++, head++) {
-		read_lock(&head->lock);
+		read_lock_bh(&head->lock);
 		sctp_for_each_hentry(epb, &head->chain) {
 			err = cb(sctp_ep(epb), p);
 			if (err)
 				break;
 		}
-		read_unlock(&head->lock);
+		read_unlock_bh(&head->lock);
 	}
 
 	return err;
@@ -4630,9 +4630,8 @@ int sctp_for_each_transport(int (*cb)(st
 	if (err)
 		return err;
 
-	sctp_transport_get_idx(net, &hti, pos);
-	obj = sctp_transport_get_next(net, &hti);
-	for (; obj && !IS_ERR(obj); obj = sctp_transport_get_next(net, &hti)) {
+	obj = sctp_transport_get_idx(net, &hti, pos + 1);
+	for (; !IS_ERR_OR_NULL(obj); obj = sctp_transport_get_next(net, &hti)) {
 		struct sctp_transport *transport = obj;
 
 		if (!sctp_transport_hold(transport))
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/tipc/msg.c linux-libre-4.11.9-gnu/net/tipc/msg.c
--- linux-libre-4.11.8-gnu/net/tipc/msg.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/tipc/msg.c	2017-07-05 08:41:57.000000000 -0400
@@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node,  str
 	}
 
 	if (skb_cloned(_skb) &&
-	    pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL))
+	    pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC))
 		goto exit;
 
 	/* Now reverse the concerned fields */
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/unix/af_unix.c linux-libre-4.11.9-gnu/net/unix/af_unix.c
--- linux-libre-4.11.8-gnu/net/unix/af_unix.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/unix/af_unix.c	2017-07-05 08:41:57.000000000 -0400
@@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock
 	struct path path = { NULL, NULL };
 
 	err = -EINVAL;
-	if (sunaddr->sun_family != AF_UNIX)
+	if (addr_len < offsetofend(struct sockaddr_un, sun_family) ||
+	    sunaddr->sun_family != AF_UNIX)
 		goto out;
 
 	if (addr_len == sizeof(short)) {
@@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct soc
 	unsigned int hash;
 	int err;
 
+	err = -EINVAL;
+	if (alen < offsetofend(struct sockaddr, sa_family))
+		goto out;
+
 	if (addr->sa_family != AF_UNSPEC) {
 		err = unix_mkname(sunaddr, alen, &hash);
 		if (err < 0)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/xfrm/xfrm_policy.c linux-libre-4.11.9-gnu/net/xfrm/xfrm_policy.c
--- linux-libre-4.11.8-gnu/net/xfrm/xfrm_policy.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/xfrm/xfrm_policy.c	2017-07-05 08:41:57.000000000 -0400
@@ -1006,10 +1006,6 @@ int xfrm_policy_flush(struct net *net, u
 		err = -ESRCH;
 out:
 	spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
-
-	if (cnt)
-		xfrm_garbage_collect(net);
-
 	return err;
 }
 EXPORT_SYMBOL(xfrm_policy_flush);
@@ -1797,43 +1793,6 @@ free_dst:
 	goto out;
 }
 
-#ifdef CONFIG_XFRM_SUB_POLICY
-static int xfrm_dst_alloc_copy(void **target, const void *src, int size)
-{
-	if (!*target) {
-		*target = kmalloc(size, GFP_ATOMIC);
-		if (!*target)
-			return -ENOMEM;
-	}
-
-	memcpy(*target, src, size);
-	return 0;
-}
-#endif
-
-static int xfrm_dst_update_parent(struct dst_entry *dst,
-				  const struct xfrm_selector *sel)
-{
-#ifdef CONFIG_XFRM_SUB_POLICY
-	struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
-	return xfrm_dst_alloc_copy((void **)&(xdst->partner),
-				   sel, sizeof(*sel));
-#else
-	return 0;
-#endif
-}
-
-static int xfrm_dst_update_origin(struct dst_entry *dst,
-				  const struct flowi *fl)
-{
-#ifdef CONFIG_XFRM_SUB_POLICY
-	struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
-	return xfrm_dst_alloc_copy((void **)&(xdst->origin), fl, sizeof(*fl));
-#else
-	return 0;
-#endif
-}
-
 static int xfrm_expand_policies(const struct flowi *fl, u16 family,
 				struct xfrm_policy **pols,
 				int *num_pols, int *num_xfrms)
@@ -1905,16 +1864,6 @@ xfrm_resolve_and_create_bundle(struct xf
 
 	xdst = (struct xfrm_dst *)dst;
 	xdst->num_xfrms = err;
-	if (num_pols > 1)
-		err = xfrm_dst_update_parent(dst, &pols[1]->selector);
-	else
-		err = xfrm_dst_update_origin(dst, fl);
-	if (unlikely(err)) {
-		dst_free(dst);
-		XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTBUNDLECHECKERROR);
-		return ERR_PTR(err);
-	}
-
 	xdst->num_pols = num_pols;
 	memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols);
 	xdst->policy_genid = atomic_read(&pols[0]->genid);
diff -druNp --no-dereference linux-libre-4.11.8-gnu/net/xfrm/xfrm_user.c linux-libre-4.11.9-gnu/net/xfrm/xfrm_user.c
--- linux-libre-4.11.8-gnu/net/xfrm/xfrm_user.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/net/xfrm/xfrm_user.c	2017-07-05 08:41:57.000000000 -0400
@@ -1999,6 +1999,7 @@ static int xfrm_flush_policy(struct sk_b
 			return 0;
 		return err;
 	}
+	xfrm_garbage_collect(net);
 
 	c.data.type = type;
 	c.event = nlh->nlmsg_type;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/sound/pci/hda/hda_codec.h linux-libre-4.11.9-gnu/sound/pci/hda/hda_codec.h
--- linux-libre-4.11.8-gnu/sound/pci/hda/hda_codec.h	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/sound/pci/hda/hda_codec.h	2017-07-05 08:41:57.000000000 -0400
@@ -294,6 +294,8 @@ struct hda_codec {
 
 #define list_for_each_codec(c, bus) \
 	list_for_each_entry(c, &(bus)->core.codec_list, core.list)
+#define list_for_each_codec_safe(c, n, bus)				\
+	list_for_each_entry_safe(c, n, &(bus)->core.codec_list, core.list)
 
 /* snd_hda_codec_read/write optional flags */
 #define HDA_RW_NO_RESPONSE_FALLBACK	(1 << 0)
diff -druNp --no-dereference linux-libre-4.11.8-gnu/sound/pci/hda/hda_controller.c linux-libre-4.11.9-gnu/sound/pci/hda/hda_controller.c
--- linux-libre-4.11.8-gnu/sound/pci/hda/hda_controller.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/sound/pci/hda/hda_controller.c	2017-07-05 08:41:57.000000000 -0400
@@ -1337,8 +1337,12 @@ EXPORT_SYMBOL_GPL(azx_probe_codecs);
 /* configure each codec instance */
 int azx_codec_configure(struct azx *chip)
 {
-	struct hda_codec *codec;
-	list_for_each_codec(codec, &chip->bus) {
+	struct hda_codec *codec, *next;
+
+	/* use _safe version here since snd_hda_codec_configure() deregisters
+	 * the device upon error and deletes itself from the bus list.
+	 */
+	list_for_each_codec_safe(codec, next, &chip->bus) {
 		snd_hda_codec_configure(codec);
 	}
 	return 0;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/sound/pci/hda/hda_generic.c linux-libre-4.11.9-gnu/sound/pci/hda/hda_generic.c
--- linux-libre-4.11.8-gnu/sound/pci/hda/hda_generic.c	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/sound/pci/hda/hda_generic.c	2017-07-05 08:41:57.000000000 -0400
@@ -3169,6 +3169,7 @@ static int check_dyn_adc_switch(struct h
 						spec->input_paths[i][nums]);
 					spec->input_paths[i][nums] =
 						spec->input_paths[i][n];
+					spec->input_paths[i][n] = 0;
 				}
 			}
 			nums++;
diff -druNp --no-dereference linux-libre-4.11.8-gnu/tools/arch/x86/lib/memcpy_64.S linux-libre-4.11.9-gnu/tools/arch/x86/lib/memcpy_64.S
--- linux-libre-4.11.8-gnu/tools/arch/x86/lib/memcpy_64.S	2017-06-29 07:03:17.000000000 -0400
+++ linux-libre-4.11.9-gnu/tools/arch/x86/lib/memcpy_64.S	2017-07-05 08:41:57.000000000 -0400
@@ -286,7 +286,7 @@ ENDPROC(memcpy_mcsafe_unrolled)
 	_ASM_EXTABLE_FAULT(.L_copy_leading_bytes, .L_memcpy_mcsafe_fail)
 	_ASM_EXTABLE_FAULT(.L_cache_w0, .L_memcpy_mcsafe_fail)
 	_ASM_EXTABLE_FAULT(.L_cache_w1, .L_memcpy_mcsafe_fail)
-	_ASM_EXTABLE_FAULT(.L_cache_w3, .L_memcpy_mcsafe_fail)
+	_ASM_EXTABLE_FAULT(.L_cache_w2, .L_memcpy_mcsafe_fail)
 	_ASM_EXTABLE_FAULT(.L_cache_w3, .L_memcpy_mcsafe_fail)
 	_ASM_EXTABLE_FAULT(.L_cache_w4, .L_memcpy_mcsafe_fail)
 	_ASM_EXTABLE_FAULT(.L_cache_w5, .L_memcpy_mcsafe_fail)
