diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/include/asm/io.h linux-libre-4.13-gnu/arch/alpha/include/asm/io.h
--- linux-libre-4.13-rc7-gnu/arch/alpha/include/asm/io.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/include/asm/io.h	2017-09-03 16:56:17.000000000 -0400
@@ -299,6 +299,7 @@ static inline void __iomem * ioremap_noc
 	return ioremap(offset, size);
 }
 
+#define ioremap_wc ioremap_nocache
 #define ioremap_uc ioremap_nocache
 
 static inline void iounmap(volatile void __iomem *addr)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/include/asm/types.h linux-libre-4.13-gnu/arch/alpha/include/asm/types.h
--- linux-libre-4.13-rc7-gnu/arch/alpha/include/asm/types.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/include/asm/types.h	2017-09-03 16:56:17.000000000 -0400
@@ -1,6 +1,6 @@
 #ifndef _ALPHA_TYPES_H
 #define _ALPHA_TYPES_H
 
-#include <asm-generic/int-ll64.h>
+#include <uapi/asm/types.h>
 
 #endif /* _ALPHA_TYPES_H */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/include/asm/unistd.h linux-libre-4.13-gnu/arch/alpha/include/asm/unistd.h
--- linux-libre-4.13-rc7-gnu/arch/alpha/include/asm/unistd.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/include/asm/unistd.h	2017-09-03 16:56:17.000000000 -0400
@@ -3,7 +3,7 @@
 
 #include <uapi/asm/unistd.h>
 
-#define NR_SYSCALLS			514
+#define NR_SYSCALLS			523
 
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_STAT64
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/include/uapi/asm/types.h linux-libre-4.13-gnu/arch/alpha/include/uapi/asm/types.h
--- linux-libre-4.13-rc7-gnu/arch/alpha/include/uapi/asm/types.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/include/uapi/asm/types.h	2017-09-03 16:56:17.000000000 -0400
@@ -9,8 +9,18 @@
  * need to be careful to avoid a name clashes.
  */
 
-#ifndef __KERNEL__
+/*
+ * This is here because we used to use l64 for alpha
+ * and we don't want to impact user mode with our change to ll64
+ * in the kernel.
+ *
+ * However, some user programs are fine with this.  They can
+ * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
+ */
+#if !defined(__SANE_USERSPACE_TYPES__) && !defined(__KERNEL__)
 #include <asm-generic/int-l64.h>
+#else
+#include <asm-generic/int-ll64.h>
 #endif
 
 #endif /* _UAPI_ALPHA_TYPES_H */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/include/uapi/asm/unistd.h linux-libre-4.13-gnu/arch/alpha/include/uapi/asm/unistd.h
--- linux-libre-4.13-rc7-gnu/arch/alpha/include/uapi/asm/unistd.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/include/uapi/asm/unistd.h	2017-09-03 16:56:17.000000000 -0400
@@ -475,5 +475,19 @@
 #define __NR_getrandom			511
 #define __NR_memfd_create		512
 #define __NR_execveat			513
+#define __NR_seccomp			514
+#define __NR_bpf			515
+#define __NR_userfaultfd		516
+#define __NR_membarrier			517
+#define __NR_mlock2			518
+#define __NR_copy_file_range		519
+#define __NR_preadv2			520
+#define __NR_pwritev2			521
+#define __NR_statx			522
+
+/* Alpha doesn't have protection keys. */
+#define __IGNORE_pkey_mprotect
+#define __IGNORE_pkey_alloc
+#define __IGNORE_pkey_free
 
 #endif /* _UAPI_ALPHA_UNISTD_H */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/kernel/core_marvel.c linux-libre-4.13-gnu/arch/alpha/kernel/core_marvel.c
--- linux-libre-4.13-rc7-gnu/arch/alpha/kernel/core_marvel.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/kernel/core_marvel.c	2017-09-03 16:56:17.000000000 -0400
@@ -351,7 +351,7 @@ marvel_init_io7(struct io7 *io7)
 	}
 }
 
-void
+void __init
 marvel_io7_present(gct6_node *node)
 {
 	int pe;
@@ -369,6 +369,7 @@ marvel_io7_present(gct6_node *node)
 static void __init
 marvel_find_console_vga_hose(void)
 {
+#ifdef CONFIG_VGA_HOSE
 	u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
 
 	if (pu64[7] == 3) {	/* TERM_TYPE == graphics */
@@ -402,9 +403,10 @@ marvel_find_console_vga_hose(void)
 			pci_vga_hose = hose;
 		}
 	}
+#endif
 }
 
-gct6_search_struct gct_wanted_node_list[] = {
+gct6_search_struct gct_wanted_node_list[] __initdata = {
 	{ GCT_TYPE_HOSE, GCT_SUBTYPE_IO_PORT_MODULE, marvel_io7_present },
 	{ 0, 0, NULL }
 };
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/kernel/core_titan.c linux-libre-4.13-gnu/arch/alpha/kernel/core_titan.c
--- linux-libre-4.13-rc7-gnu/arch/alpha/kernel/core_titan.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/kernel/core_titan.c	2017-09-03 16:56:17.000000000 -0400
@@ -461,6 +461,7 @@ titan_ioremap(unsigned long addr, unsign
 	unsigned long *ptes;
 	unsigned long pfn;
 
+#ifdef CONFIG_VGA_HOSE
 	/*
 	 * Adjust the address and hose, if necessary.
 	 */ 
@@ -468,6 +469,7 @@ titan_ioremap(unsigned long addr, unsign
 		h = pci_vga_hose->index;
 		addr += pci_vga_hose->mem_space->start;
 	}
+#endif
 
 	/*
 	 * Find the hose.
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/kernel/module.c linux-libre-4.13-gnu/arch/alpha/kernel/module.c
--- linux-libre-4.13-rc7-gnu/arch/alpha/kernel/module.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/kernel/module.c	2017-09-03 16:56:17.000000000 -0400
@@ -181,6 +181,9 @@ apply_relocate_add(Elf64_Shdr *sechdrs,
 		switch (r_type) {
 		case R_ALPHA_NONE:
 			break;
+		case R_ALPHA_REFLONG:
+			*(u32 *)location = value;
+			break;
 		case R_ALPHA_REFQUAD:
 			/* BUG() can produce misaligned relocations. */
 			((u32 *)location)[0] = value;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/kernel/smp.c linux-libre-4.13-gnu/arch/alpha/kernel/smp.c
--- linux-libre-4.13-rc7-gnu/arch/alpha/kernel/smp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/kernel/smp.c	2017-09-03 16:56:17.000000000 -0400
@@ -115,7 +115,7 @@ wait_boot_cpu_to_stop(int cpuid)
 /*
  * Where secondaries begin a life of C.
  */
-void
+void __init
 smp_callin(void)
 {
 	int cpuid = hard_smp_processor_id();
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/kernel/systbls.S linux-libre-4.13-gnu/arch/alpha/kernel/systbls.S
--- linux-libre-4.13-rc7-gnu/arch/alpha/kernel/systbls.S	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/kernel/systbls.S	2017-09-03 16:56:17.000000000 -0400
@@ -532,6 +532,15 @@ sys_call_table:
 	.quad sys_getrandom
 	.quad sys_memfd_create
 	.quad sys_execveat
+	.quad sys_seccomp
+	.quad sys_bpf				/* 515 */
+	.quad sys_userfaultfd
+	.quad sys_membarrier
+	.quad sys_mlock2
+	.quad sys_copy_file_range
+	.quad sys_preadv2			/* 520 */
+	.quad sys_pwritev2
+	.quad sys_statx
 
 	.size sys_call_table, . - sys_call_table
 	.type sys_call_table, @object
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/lib/copy_user.S linux-libre-4.13-gnu/arch/alpha/lib/copy_user.S
--- linux-libre-4.13-rc7-gnu/arch/alpha/lib/copy_user.S	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/lib/copy_user.S	2017-09-03 16:56:17.000000000 -0400
@@ -34,7 +34,7 @@
 	.ent __copy_user
 __copy_user:
 	.prologue 0
-	and $18,$18,$0
+	mov $18,$0
 	and $16,7,$3
 	beq $0,$35
 	beq $3,$36
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/lib/ev6-copy_user.S linux-libre-4.13-gnu/arch/alpha/lib/ev6-copy_user.S
--- linux-libre-4.13-rc7-gnu/arch/alpha/lib/ev6-copy_user.S	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/lib/ev6-copy_user.S	2017-09-03 16:56:17.000000000 -0400
@@ -45,9 +45,10 @@
 				# Pipeline info: Slotting & Comments
 __copy_user:
 	.prologue 0
-	andq $18, $18, $0
-	subq $18, 32, $1	# .. E  .. ..	: Is this going to be a small copy?
-	beq $0, $zerolength	# U  .. .. ..	: U L U L
+	mov $18, $0		# .. .. .. E
+	subq $18, 32, $1	# .. .. E. ..	: Is this going to be a small copy?
+	nop			# .. E  .. ..
+	beq $18, $zerolength	# U  .. .. ..	: U L U L
 
 	and $16,7,$3		# .. .. .. E	: is leading dest misalignment
 	ble $1, $onebyteloop	# .. .. U  ..	: 1st branch : small amount of data
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/alpha/lib/Makefile linux-libre-4.13-gnu/arch/alpha/lib/Makefile
--- linux-libre-4.13-rc7-gnu/arch/alpha/lib/Makefile	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/alpha/lib/Makefile	2017-09-03 16:56:17.000000000 -0400
@@ -20,12 +20,8 @@ lib-y =	__divqu.o __remqu.o __divlu.o __
 	checksum.o \
 	csum_partial_copy.o \
 	$(ev67-y)strlen.o \
-	$(ev67-y)strcat.o \
-	strcpy.o \
-	$(ev67-y)strncat.o \
-	strncpy.o \
-	$(ev6-y)stxcpy.o \
-	$(ev6-y)stxncpy.o \
+	stycpy.o \
+	styncpy.o \
 	$(ev67-y)strchr.o \
 	$(ev67-y)strrchr.o \
 	$(ev6-y)memchr.o \
@@ -49,3 +45,17 @@ AFLAGS___remlu.o =       -DREM -DINTSIZE
 $(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): \
 						$(src)/$(ev6-y)divide.S FORCE
 	$(call if_changed_rule,as_o_S)
+
+# There are direct branches between {str*cpy,str*cat} and stx*cpy.
+# Ensure the branches are within range by merging these objects.
+
+LDFLAGS_stycpy.o := -r
+LDFLAGS_styncpy.o := -r
+
+$(obj)/stycpy.o: $(obj)/strcpy.o $(obj)/$(ev67-y)strcat.o \
+		 $(obj)/$(ev6-y)stxcpy.o FORCE
+	$(call if_changed,ld)
+
+$(obj)/styncpy.o: $(obj)/strncpy.o $(obj)/$(ev67-y)strncat.o \
+		 $(obj)/$(ev6-y)stxncpy.o FORCE
+	$(call if_changed,ld)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arc/kernel/intc-arcv2.c linux-libre-4.13-gnu/arch/arc/kernel/intc-arcv2.c
--- linux-libre-4.13-rc7-gnu/arch/arc/kernel/intc-arcv2.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arc/kernel/intc-arcv2.c	2017-09-03 16:56:17.000000000 -0400
@@ -75,13 +75,20 @@ void arc_init_IRQ(void)
 	 * Set a default priority for all available interrupts to prevent
 	 * switching of register banks if Fast IRQ and multiple register banks
 	 * are supported by CPU.
-	 * Also disable all IRQ lines so faulty external hardware won't
+	 * Also disable private-per-core IRQ lines so faulty external HW won't
 	 * trigger interrupt that kernel is not ready to handle.
 	 */
 	for (i = NR_EXCEPTIONS; i < irq_bcr.irqs + NR_EXCEPTIONS; i++) {
 		write_aux_reg(AUX_IRQ_SELECT, i);
 		write_aux_reg(AUX_IRQ_PRIORITY, ARCV2_IRQ_DEF_PRIO);
-		write_aux_reg(AUX_IRQ_ENABLE, 0);
+
+		/*
+		 * Only mask cpu private IRQs here.
+		 * "common" interrupts are masked at IDU, otherwise it would
+		 * need to be unmasked at each cpu, with IPIs
+		 */
+		if (i < FIRST_EXT_IRQ)
+			write_aux_reg(AUX_IRQ_ENABLE, 0);
 	}
 
 	/* setup status32, don't enable intr yet as kernel doesn't want */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arc/kernel/intc-compact.c linux-libre-4.13-gnu/arch/arc/kernel/intc-compact.c
--- linux-libre-4.13-rc7-gnu/arch/arc/kernel/intc-compact.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arc/kernel/intc-compact.c	2017-09-03 16:56:17.000000000 -0400
@@ -27,7 +27,7 @@
  */
 void arc_init_IRQ(void)
 {
-	int level_mask = 0, i;
+	unsigned int level_mask = 0, i;
 
        /* Is timer high priority Interrupt (Level2 in ARCompact jargon) */
 	level_mask |= IS_ENABLED(CONFIG_ARC_COMPACT_IRQ_LEVELS) << TIMER0_IRQ;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts	2017-09-03 16:56:17.000000000 -0400
@@ -56,8 +56,6 @@
 
 	aliases {
 		serial0 = &uart0;
-		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
-		ethernet0 = &emac;
 		ethernet1 = &xr819;
 	};
 
@@ -104,13 +102,6 @@
 	status = "okay";
 };
 
-&emac {
-	phy-handle = <&int_mii_phy>;
-	phy-mode = "mii";
-	allwinner,leds-active-low;
-	status = "okay";
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts	2017-09-03 16:56:17.000000000 -0400
@@ -52,7 +52,6 @@
 	compatible = "sinovoip,bpi-m2-plus", "allwinner,sun8i-h3";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 		serial1 = &uart1;
 	};
@@ -115,30 +114,12 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-supply = <&reg_gmac_3v3>;
-	phy-handle = <&ext_rgmii_phy>;
-	phy-mode = "rgmii";
-
-	allwinner,leds-active-low;
-	status = "okay";
-};
-
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
 	status = "okay";
 };
 
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <0>;
-	};
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts	2017-09-03 16:56:17.000000000 -0400
@@ -46,10 +46,3 @@
 	model = "FriendlyARM NanoPi NEO";
 	compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
 };
-
-&emac {
-	phy-handle = <&int_mii_phy>;
-	phy-mode = "mii";
-	allwinner,leds-active-low;
-	status = "okay";
-};
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts	2017-09-03 16:56:17.000000000 -0400
@@ -54,7 +54,6 @@
 	aliases {
 		serial0 = &uart0;
 		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
-		ethernet0 = &emac;
 		ethernet1 = &rtl8189;
 	};
 
@@ -118,13 +117,6 @@
 	status = "okay";
 };
 
-&emac {
-	phy-handle = <&int_mii_phy>;
-	phy-mode = "mii";
-	allwinner,leds-active-low;
-	status = "okay";
-};
-
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts	2017-09-03 16:56:17.000000000 -0400
@@ -52,7 +52,6 @@
 	compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -98,13 +97,6 @@
 	status = "okay";
 };
 
-&emac {
-	phy-handle = <&int_mii_phy>;
-	phy-mode = "mii";
-	allwinner,leds-active-low;
-	status = "okay";
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts	2017-09-03 16:56:17.000000000 -0400
@@ -52,7 +52,6 @@
 	compatible = "xunlong,orangepi-pc", "allwinner,sun8i-h3";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -114,13 +113,6 @@
 	status = "okay";
 };
 
-&emac {
-	phy-handle = <&int_mii_phy>;
-	phy-mode = "mii";
-	allwinner,leds-active-low;
-	status = "okay";
-};
-
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts	2017-09-03 16:56:17.000000000 -0400
@@ -53,11 +53,6 @@
 	};
 };
 
-&emac {
-	/* LEDs changed to active high on the plus */
-	/delete-property/ allwinner,leds-active-low;
-};
-
 &mmc1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc1_pins_a>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts	2017-09-03 16:56:17.000000000 -0400
@@ -61,19 +61,3 @@
 		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
 	};
 };
-
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-supply = <&reg_gmac_3v3>;
-	phy-handle = <&ext_rgmii_phy>;
-	phy-mode = "rgmii";
-	status = "okay";
-};
-
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts	2017-09-03 16:56:17.000000000 -0400
@@ -47,10 +47,6 @@
 	model = "Xunlong Orange Pi Plus / Plus 2";
 	compatible = "xunlong,orangepi-plus", "allwinner,sun8i-h3";
 
-	aliases {
-		ethernet0 = &emac;
-	};
-
 	reg_gmac_3v3: gmac-3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "gmac-3v3";
@@ -78,24 +74,6 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-supply = <&reg_gmac_3v3>;
-	phy-handle = <&ext_rgmii_phy>;
-	phy-mode = "rgmii";
-
-	allwinner,leds-active-low;
-	status = "okay";
-};
-
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <0>;
-	};
-};
-
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_8bit_pins>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sunxi-h3-h5.dtsi linux-libre-4.13-gnu/arch/arm/boot/dts/sunxi-h3-h5.dtsi
--- linux-libre-4.13-rc7-gnu/arch/arm/boot/dts/sunxi-h3-h5.dtsi	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/boot/dts/sunxi-h3-h5.dtsi	2017-09-03 16:56:17.000000000 -0400
@@ -391,32 +391,6 @@
 			clocks = <&osc24M>;
 		};
 
-		emac: ethernet@1c30000 {
-			compatible = "allwinner,sun8i-h3-emac";
-			syscon = <&syscon>;
-			reg = <0x01c30000 0x10000>;
-			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "macirq";
-			resets = <&ccu RST_BUS_EMAC>;
-			reset-names = "stmmaceth";
-			clocks = <&ccu CLK_BUS_EMAC>;
-			clock-names = "stmmaceth";
-			#address-cells = <1>;
-			#size-cells = <0>;
-			status = "disabled";
-
-			mdio: mdio {
-				#address-cells = <1>;
-				#size-cells = <0>;
-				int_mii_phy: ethernet-phy@1 {
-					compatible = "ethernet-phy-ieee802.3-c22";
-					reg = <1>;
-					clocks = <&ccu CLK_BUS_EPHY>;
-					resets = <&ccu RST_BUS_EPHY>;
-				};
-			};
-		};
-
 		spi0: spi@01c68000 {
 			compatible = "allwinner,sun8i-h3-spi";
 			reg = <0x01c68000 0x1000>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm/include/asm/kvm_host.h linux-libre-4.13-gnu/arch/arm/include/asm/kvm_host.h
--- linux-libre-4.13-rc7-gnu/arch/arm/include/asm/kvm_host.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm/include/asm/kvm_host.h	2017-09-03 16:56:17.000000000 -0400
@@ -225,12 +225,6 @@ int kvm_arm_copy_reg_indices(struct kvm_
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 
-/* We do not have shadow page tables, hence the empty hooks */
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-							 unsigned long address)
-{
-}
-
 struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
 struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
 void kvm_arm_halt_guest(struct kvm *kvm);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts	2017-09-03 16:56:17.000000000 -0400
@@ -51,7 +51,6 @@
 	compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 		serial1 = &uart1;
 	};
@@ -68,14 +67,6 @@
 	};
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&rgmii_pins>;
-	phy-mode = "rgmii";
-	phy-handle = <&ext_rgmii_phy>;
-	status = "okay";
-};
-
 &i2c1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c1_pins>;
@@ -86,13 +77,6 @@
 	bias-pull-up;
 };
 
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi	2017-09-03 16:56:17.000000000 -0400
@@ -449,26 +449,6 @@
 			#size-cells = <0>;
 		};
 
-		emac: ethernet@1c30000 {
-			compatible = "allwinner,sun50i-a64-emac";
-			syscon = <&syscon>;
-			reg = <0x01c30000 0x10000>;
-			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-			interrupt-names = "macirq";
-			resets = <&ccu RST_BUS_EMAC>;
-			reset-names = "stmmaceth";
-			clocks = <&ccu CLK_BUS_EMAC>;
-			clock-names = "stmmaceth";
-			status = "disabled";
-			#address-cells = <1>;
-			#size-cells = <0>;
-
-			mdio: mdio {
-				#address-cells = <1>;
-				#size-cells = <0>;
-			};
-		};
-
 		gic: interrupt-controller@1c81000 {
 			compatible = "arm,gic-400";
 			reg = <0x01c81000 0x1000>,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts	2017-09-03 16:56:17.000000000 -0400
@@ -51,7 +51,6 @@
 	compatible = "pine64,pine64", "allwinner,sun50i-a64";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 		serial1 = &uart1;
 		serial2 = &uart2;
@@ -79,15 +78,6 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&rmii_pins>;
-	phy-mode = "rmii";
-	phy-handle = <&ext_rmii_phy1>;
-	status = "okay";
-
-};
-
 &i2c1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c1_pins>;
@@ -98,13 +88,6 @@
 	bias-pull-up;
 };
 
-&mdio {
-	ext_rmii_phy1: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts	2017-09-03 16:56:17.000000000 -0400
@@ -48,18 +48,3 @@
 
 	/* TODO: Camera, touchscreen, etc. */
 };
-
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&rgmii_pins>;
-	phy-mode = "rgmii";
-	phy-handle = <&ext_rgmii_phy>;
-	status = "okay";
-};
-
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts	2017-09-03 16:56:17.000000000 -0400
@@ -53,7 +53,6 @@
 		     "allwinner,sun50i-a64";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -77,21 +76,6 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&rgmii_pins>;
-	phy-mode = "rgmii";
-	phy-handle = <&ext_rgmii_phy>;
-	status = "okay";
-};
-
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
-
 &mmc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_pins>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts	2017-09-03 16:56:17.000000000 -0400
@@ -50,7 +50,6 @@
 	compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -109,22 +108,6 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-supply = <&reg_gmac_3v3>;
-	phy-handle = <&ext_rgmii_phy>;
-	phy-mode = "rgmii";
-	status = "okay";
-};
-
-&mdio {
-	ext_rgmii_phy: ethernet-phy@7 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <7>;
-	};
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts	2017-09-03 16:56:17.000000000 -0400
@@ -59,7 +59,6 @@
 	};
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -137,28 +136,12 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-supply = <&reg_gmac_3v3>;
-	phy-handle = <&ext_rgmii_phy>;
-	phy-mode = "rgmii";
-	status = "okay";
-};
-
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
 	status = "okay";
 };
 
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-prime.dts	2017-09-03 16:56:17.000000000 -0400
@@ -54,7 +54,6 @@
 	compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
 
 	aliases {
-		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -144,28 +143,12 @@
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-supply = <&reg_gmac_3v3>;
-	phy-handle = <&ext_rgmii_phy>;
-	phy-mode = "rgmii";
-	status = "okay";
-};
-
 &ir {
 	pinctrl-names = "default";
 	pinctrl-0 = <&ir_pins_a>;
 	status = "okay";
 };
 
-&mdio {
-	ext_rgmii_phy: ethernet-phy@1 {
-		compatible = "ethernet-phy-ieee802.3-c22";
-		reg = <1>;
-	};
-};
-
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/marvell/armada-ap806.dtsi linux-libre-4.13-gnu/arch/arm64/boot/dts/marvell/armada-ap806.dtsi
--- linux-libre-4.13-rc7-gnu/arch/arm64/boot/dts/marvell/armada-ap806.dtsi	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/boot/dts/marvell/armada-ap806.dtsi	2017-09-03 16:56:17.000000000 -0400
@@ -268,10 +268,10 @@
 				ap_gpio: gpio {
 					compatible = "marvell,armada-8k-gpio";
 					offset = <0x1040>;
-					ngpios = <19>;
+					ngpios = <20>;
 					gpio-controller;
 					#gpio-cells = <2>;
-					gpio-ranges = <&ap_pinctrl 0 0 19>;
+					gpio-ranges = <&ap_pinctrl 0 0 20>;
 				};
 			};
 		};
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/arm64/include/asm/kvm_host.h linux-libre-4.13-gnu/arch/arm64/include/asm/kvm_host.h
--- linux-libre-4.13-rc7-gnu/arch/arm64/include/asm/kvm_host.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/arm64/include/asm/kvm_host.h	2017-09-03 16:56:17.000000000 -0400
@@ -326,12 +326,6 @@ void kvm_set_spte_hva(struct kvm *kvm, u
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 
-/* We do not have shadow page tables, hence the empty hooks */
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-							 unsigned long address)
-{
-}
-
 struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
 struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
 void kvm_arm_halt_guest(struct kvm *kvm);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/configs/dsk6455_defconfig linux-libre-4.13-gnu/arch/c6x/configs/dsk6455_defconfig
--- linux-libre-4.13-rc7-gnu/arch/c6x/configs/dsk6455_defconfig	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/configs/dsk6455_defconfig	2017-09-03 16:56:17.000000000 -0400
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6455=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -25,7 +24,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6457_defconfig linux-libre-4.13-gnu/arch/c6x/configs/evmc6457_defconfig
--- linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6457_defconfig	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/configs/evmc6457_defconfig	2017-09-03 16:56:17.000000000 -0400
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6457=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -26,7 +25,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6472_defconfig linux-libre-4.13-gnu/arch/c6x/configs/evmc6472_defconfig
--- linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6472_defconfig	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/configs/evmc6472_defconfig	2017-09-03 16:56:17.000000000 -0400
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6472=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6474_defconfig linux-libre-4.13-gnu/arch/c6x/configs/evmc6474_defconfig
--- linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6474_defconfig	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/configs/evmc6474_defconfig	2017-09-03 16:56:17.000000000 -0400
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6474=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6678_defconfig linux-libre-4.13-gnu/arch/c6x/configs/evmc6678_defconfig
--- linux-libre-4.13-rc7-gnu/arch/c6x/configs/evmc6678_defconfig	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/configs/evmc6678_defconfig	2017-09-03 16:56:17.000000000 -0400
@@ -1,5 +1,4 @@
 CONFIG_SOC_TMS320C6678=y
-CONFIG_EXPERIMENTAL=y
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SYSVIPC=y
 CONFIG_SPARSE_IRQ=y
@@ -27,7 +26,6 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=17000
-CONFIG_MISC_DEVICES=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/platforms/megamod-pic.c linux-libre-4.13-gnu/arch/c6x/platforms/megamod-pic.c
--- linux-libre-4.13-rc7-gnu/arch/c6x/platforms/megamod-pic.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/platforms/megamod-pic.c	2017-09-03 16:56:17.000000000 -0400
@@ -208,14 +208,14 @@ static struct megamod_pic * __init init_
 
 	pic = kzalloc(sizeof(struct megamod_pic), GFP_KERNEL);
 	if (!pic) {
-		pr_err("%s: Could not alloc PIC structure.\n", np->full_name);
+		pr_err("%pOF: Could not alloc PIC structure.\n", np);
 		return NULL;
 	}
 
 	pic->irqhost = irq_domain_add_linear(np, NR_COMBINERS * 32,
 					     &megamod_domain_ops, pic);
 	if (!pic->irqhost) {
-		pr_err("%s: Could not alloc host.\n", np->full_name);
+		pr_err("%pOF: Could not alloc host.\n", np);
 		goto error_free;
 	}
 
@@ -225,7 +225,7 @@ static struct megamod_pic * __init init_
 
 	pic->regs = of_iomap(np, 0);
 	if (!pic->regs) {
-		pr_err("%s: Could not map registers.\n", np->full_name);
+		pr_err("%pOF: Could not map registers.\n", np);
 		goto error_free;
 	}
 
@@ -253,8 +253,8 @@ static struct megamod_pic * __init init_
 
 		irq_data = irq_get_irq_data(irq);
 		if (!irq_data) {
-			pr_err("%s: combiner-%d no irq_data for virq %d!\n",
-			       np->full_name, i, irq);
+			pr_err("%pOF: combiner-%d no irq_data for virq %d!\n",
+			       np, i, irq);
 			continue;
 		}
 
@@ -265,16 +265,16 @@ static struct megamod_pic * __init init_
 		 * of the core priority interrupts (4 - 15).
 		 */
 		if (hwirq < 4 || hwirq >= NR_PRIORITY_IRQS) {
-			pr_err("%s: combiner-%d core irq %ld out of range!\n",
-			       np->full_name, i, hwirq);
+			pr_err("%pOF: combiner-%d core irq %ld out of range!\n",
+			       np, i, hwirq);
 			continue;
 		}
 
 		/* record the mapping */
 		mapping[hwirq - 4] = i;
 
-		pr_debug("%s: combiner-%d cascading to hwirq %ld\n",
-			 np->full_name, i, hwirq);
+		pr_debug("%pOF: combiner-%d cascading to hwirq %ld\n",
+			 np, i, hwirq);
 
 		cascade_data[i].pic = pic;
 		cascade_data[i].index = i;
@@ -290,8 +290,8 @@ static struct megamod_pic * __init init_
 	/* Finally, set up the MUX registers */
 	for (i = 0; i < NR_MUX_OUTPUTS; i++) {
 		if (mapping[i] != IRQ_UNMAPPED) {
-			pr_debug("%s: setting mux %d to priority %d\n",
-				 np->full_name, mapping[i], i + 4);
+			pr_debug("%pOF: setting mux %d to priority %d\n",
+				 np, mapping[i], i + 4);
 			set_megamod_mux(pic, mapping[i], i);
 		}
 	}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/platforms/plldata.c linux-libre-4.13-gnu/arch/c6x/platforms/plldata.c
--- linux-libre-4.13-rc7-gnu/arch/c6x/platforms/plldata.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/platforms/plldata.c	2017-09-03 16:56:17.000000000 -0400
@@ -436,8 +436,8 @@ void __init c64x_setup_clocks(void)
 
 	err = of_property_read_u32(node, "clock-frequency", &val);
 	if (err || val == 0) {
-		pr_err("%s: no clock-frequency found! Using %dMHz\n",
-		       node->full_name, (int)val / 1000000);
+		pr_err("%pOF: no clock-frequency found! Using %dMHz\n",
+		       node, (int)val / 1000000);
 		val = 25000000;
 	}
 	clkin1.rate = val;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/c6x/platforms/timer64.c linux-libre-4.13-gnu/arch/c6x/platforms/timer64.c
--- linux-libre-4.13-rc7-gnu/arch/c6x/platforms/timer64.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/c6x/platforms/timer64.c	2017-09-03 16:56:17.000000000 -0400
@@ -204,14 +204,14 @@ void __init timer64_init(void)
 
 	timer = of_iomap(np, 0);
 	if (!timer) {
-		pr_debug("%s: Cannot map timer registers.\n", np->full_name);
+		pr_debug("%pOF: Cannot map timer registers.\n", np);
 		goto out;
 	}
-	pr_debug("%s: Timer registers=%p.\n", np->full_name, timer);
+	pr_debug("%pOF: Timer registers=%p.\n", np, timer);
 
 	cd->irq	= irq_of_parse_and_map(np, 0);
 	if (cd->irq == NO_IRQ) {
-		pr_debug("%s: Cannot find interrupt.\n", np->full_name);
+		pr_debug("%pOF: Cannot find interrupt.\n", np);
 		iounmap(timer);
 		goto out;
 	}
@@ -229,7 +229,7 @@ void __init timer64_init(void)
 		dscr_set_devstate(timer64_devstate_id, DSCR_DEVSTATE_ENABLED);
 	}
 
-	pr_debug("%s: Timer irq=%d.\n", np->full_name, cd->irq);
+	pr_debug("%pOF: Timer irq=%d.\n", np, cd->irq);
 
 	clockevents_calc_mult_shift(cd, c6x_core_freq / TIMER_DIVISOR, 5);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/mips/include/asm/kvm_host.h linux-libre-4.13-gnu/arch/mips/include/asm/kvm_host.h
--- linux-libre-4.13-rc7-gnu/arch/mips/include/asm/kvm_host.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/mips/include/asm/kvm_host.h	2017-09-03 16:56:17.000000000 -0400
@@ -938,11 +938,6 @@ void kvm_set_spte_hva(struct kvm *kvm, u
 int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
 int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-							 unsigned long address)
-{
-}
-
 /* Emulation */
 int kvm_get_inst(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
 enum emulation_result update_pc(struct kvm_vcpu *vcpu, u32 cause);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/mips/kernel/ptrace.c linux-libre-4.13-gnu/arch/mips/kernel/ptrace.c
--- linux-libre-4.13-rc7-gnu/arch/mips/kernel/ptrace.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/mips/kernel/ptrace.c	2017-09-03 16:56:17.000000000 -0400
@@ -872,15 +872,13 @@ asmlinkage long syscall_trace_enter(stru
 	if (unlikely(test_thread_flag(TIF_SECCOMP))) {
 		int ret, i;
 		struct seccomp_data sd;
+		unsigned long args[6];
 
 		sd.nr = syscall;
 		sd.arch = syscall_get_arch();
-		for (i = 0; i < 6; i++) {
-			unsigned long v, r;
-
-			r = mips_get_syscall_arg(&v, current, regs, i);
-			sd.args[i] = r ? 0 : v;
-		}
+		syscall_get_arguments(current, regs, 0, 6, args);
+		for (i = 0; i < 6; i++)
+			sd.args[i] = args[i];
 		sd.instruction_pointer = KSTK_EIP(current);
 
 		ret = __secure_computing(&sd);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/mips/kernel/scall32-o32.S linux-libre-4.13-gnu/arch/mips/kernel/scall32-o32.S
--- linux-libre-4.13-rc7-gnu/arch/mips/kernel/scall32-o32.S	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/mips/kernel/scall32-o32.S	2017-09-03 16:56:17.000000000 -0400
@@ -190,12 +190,6 @@ illegal_syscall:
 	sll	t1, t0, 2
 	beqz	v0, einval
 	lw	t2, sys_call_table(t1)		# syscall routine
-	sw	a0, PT_R2(sp)			# call routine directly on restart
-
-	/* Some syscalls like execve get their arguments from struct pt_regs
-	   and claim zero arguments in the syscall table. Thus we have to
-	   assume the worst case and shuffle around all potential arguments.
-	   If you want performance, don't use indirect syscalls. */
 
 	move	a0, a1				# shift argument registers
 	move	a1, a2
@@ -207,11 +201,6 @@ illegal_syscall:
 	sw	t4, 16(sp)
 	sw	t5, 20(sp)
 	sw	t6, 24(sp)
-	sw	a0, PT_R4(sp)			# .. and push back a0 - a3, some
-	sw	a1, PT_R5(sp)			# syscalls expect them there
-	sw	a2, PT_R6(sp)
-	sw	a3, PT_R7(sp)
-	sw	a3, PT_R26(sp)			# update a3 for syscall restarting
 	jr	t2
 	/* Unreached */
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/mips/kernel/scall64-o32.S linux-libre-4.13-gnu/arch/mips/kernel/scall64-o32.S
--- linux-libre-4.13-rc7-gnu/arch/mips/kernel/scall64-o32.S	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/mips/kernel/scall64-o32.S	2017-09-03 16:56:17.000000000 -0400
@@ -198,7 +198,6 @@ LEAF(sys32_syscall)
 	dsll	t1, t0, 3
 	beqz	v0, einval
 	ld	t2, sys32_call_table(t1)		# syscall routine
-	sd	a0, PT_R2(sp)		# call routine directly on restart
 
 	move	a0, a1			# shift argument registers
 	move	a1, a2
@@ -207,11 +206,6 @@ LEAF(sys32_syscall)
 	move	a4, a5
 	move	a5, a6
 	move	a6, a7
-	sd	a0, PT_R4(sp)		# ... and push back a0 - a3, some
-	sd	a1, PT_R5(sp)		# syscalls expect them there
-	sd	a2, PT_R6(sp)
-	sd	a3, PT_R7(sp)
-	sd	a3, PT_R26(sp)		# update a3 for syscall restarting
 	jr	t2
 	/* Unreached */
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/powerpc/include/asm/kvm_host.h linux-libre-4.13-gnu/arch/powerpc/include/asm/kvm_host.h
--- linux-libre-4.13-rc7-gnu/arch/powerpc/include/asm/kvm_host.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/powerpc/include/asm/kvm_host.h	2017-09-03 16:56:17.000000000 -0400
@@ -67,11 +67,6 @@ extern int kvm_age_hva(struct kvm *kvm,
 extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
 extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
 
-static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-							 unsigned long address)
-{
-}
-
 #define HPTEG_CACHE_NUM			(1 << 15)
 #define HPTEG_HASH_BITS_PTE		13
 #define HPTEG_HASH_BITS_PTE_LONG	12
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/powerpc/platforms/powernv/npu-dma.c linux-libre-4.13-gnu/arch/powerpc/platforms/powernv/npu-dma.c
--- linux-libre-4.13-rc7-gnu/arch/powerpc/platforms/powernv/npu-dma.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/powerpc/platforms/powernv/npu-dma.c	2017-09-03 16:56:17.000000000 -0400
@@ -614,15 +614,6 @@ static void pnv_npu2_mn_change_pte(struc
 	mmio_invalidate(npu_context, 1, address, true);
 }
 
-static void pnv_npu2_mn_invalidate_page(struct mmu_notifier *mn,
-					struct mm_struct *mm,
-					unsigned long address)
-{
-	struct npu_context *npu_context = mn_to_npu_context(mn);
-
-	mmio_invalidate(npu_context, 1, address, true);
-}
-
 static void pnv_npu2_mn_invalidate_range(struct mmu_notifier *mn,
 					struct mm_struct *mm,
 					unsigned long start, unsigned long end)
@@ -640,7 +631,6 @@ static void pnv_npu2_mn_invalidate_range
 static const struct mmu_notifier_ops nv_nmmu_notifier_ops = {
 	.release = pnv_npu2_mn_release,
 	.change_pte = pnv_npu2_mn_change_pte,
-	.invalidate_page = pnv_npu2_mn_invalidate_page,
 	.invalidate_range = pnv_npu2_mn_invalidate_range,
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/s390/include/asm/mmu_context.h linux-libre-4.13-gnu/arch/s390/include/asm/mmu_context.h
--- linux-libre-4.13-rc7-gnu/arch/s390/include/asm/mmu_context.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/s390/include/asm/mmu_context.h	2017-09-03 16:56:17.000000000 -0400
@@ -44,6 +44,11 @@ static inline int init_new_context(struc
 		mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
 				   _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
 		break;
+	case -PAGE_SIZE:
+		/* forked 5-level task, set new asce with new_mm->pgd */
+		mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
+			_ASCE_USER_BITS | _ASCE_TYPE_REGION1;
+		break;
 	case 1UL << 53:
 		/* forked 4-level task, set new asce with new mm->pgd */
 		mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/s390/mm/mmap.c linux-libre-4.13-gnu/arch/s390/mm/mmap.c
--- linux-libre-4.13-rc7-gnu/arch/s390/mm/mmap.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/s390/mm/mmap.c	2017-09-03 16:56:17.000000000 -0400
@@ -119,7 +119,8 @@ arch_get_unmapped_area(struct file *filp
 		return addr;
 
 check_asce_limit:
-	if (addr + len > current->mm->context.asce_limit) {
+	if (addr + len > current->mm->context.asce_limit &&
+	    addr + len <= TASK_SIZE) {
 		rc = crst_table_upgrade(mm, addr + len);
 		if (rc)
 			return (unsigned long) rc;
@@ -183,7 +184,8 @@ arch_get_unmapped_area_topdown(struct fi
 	}
 
 check_asce_limit:
-	if (addr + len > current->mm->context.asce_limit) {
+	if (addr + len > current->mm->context.asce_limit &&
+	    addr + len <= TASK_SIZE) {
 		rc = crst_table_upgrade(mm, addr + len);
 		if (rc)
 			return (unsigned long) rc;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/x86/boot/compressed/misc.c linux-libre-4.13-gnu/arch/x86/boot/compressed/misc.c
--- linux-libre-4.13-rc7-gnu/arch/x86/boot/compressed/misc.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/x86/boot/compressed/misc.c	2017-09-03 16:56:17.000000000 -0400
@@ -116,8 +116,7 @@ void __putstr(const char *s)
 		}
 	}
 
-	if (boot_params->screen_info.orig_video_mode == 0 &&
-	    lines == 0 && cols == 0)
+	if (lines == 0 || cols == 0)
 		return;
 
 	x = boot_params->screen_info.orig_x;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/x86/boot/header.S linux-libre-4.13-gnu/arch/x86/boot/header.S
--- linux-libre-4.13-rc7-gnu/arch/x86/boot/header.S	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/x86/boot/header.S	2017-09-03 16:56:17.000000000 -0400
@@ -520,8 +520,14 @@ pref_address:		.quad LOAD_PHYSICAL_ADDR
 # the description in lib/decompressor_xxx.c for specific information.
 #
 # extra_bytes = (uncompressed_size >> 12) + 65536 + 128
+#
+# LZ4 is even worse: data that cannot be further compressed grows by 0.4%,
+# or one byte per 256 bytes. OTOH, we can safely get rid of the +128 as
+# the size-dependent part now grows so fast.
+#
+# extra_bytes = (uncompressed_size >> 8) + 65536
 
-#define ZO_z_extra_bytes	((ZO_z_output_len >> 12) + 65536 + 128)
+#define ZO_z_extra_bytes	((ZO_z_output_len >> 8) + 65536)
 #if ZO_z_output_len > ZO_z_input_len
 # define ZO_z_extract_offset	(ZO_z_output_len + ZO_z_extra_bytes - \
 				 ZO_z_input_len)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/x86/events/core.c linux-libre-4.13-gnu/arch/x86/events/core.c
--- linux-libre-4.13-rc7-gnu/arch/x86/events/core.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/x86/events/core.c	2017-09-03 16:56:17.000000000 -0400
@@ -2335,12 +2335,9 @@ static unsigned long get_segment_base(un
 #ifdef CONFIG_MODIFY_LDT_SYSCALL
 		struct ldt_struct *ldt;
 
-		if (idx > LDT_ENTRIES)
-			return 0;
-
 		/* IRQs are off, so this synchronizes with smp_store_release */
 		ldt = lockless_dereference(current->active_mm->context.ldt);
-		if (!ldt || idx > ldt->nr_entries)
+		if (!ldt || idx >= ldt->nr_entries)
 			return 0;
 
 		desc = &ldt->entries[idx];
@@ -2348,7 +2345,7 @@ static unsigned long get_segment_base(un
 		return 0;
 #endif
 	} else {
-		if (idx > GDT_ENTRIES)
+		if (idx >= GDT_ENTRIES)
 			return 0;
 
 		desc = raw_cpu_ptr(gdt_page.gdt) + idx;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/x86/include/asm/kvm_host.h linux-libre-4.13-gnu/arch/x86/include/asm/kvm_host.h
--- linux-libre-4.13-rc7-gnu/arch/x86/include/asm/kvm_host.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/x86/include/asm/kvm_host.h	2017-09-03 16:56:17.000000000 -0400
@@ -1375,8 +1375,6 @@ int kvm_arch_interrupt_allowed(struct kv
 int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
 void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event);
 void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu);
-void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-					   unsigned long address);
 
 void kvm_define_shared_msr(unsigned index, u32 msr);
 int kvm_set_shared_msr(unsigned index, u64 val, u64 mask);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/x86/kvm/x86.c linux-libre-4.13-gnu/arch/x86/kvm/x86.c
--- linux-libre-4.13-rc7-gnu/arch/x86/kvm/x86.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/x86/kvm/x86.c	2017-09-03 16:56:17.000000000 -0400
@@ -6734,17 +6734,6 @@ void kvm_vcpu_reload_apic_access_page(st
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_reload_apic_access_page);
 
-void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm,
-					   unsigned long address)
-{
-	/*
-	 * The physical address of apic access page is stored in the VMCS.
-	 * Update it when it becomes invalid.
-	 */
-	if (address == gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT))
-		kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
-}
-
 /*
  * Returns 1 to let vcpu_run() continue the guest execution loop without
  * exiting to the userspace.  Otherwise, the value will be returned to the
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/arch/x86/um/user-offsets.c linux-libre-4.13-gnu/arch/x86/um/user-offsets.c
--- linux-libre-4.13-rc7-gnu/arch/x86/um/user-offsets.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/arch/x86/um/user-offsets.c	2017-09-03 16:56:17.000000000 -0400
@@ -50,7 +50,7 @@ void foo(void)
 	DEFINE(HOST_GS, GS);
 	DEFINE(HOST_ORIG_AX, ORIG_EAX);
 #else
-#if defined(PTRACE_GETREGSET) && defined(PTRACE_SETREGSET)
+#ifdef FP_XSTATE_MAGIC1
 	DEFINE(HOST_FP_SIZE, sizeof(struct _xstate) / sizeof(unsigned long));
 #else
 	DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/crypto/algif_skcipher.c linux-libre-4.13-gnu/crypto/algif_skcipher.c
--- linux-libre-4.13-rc7-gnu/crypto/algif_skcipher.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/crypto/algif_skcipher.c	2017-09-03 16:56:17.000000000 -0400
@@ -87,8 +87,13 @@ static void skcipher_free_async_sgls(str
 	}
 	sgl = sreq->tsg;
 	n = sg_nents(sgl);
-	for_each_sg(sgl, sg, n, i)
-		put_page(sg_page(sg));
+	for_each_sg(sgl, sg, n, i) {
+		struct page *page = sg_page(sg);
+
+		/* some SGs may not have a page mapped */
+		if (page && page_ref_count(page))
+			put_page(page);
+	}
 
 	kfree(sreq->tsg);
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/crypto/chacha20_generic.c linux-libre-4.13-gnu/crypto/chacha20_generic.c
--- linux-libre-4.13-rc7-gnu/crypto/chacha20_generic.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/crypto/chacha20_generic.c	2017-09-03 16:56:17.000000000 -0400
@@ -91,9 +91,14 @@ int crypto_chacha20_crypt(struct skciphe
 	crypto_chacha20_init(state, ctx, walk.iv);
 
 	while (walk.nbytes > 0) {
+		unsigned int nbytes = walk.nbytes;
+
+		if (nbytes < walk.total)
+			nbytes = round_down(nbytes, walk.stride);
+
 		chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr,
-				 walk.nbytes);
-		err = skcipher_walk_done(&walk, 0);
+				 nbytes);
+		err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
 	}
 
 	return err;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/crypto/testmgr.h linux-libre-4.13-gnu/crypto/testmgr.h
--- linux-libre-4.13-rc7-gnu/crypto/testmgr.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/crypto/testmgr.h	2017-09-03 16:56:17.000000000 -0400
@@ -32675,6 +32675,10 @@ static const struct cipher_testvec chach
 			  "\x5b\x86\x2f\x37\x30\xe3\x7c\xfd"
 			  "\xc4\xfd\x80\x6c\x22\xf2\x21",
 		.rlen	= 375,
+		.also_non_np = 1,
+		.np	= 3,
+		.tap	= { 375 - 20, 4, 16 },
+
 	}, { /* RFC7539 A.2. Test Vector #3 */
 		.key	= "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a"
 			  "\xf3\x33\x88\x86\x04\xf6\xb5\xf0"
@@ -33049,6 +33053,9 @@ static const struct cipher_testvec chach
 			  "\xa1\xed\xad\xd5\x76\xfa\x24\x8f"
 			  "\x98",
 		.rlen	= 1281,
+		.also_non_np = 1,
+		.np	= 3,
+		.tap	= { 1200, 1, 80 },
 	},
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/Documentation/devicetree/bindings/net/dwmac-sun8i.txt linux-libre-4.13-gnu/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
--- linux-libre-4.13-rc7-gnu/Documentation/devicetree/bindings/net/dwmac-sun8i.txt	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/Documentation/devicetree/bindings/net/dwmac-sun8i.txt	1969-12-31 19:00:00.000000000 -0500
@@ -1,84 +0,0 @@
-* Allwinner sun8i GMAC ethernet controller
-
-This device is a platform glue layer for stmmac.
-Please see stmmac.txt for the other unchanged properties.
-
-Required properties:
-- compatible: should be one of the following string:
-		"allwinner,sun8i-a83t-emac"
-		"allwinner,sun8i-h3-emac"
-		"allwinner,sun8i-v3s-emac"
-		"allwinner,sun50i-a64-emac"
-- reg: address and length of the register for the device.
-- interrupts: interrupt for the device
-- interrupt-names: should be "macirq"
-- clocks: A phandle to the reference clock for this device
-- clock-names: should be "stmmaceth"
-- resets: A phandle to the reset control for this device
-- reset-names: should be "stmmaceth"
-- phy-mode: See ethernet.txt
-- phy-handle: See ethernet.txt
-- #address-cells: shall be 1
-- #size-cells: shall be 0
-- syscon: A phandle to the syscon of the SoC with one of the following
- compatible string:
-  - allwinner,sun8i-h3-system-controller
-  - allwinner,sun8i-v3s-system-controller
-  - allwinner,sun50i-a64-system-controller
-  - allwinner,sun8i-a83t-system-controller
-
-Optional properties:
-- allwinner,tx-delay-ps: TX clock delay chain value in ps. Range value is 0-700. Default is 0)
-- allwinner,rx-delay-ps: RX clock delay chain value in ps. Range value is 0-3100. Default is 0)
-Both delay properties need to be a multiple of 100. They control the delay for
-external PHY.
-
-Optional properties for the following compatibles:
-  - "allwinner,sun8i-h3-emac",
-  - "allwinner,sun8i-v3s-emac":
-- allwinner,leds-active-low: EPHY LEDs are active low
-
-Required child node of emac:
-- mdio bus node: should be named mdio
-
-Required properties of the mdio node:
-- #address-cells: shall be 1
-- #size-cells: shall be 0
-
-The device node referenced by "phy" or "phy-handle" should be a child node
-of the mdio node. See phy.txt for the generic PHY bindings.
-
-Required properties of the phy node with the following compatibles:
-  - "allwinner,sun8i-h3-emac",
-  - "allwinner,sun8i-v3s-emac":
-- clocks: a phandle to the reference clock for the EPHY
-- resets: a phandle to the reset control for the EPHY
-
-Example:
-
-emac: ethernet@1c0b000 {
-	compatible = "allwinner,sun8i-h3-emac";
-	syscon = <&syscon>;
-	reg = <0x01c0b000 0x104>;
-	interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-	interrupt-names = "macirq";
-	resets = <&ccu RST_BUS_EMAC>;
-	reset-names = "stmmaceth";
-	clocks = <&ccu CLK_BUS_EMAC>;
-	clock-names = "stmmaceth";
-	#address-cells = <1>;
-	#size-cells = <0>;
-
-	phy-handle = <&int_mii_phy>;
-	phy-mode = "mii";
-	allwinner,leds-active-low;
-	mdio: mdio {
-		#address-cells = <1>;
-		#size-cells = <0>;
-		int_mii_phy: ethernet-phy@1 {
-			reg = <1>;
-			clocks = <&ccu CLK_BUS_EPHY>;
-			resets = <&ccu RST_BUS_EPHY>;
-		};
-	};
-};
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/ata/ahci_da850.c linux-libre-4.13-gnu/drivers/ata/ahci_da850.c
--- linux-libre-4.13-rc7-gnu/drivers/ata/ahci_da850.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/ata/ahci_da850.c	2017-09-03 16:56:17.000000000 -0400
@@ -216,12 +216,16 @@ static int ahci_da850_probe(struct platf
 		return rc;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res)
+	if (!res) {
+		rc = -ENODEV;
 		goto disable_resources;
+	}
 
 	pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res));
-	if (!pwrdn_reg)
+	if (!pwrdn_reg) {
+		rc = -ENOMEM;
 		goto disable_resources;
+	}
 
 	da850_sata_init(dev, pwrdn_reg, hpriv->mmio, mpy);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/ata/libata-core.c linux-libre-4.13-gnu/drivers/ata/libata-core.c
--- linux-libre-4.13-rc7-gnu/drivers/ata/libata-core.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/ata/libata-core.c	2017-09-03 16:56:17.000000000 -0400
@@ -2411,6 +2411,9 @@ static void ata_dev_config_trusted(struc
 	u64 trusted_cap;
 	unsigned int err;
 
+	if (!ata_id_has_trusted(dev->id))
+		return;
+
 	if (!ata_identify_page_supported(dev, ATA_LOG_SECURITY)) {
 		ata_dev_warn(dev,
 			     "Security Log not supported\n");
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/block/xen-blkback/xenbus.c linux-libre-4.13-gnu/drivers/block/xen-blkback/xenbus.c
--- linux-libre-4.13-rc7-gnu/drivers/block/xen-blkback/xenbus.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/block/xen-blkback/xenbus.c	2017-09-03 16:56:17.000000000 -0400
@@ -244,6 +244,7 @@ static int xen_blkif_disconnect(struct x
 {
 	struct pending_req *req, *n;
 	unsigned int j, r;
+	bool busy = false;
 
 	for (r = 0; r < blkif->nr_rings; r++) {
 		struct xen_blkif_ring *ring = &blkif->rings[r];
@@ -261,8 +262,10 @@ static int xen_blkif_disconnect(struct x
 		 * don't have any discard_io or other_io requests. So, checking
 		 * for inflight IO is enough.
 		 */
-		if (atomic_read(&ring->inflight) > 0)
-			return -EBUSY;
+		if (atomic_read(&ring->inflight) > 0) {
+			busy = true;
+			continue;
+		}
 
 		if (ring->irq) {
 			unbind_from_irqhandler(ring->irq, ring);
@@ -300,6 +303,9 @@ static int xen_blkif_disconnect(struct x
 		WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
 		ring->active = false;
 	}
+	if (busy)
+		return -EBUSY;
+
 	blkif->nr_ring_pages = 0;
 	/*
 	 * blkif->rings was allocated in connect_ring, so we should free it in
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c linux-libre-4.13-gnu/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
--- linux-libre-4.13-rc7-gnu/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c	2017-09-03 16:56:17.000000000 -0400
@@ -147,36 +147,6 @@ static void amdgpu_mn_invalidate_node(st
 }
 
 /**
- * amdgpu_mn_invalidate_page - callback to notify about mm change
- *
- * @mn: our notifier
- * @mn: the mm this callback is about
- * @address: address of invalidate page
- *
- * Invalidation of a single page. Blocks for all BOs mapping it
- * and unmap them by move them into system domain again.
- */
-static void amdgpu_mn_invalidate_page(struct mmu_notifier *mn,
-				      struct mm_struct *mm,
-				      unsigned long address)
-{
-	struct amdgpu_mn *rmn = container_of(mn, struct amdgpu_mn, mn);
-	struct interval_tree_node *it;
-
-	mutex_lock(&rmn->lock);
-
-	it = interval_tree_iter_first(&rmn->objects, address, address);
-	if (it) {
-		struct amdgpu_mn_node *node;
-
-		node = container_of(it, struct amdgpu_mn_node, it);
-		amdgpu_mn_invalidate_node(node, address, address);
-	}
-
-	mutex_unlock(&rmn->lock);
-}
-
-/**
  * amdgpu_mn_invalidate_range_start - callback to notify about mm change
  *
  * @mn: our notifier
@@ -215,7 +185,6 @@ static void amdgpu_mn_invalidate_range_s
 
 static const struct mmu_notifier_ops amdgpu_mn_ops = {
 	.release = amdgpu_mn_release,
-	.invalidate_page = amdgpu_mn_invalidate_page,
 	.invalidate_range_start = amdgpu_mn_invalidate_range_start,
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/gpu/drm/bridge/sil-sii8620.c linux-libre-4.13-gnu/drivers/gpu/drm/bridge/sil-sii8620.c
--- linux-libre-4.13-rc7-gnu/drivers/gpu/drm/bridge/sil-sii8620.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/gpu/drm/bridge/sil-sii8620.c	2017-09-03 16:56:17.000000000 -0400
@@ -597,9 +597,9 @@ static void sii8620_mt_read_devcap(struc
 static void sii8620_mt_read_devcap_reg_recv(struct sii8620 *ctx,
 		struct sii8620_mt_msg *msg)
 {
-	u8 reg = msg->reg[0] & 0x7f;
+	u8 reg = msg->reg[1] & 0x7f;
 
-	if (msg->reg[0] & 0x80)
+	if (msg->reg[1] & 0x80)
 		ctx->xdevcap[reg] = msg->ret;
 	else
 		ctx->devcap[reg] = msg->ret;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c linux-libre-4.13-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
--- linux-libre-4.13-rc7-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c	2017-09-03 16:56:17.000000000 -0400
@@ -1567,10 +1567,34 @@ vmw_kms_atomic_check_modeset(struct drm_
 }
 
 
+/**
+ * vmw_kms_atomic_commit - Perform an atomic state commit
+ *
+ * @dev: DRM device
+ * @state: the driver state object
+ * @nonblock: Whether nonblocking behaviour is requested
+ *
+ * This is a simple wrapper around drm_atomic_helper_commit() for
+ * us to clear the nonblocking value.
+ *
+ * Nonblocking commits currently cause synchronization issues
+ * for vmwgfx.
+ *
+ * RETURNS
+ * Zero for success or negative error code on failure.
+ */
+int vmw_kms_atomic_commit(struct drm_device *dev,
+			  struct drm_atomic_state *state,
+			  bool nonblock)
+{
+	return drm_atomic_helper_commit(dev, state, false);
+}
+
+
 static const struct drm_mode_config_funcs vmw_kms_funcs = {
 	.fb_create = vmw_kms_fb_create,
 	.atomic_check = vmw_kms_atomic_check_modeset,
-	.atomic_commit = drm_atomic_helper_commit,
+	.atomic_commit = vmw_kms_atomic_commit,
 };
 
 static int vmw_kms_generic_present(struct vmw_private *dev_priv,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/i2c/busses/i2c-designware-platdrv.c linux-libre-4.13-gnu/drivers/i2c/busses/i2c-designware-platdrv.c
--- linux-libre-4.13-rc7-gnu/drivers/i2c/busses/i2c-designware-platdrv.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/i2c/busses/i2c-designware-platdrv.c	2017-09-03 16:56:17.000000000 -0400
@@ -256,7 +256,8 @@ static int dw_i2c_plat_probe(struct plat
 	struct dw_i2c_dev *dev;
 	u32 acpi_speed, ht = 0;
 	struct resource *mem;
-	int irq, ret;
+	int i, irq, ret;
+	const int supported_speeds[] = { 0, 100000, 400000, 1000000, 3400000 };
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -297,9 +298,16 @@ static int dw_i2c_plat_probe(struct plat
 	}
 
 	acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
-	/* Some broken DSTDs use 1MiHz instead of 1MHz */
-	if (acpi_speed == 1048576)
-		acpi_speed = 1000000;
+	/*
+	 * Some DSTDs use a non standard speed, round down to the lowest
+	 * standard speed.
+	 */
+	for (i = 1; i < ARRAY_SIZE(supported_speeds); i++) {
+		if (acpi_speed < supported_speeds[i])
+			break;
+	}
+	acpi_speed = supported_speeds[i - 1];
+
 	/*
 	 * Find bus speed from the "clock-frequency" device property, ACPI
 	 * or by using fast mode if neither is set.
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/i2c/busses/i2c-ismt.c linux-libre-4.13-gnu/drivers/i2c/busses/i2c-ismt.c
--- linux-libre-4.13-rc7-gnu/drivers/i2c/busses/i2c-ismt.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/i2c/busses/i2c-ismt.c	2017-09-03 16:56:17.000000000 -0400
@@ -341,8 +341,10 @@ static int ismt_process_desc(const struc
 			break;
 		case I2C_SMBUS_BLOCK_DATA:
 		case I2C_SMBUS_I2C_BLOCK_DATA:
-			memcpy(&data->block[1], dma_buffer, desc->rxbytes);
-			data->block[0] = desc->rxbytes;
+			if (desc->rxbytes != dma_buffer[0] + 1)
+				return -EMSGSIZE;
+
+			memcpy(data->block, dma_buffer, desc->rxbytes);
 			break;
 		}
 		return 0;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/infiniband/core/umem_odp.c linux-libre-4.13-gnu/drivers/infiniband/core/umem_odp.c
--- linux-libre-4.13-rc7-gnu/drivers/infiniband/core/umem_odp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/infiniband/core/umem_odp.c	2017-09-03 16:56:17.000000000 -0400
@@ -166,24 +166,6 @@ static int invalidate_page_trampoline(st
 	return 0;
 }
 
-static void ib_umem_notifier_invalidate_page(struct mmu_notifier *mn,
-					     struct mm_struct *mm,
-					     unsigned long address)
-{
-	struct ib_ucontext *context = container_of(mn, struct ib_ucontext, mn);
-
-	if (!context->invalidate_range)
-		return;
-
-	ib_ucontext_notifier_start_account(context);
-	down_read(&context->umem_rwsem);
-	rbt_ib_umem_for_each_in_range(&context->umem_tree, address,
-				      address + PAGE_SIZE,
-				      invalidate_page_trampoline, NULL);
-	up_read(&context->umem_rwsem);
-	ib_ucontext_notifier_end_account(context);
-}
-
 static int invalidate_range_start_trampoline(struct ib_umem *item, u64 start,
 					     u64 end, void *cookie)
 {
@@ -237,7 +219,6 @@ static void ib_umem_notifier_invalidate_
 
 static const struct mmu_notifier_ops ib_umem_notifiers = {
 	.release                    = ib_umem_notifier_release,
-	.invalidate_page            = ib_umem_notifier_invalidate_page,
 	.invalidate_range_start     = ib_umem_notifier_invalidate_range_start,
 	.invalidate_range_end       = ib_umem_notifier_invalidate_range_end,
 };
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/infiniband/hw/hfi1/mmu_rb.c linux-libre-4.13-gnu/drivers/infiniband/hw/hfi1/mmu_rb.c
--- linux-libre-4.13-rc7-gnu/drivers/infiniband/hw/hfi1/mmu_rb.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/infiniband/hw/hfi1/mmu_rb.c	2017-09-03 16:56:17.000000000 -0400
@@ -67,8 +67,6 @@ struct mmu_rb_handler {
 
 static unsigned long mmu_node_start(struct mmu_rb_node *);
 static unsigned long mmu_node_last(struct mmu_rb_node *);
-static inline void mmu_notifier_page(struct mmu_notifier *, struct mm_struct *,
-				     unsigned long);
 static inline void mmu_notifier_range_start(struct mmu_notifier *,
 					    struct mm_struct *,
 					    unsigned long, unsigned long);
@@ -82,7 +80,6 @@ static void do_remove(struct mmu_rb_hand
 static void handle_remove(struct work_struct *work);
 
 static const struct mmu_notifier_ops mn_opts = {
-	.invalidate_page = mmu_notifier_page,
 	.invalidate_range_start = mmu_notifier_range_start,
 };
 
@@ -285,12 +282,6 @@ void hfi1_mmu_rb_remove(struct mmu_rb_ha
 	handler->ops->remove(handler->ops_arg, node);
 }
 
-static inline void mmu_notifier_page(struct mmu_notifier *mn,
-				     struct mm_struct *mm, unsigned long addr)
-{
-	mmu_notifier_mem_invalidate(mn, mm, addr, addr + PAGE_SIZE);
-}
-
 static inline void mmu_notifier_range_start(struct mmu_notifier *mn,
 					    struct mm_struct *mm,
 					    unsigned long start,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/input/joystick/xpad.c linux-libre-4.13-gnu/drivers/input/joystick/xpad.c
--- linux-libre-4.13-rc7-gnu/drivers/input/joystick/xpad.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/input/joystick/xpad.c	2017-09-03 16:56:17.000000000 -0400
@@ -476,10 +476,21 @@ static const u8 xboxone_hori_init[] = {
 };
 
 /*
- * A rumble packet is required for some PowerA pads to start
+ * A specific rumble packet is required for some PowerA pads to start
  * sending input reports. One of those pads is (0x24c6:0x543a).
  */
-static const u8 xboxone_zerorumble_init[] = {
+static const u8 xboxone_rumblebegin_init[] = {
+	0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
+	0x1D, 0x1D, 0xFF, 0x00, 0x00
+};
+
+/*
+ * A rumble packet with zero FF intensity will immediately
+ * terminate the rumbling required to init PowerA pads.
+ * This should happen fast enough that the motors don't
+ * spin up to enough speed to actually vibrate the gamepad.
+ */
+static const u8 xboxone_rumbleend_init[] = {
 	0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00
 };
@@ -494,9 +505,12 @@ static const struct xboxone_init_packet
 	XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
 	XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
 	XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
-	XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_zerorumble_init),
-	XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_zerorumble_init),
-	XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_zerorumble_init),
+	XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
+	XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
+	XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
+	XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumbleend_init),
+	XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumbleend_init),
+	XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumbleend_init),
 };
 
 struct xpad_output_packet {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/input/mouse/synaptics.c linux-libre-4.13-gnu/drivers/input/mouse/synaptics.c
--- linux-libre-4.13-rc7-gnu/drivers/input/mouse/synaptics.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/input/mouse/synaptics.c	2017-09-03 16:56:17.000000000 -0400
@@ -535,16 +535,17 @@ static void synaptics_apply_quirks(struc
 	}
 }
 
+static bool synaptics_has_agm(struct synaptics_data *priv)
+{
+	return (SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
+		SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c));
+}
+
 static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse)
 {
 	static u8 param = 0xc8;
-	struct synaptics_data *priv = psmouse->private;
 	int error;
 
-	if (!(SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
-	      SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)))
-		return 0;
-
 	error = psmouse_sliced_command(psmouse, SYN_QUE_MODEL);
 	if (error)
 		return error;
@@ -553,9 +554,6 @@ static int synaptics_set_advanced_gestur
 	if (error)
 		return error;
 
-	/* Advanced gesture mode also sends multi finger data */
-	priv->info.capabilities |= BIT(1);
-
 	return 0;
 }
 
@@ -578,7 +576,7 @@ static int synaptics_set_mode(struct psm
 	if (error)
 		return error;
 
-	if (priv->absolute_mode) {
+	if (priv->absolute_mode && synaptics_has_agm(priv)) {
 		error = synaptics_set_advanced_gesture_mode(psmouse);
 		if (error) {
 			psmouse_err(psmouse,
@@ -766,9 +764,7 @@ static int synaptics_parse_hw_state(cons
 			 ((buf[0] & 0x04) >> 1) |
 			 ((buf[3] & 0x04) >> 2));
 
-		if ((SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
-			SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)) &&
-		    hw->w == 2) {
+		if (synaptics_has_agm(priv) && hw->w == 2) {
 			synaptics_parse_agm(buf, priv, hw);
 			return 1;
 		}
@@ -1033,6 +1029,15 @@ static void synaptics_image_sensor_proce
 	synaptics_report_mt_data(psmouse, sgm, num_fingers);
 }
 
+static bool synaptics_has_multifinger(struct synaptics_data *priv)
+{
+	if (SYN_CAP_MULTIFINGER(priv->info.capabilities))
+		return true;
+
+	/* Advanced gesture mode also sends multi finger data */
+	return synaptics_has_agm(priv);
+}
+
 /*
  *  called for each full received packet from the touchpad
  */
@@ -1079,7 +1084,7 @@ static void synaptics_process_packet(str
 		if (SYN_CAP_EXTENDED(info->capabilities)) {
 			switch (hw.w) {
 			case 0 ... 1:
-				if (SYN_CAP_MULTIFINGER(info->capabilities))
+				if (synaptics_has_multifinger(priv))
 					num_fingers = hw.w + 2;
 				break;
 			case 2:
@@ -1123,7 +1128,7 @@ static void synaptics_process_packet(str
 		input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
 
 	input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
-	if (SYN_CAP_MULTIFINGER(info->capabilities)) {
+	if (synaptics_has_multifinger(priv)) {
 		input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
 		input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3);
 	}
@@ -1283,7 +1288,7 @@ static void set_input_params(struct psmo
 	__set_bit(BTN_TOUCH, dev->keybit);
 	__set_bit(BTN_TOOL_FINGER, dev->keybit);
 
-	if (SYN_CAP_MULTIFINGER(info->capabilities)) {
+	if (synaptics_has_multifinger(priv)) {
 		__set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
 		__set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
 	}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/iommu/amd_iommu_v2.c linux-libre-4.13-gnu/drivers/iommu/amd_iommu_v2.c
--- linux-libre-4.13-rc7-gnu/drivers/iommu/amd_iommu_v2.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/iommu/amd_iommu_v2.c	2017-09-03 16:56:17.000000000 -0400
@@ -391,13 +391,6 @@ static int mn_clear_flush_young(struct m
 	return 0;
 }
 
-static void mn_invalidate_page(struct mmu_notifier *mn,
-			       struct mm_struct *mm,
-			       unsigned long address)
-{
-	__mn_flush_page(mn, address);
-}
-
 static void mn_invalidate_range(struct mmu_notifier *mn,
 				struct mm_struct *mm,
 				unsigned long start, unsigned long end)
@@ -436,7 +429,6 @@ static void mn_release(struct mmu_notifi
 static const struct mmu_notifier_ops iommu_mn = {
 	.release		= mn_release,
 	.clear_flush_young      = mn_clear_flush_young,
-	.invalidate_page        = mn_invalidate_page,
 	.invalidate_range       = mn_invalidate_range,
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/iommu/intel-svm.c linux-libre-4.13-gnu/drivers/iommu/intel-svm.c
--- linux-libre-4.13-rc7-gnu/drivers/iommu/intel-svm.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/iommu/intel-svm.c	2017-09-03 16:56:17.000000000 -0400
@@ -223,14 +223,6 @@ static void intel_change_pte(struct mmu_
 	intel_flush_svm_range(svm, address, 1, 1, 0);
 }
 
-static void intel_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm,
-				  unsigned long address)
-{
-	struct intel_svm *svm = container_of(mn, struct intel_svm, notifier);
-
-	intel_flush_svm_range(svm, address, 1, 1, 0);
-}
-
 /* Pages have been freed at this point */
 static void intel_invalidate_range(struct mmu_notifier *mn,
 				   struct mm_struct *mm,
@@ -285,7 +277,6 @@ static void intel_mm_release(struct mmu_
 static const struct mmu_notifier_ops intel_mmuops = {
 	.release = intel_mm_release,
 	.change_pte = intel_change_pte,
-	.invalidate_page = intel_invalidate_page,
 	.invalidate_range = intel_invalidate_range,
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/irqchip/irq-mips-gic.c linux-libre-4.13-gnu/drivers/irqchip/irq-mips-gic.c
--- linux-libre-4.13-rc7-gnu/drivers/irqchip/irq-mips-gic.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/irqchip/irq-mips-gic.c	2017-09-03 16:56:17.000000000 -0400
@@ -1020,8 +1020,11 @@ static int __init gic_of_init(struct dev
 		gic_len = resource_size(&res);
 	}
 
-	if (mips_cm_present())
+	if (mips_cm_present()) {
 		write_gcr_gic_base(gic_base | CM_GCR_GIC_BASE_GICEN_MSK);
+		/* Ensure GIC region is enabled before trying to access it */
+		__sync();
+	}
 	gic_present = true;
 
 	__gic_init(gic_base, gic_len, cpu_vec, 0, node);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/md/dm.c linux-libre-4.13-gnu/drivers/md/dm.c
--- linux-libre-4.13-rc7-gnu/drivers/md/dm.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/md/dm.c	2017-09-03 16:56:17.000000000 -0400
@@ -27,16 +27,6 @@
 
 #define DM_MSG_PREFIX "core"
 
-#ifdef CONFIG_PRINTK
-/*
- * ratelimit state to be used in DMXXX_LIMIT().
- */
-DEFINE_RATELIMIT_STATE(dm_ratelimit_state,
-		       DEFAULT_RATELIMIT_INTERVAL,
-		       DEFAULT_RATELIMIT_BURST);
-EXPORT_SYMBOL(dm_ratelimit_state);
-#endif
-
 /*
  * Cookies are numeric values sent with CHANGE and REMOVE
  * uevents while resuming, removing or renaming the device.
@@ -1523,7 +1513,7 @@ static void __split_and_process_bio(stru
 	}
 
 	/* drop the extra reference count */
-	dec_pending(ci.io, error);
+	dec_pending(ci.io, errno_to_blk_status(error));
 }
 /*-----------------------------------------------------------------
  * CRUD END
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/md/dm-mpath.c linux-libre-4.13-gnu/drivers/md/dm-mpath.c
--- linux-libre-4.13-rc7-gnu/drivers/md/dm-mpath.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/md/dm-mpath.c	2017-09-03 16:56:17.000000000 -0400
@@ -504,7 +504,6 @@ static int multipath_clone_and_map(struc
 		if (queue_dying) {
 			atomic_inc(&m->pg_init_in_progress);
 			activate_or_offline_path(pgpath);
-			return DM_MAPIO_REQUEUE;
 		}
 		return DM_MAPIO_DELAY_REQUEUE;
 	}
@@ -1458,7 +1457,6 @@ static int noretry_error(blk_status_t er
 	case BLK_STS_TARGET:
 	case BLK_STS_NEXUS:
 	case BLK_STS_MEDIUM:
-	case BLK_STS_RESOURCE:
 		return 1;
 	}
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/misc/mic/scif/scif_dma.c linux-libre-4.13-gnu/drivers/misc/mic/scif/scif_dma.c
--- linux-libre-4.13-rc7-gnu/drivers/misc/mic/scif/scif_dma.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/misc/mic/scif/scif_dma.c	2017-09-03 16:56:17.000000000 -0400
@@ -200,16 +200,6 @@ static void scif_mmu_notifier_release(st
 	schedule_work(&scif_info.misc_work);
 }
 
-static void scif_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
-					      struct mm_struct *mm,
-					      unsigned long address)
-{
-	struct scif_mmu_notif	*mmn;
-
-	mmn = container_of(mn, struct scif_mmu_notif, ep_mmu_notifier);
-	scif_rma_destroy_tcw(mmn, address, PAGE_SIZE);
-}
-
 static void scif_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
 						     struct mm_struct *mm,
 						     unsigned long start,
@@ -235,7 +225,6 @@ static void scif_mmu_notifier_invalidate
 static const struct mmu_notifier_ops scif_mmu_notifier_ops = {
 	.release = scif_mmu_notifier_release,
 	.clear_flush_young = NULL,
-	.invalidate_page = scif_mmu_notifier_invalidate_page,
 	.invalidate_range_start = scif_mmu_notifier_invalidate_range_start,
 	.invalidate_range_end = scif_mmu_notifier_invalidate_range_end};
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/misc/sgi-gru/grutlbpurge.c linux-libre-4.13-gnu/drivers/misc/sgi-gru/grutlbpurge.c
--- linux-libre-4.13-rc7-gnu/drivers/misc/sgi-gru/grutlbpurge.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/misc/sgi-gru/grutlbpurge.c	2017-09-03 16:56:17.000000000 -0400
@@ -247,17 +247,6 @@ static void gru_invalidate_range_end(str
 	gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx\n", gms, start, end);
 }
 
-static void gru_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm,
-				unsigned long address)
-{
-	struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
-						 ms_notifier);
-
-	STAT(mmu_invalidate_page);
-	gru_flush_tlb_range(gms, address, PAGE_SIZE);
-	gru_dbg(grudev, "gms %p, address 0x%lx\n", gms, address);
-}
-
 static void gru_release(struct mmu_notifier *mn, struct mm_struct *mm)
 {
 	struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
@@ -269,7 +258,6 @@ static void gru_release(struct mmu_notif
 
 
 static const struct mmu_notifier_ops gru_mmuops = {
-	.invalidate_page	= gru_invalidate_page,
 	.invalidate_range_start	= gru_invalidate_range_start,
 	.invalidate_range_end	= gru_invalidate_range_end,
 	.release		= gru_release,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/mmc/core/block.c linux-libre-4.13-gnu/drivers/mmc/core/block.c
--- linux-libre-4.13-rc7-gnu/drivers/mmc/core/block.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/mmc/core/block.c	2017-09-03 16:56:17.000000000 -0400
@@ -1213,7 +1213,7 @@ static void mmc_blk_issue_drv_op(struct
 		break;
 	}
 	mq_rq->drv_op_result = ret;
-	blk_end_request_all(req, ret);
+	blk_end_request_all(req, ret ? BLK_STS_IOERR : BLK_STS_OK);
 }
 
 static void mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
@@ -1718,9 +1718,9 @@ static bool mmc_blk_rw_cmd_err(struct mm
 		if (err)
 			req_pending = old_req_pending;
 		else
-			req_pending = blk_end_request(req, 0, blocks << 9);
+			req_pending = blk_end_request(req, BLK_STS_OK, blocks << 9);
 	} else {
-		req_pending = blk_end_request(req, 0, brq->data.bytes_xfered);
+		req_pending = blk_end_request(req, BLK_STS_OK, brq->data.bytes_xfered);
 	}
 	return req_pending;
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/mmc/host/sdhci-xenon.c linux-libre-4.13-gnu/drivers/mmc/host/sdhci-xenon.c
--- linux-libre-4.13-rc7-gnu/drivers/mmc/host/sdhci-xenon.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/mmc/host/sdhci-xenon.c	2017-09-03 16:56:17.000000000 -0400
@@ -210,8 +210,27 @@ static void xenon_set_uhs_signaling(stru
 	sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
 }
 
+static void xenon_set_power(struct sdhci_host *host, unsigned char mode,
+		unsigned short vdd)
+{
+	struct mmc_host *mmc = host->mmc;
+	u8 pwr = host->pwr;
+
+	sdhci_set_power_noreg(host, mode, vdd);
+
+	if (host->pwr == pwr)
+		return;
+
+	if (host->pwr == 0)
+		vdd = 0;
+
+	if (!IS_ERR(mmc->supply.vmmc))
+		mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
+}
+
 static const struct sdhci_ops sdhci_xenon_ops = {
 	.set_clock		= sdhci_set_clock,
+	.set_power		= xenon_set_power,
 	.set_bus_width		= sdhci_set_bus_width,
 	.reset			= xenon_reset,
 	.set_uhs_signaling	= xenon_set_uhs_signaling,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/dsa/bcm_sf2.c linux-libre-4.13-gnu/drivers/net/dsa/bcm_sf2.c
--- linux-libre-4.13-rc7-gnu/drivers/net/dsa/bcm_sf2.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/dsa/bcm_sf2.c	2017-09-03 16:56:17.000000000 -0400
@@ -1048,6 +1048,7 @@ struct bcm_sf2_of_data {
 	u32 type;
 	const u16 *reg_offsets;
 	unsigned int core_reg_align;
+	unsigned int num_cfp_rules;
 };
 
 /* Register offsets for the SWITCH_REG_* block */
@@ -1071,6 +1072,7 @@ static const struct bcm_sf2_of_data bcm_
 	.type		= BCM7445_DEVICE_ID,
 	.core_reg_align	= 0,
 	.reg_offsets	= bcm_sf2_7445_reg_offsets,
+	.num_cfp_rules	= 256,
 };
 
 static const u16 bcm_sf2_7278_reg_offsets[] = {
@@ -1093,6 +1095,7 @@ static const struct bcm_sf2_of_data bcm_
 	.type		= BCM7278_DEVICE_ID,
 	.core_reg_align	= 1,
 	.reg_offsets	= bcm_sf2_7278_reg_offsets,
+	.num_cfp_rules	= 128,
 };
 
 static const struct of_device_id bcm_sf2_of_match[] = {
@@ -1149,6 +1152,7 @@ static int bcm_sf2_sw_probe(struct platf
 	priv->type = data->type;
 	priv->reg_offsets = data->reg_offsets;
 	priv->core_reg_align = data->core_reg_align;
+	priv->num_cfp_rules = data->num_cfp_rules;
 
 	/* Auto-detection using standard registers will not work, so
 	 * provide an indication of what kind of device we are for
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/dsa/bcm_sf2_cfp.c linux-libre-4.13-gnu/drivers/net/dsa/bcm_sf2_cfp.c
--- linux-libre-4.13-rc7-gnu/drivers/net/dsa/bcm_sf2_cfp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/dsa/bcm_sf2_cfp.c	2017-09-03 16:56:17.000000000 -0400
@@ -98,7 +98,7 @@ static inline void bcm_sf2_cfp_rule_addr
 {
 	u32 reg;
 
-	WARN_ON(addr >= CFP_NUM_RULES);
+	WARN_ON(addr >= priv->num_cfp_rules);
 
 	reg = core_readl(priv, CORE_CFP_ACC);
 	reg &= ~(XCESS_ADDR_MASK << XCESS_ADDR_SHIFT);
@@ -109,7 +109,7 @@ static inline void bcm_sf2_cfp_rule_addr
 static inline unsigned int bcm_sf2_cfp_rule_size(struct bcm_sf2_priv *priv)
 {
 	/* Entry #0 is reserved */
-	return CFP_NUM_RULES - 1;
+	return priv->num_cfp_rules - 1;
 }
 
 static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
@@ -523,7 +523,7 @@ static int bcm_sf2_cfp_rule_get_all(stru
 		if (!(reg & OP_STR_DONE))
 			break;
 
-	} while (index < CFP_NUM_RULES);
+	} while (index < priv->num_cfp_rules);
 
 	/* Put the TCAM size here */
 	nfc->data = bcm_sf2_cfp_rule_size(priv);
@@ -544,7 +544,7 @@ int bcm_sf2_get_rxnfc(struct dsa_switch
 	case ETHTOOL_GRXCLSRLCNT:
 		/* Subtract the default, unusable rule */
 		nfc->rule_cnt = bitmap_weight(priv->cfp.used,
-					      CFP_NUM_RULES) - 1;
+					      priv->num_cfp_rules) - 1;
 		/* We support specifying rule locations */
 		nfc->data |= RX_CLS_LOC_SPECIAL;
 		break;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/dsa/bcm_sf2.h linux-libre-4.13-gnu/drivers/net/dsa/bcm_sf2.h
--- linux-libre-4.13-rc7-gnu/drivers/net/dsa/bcm_sf2.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/dsa/bcm_sf2.h	2017-09-03 16:56:17.000000000 -0400
@@ -72,6 +72,7 @@ struct bcm_sf2_priv {
 	u32 				type;
 	const u16			*reg_offsets;
 	unsigned int			core_reg_align;
+	unsigned int			num_cfp_rules;
 
 	/* spinlock protecting access to the indirect registers */
 	spinlock_t			indir_lock;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/apm/xgene/xgene_enet_main.c linux-libre-4.13-gnu/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/apm/xgene/xgene_enet_main.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/apm/xgene/xgene_enet_main.c	2017-09-03 16:56:17.000000000 -0400
@@ -1661,21 +1661,21 @@ static int xgene_enet_get_irqs(struct xg
 	return 0;
 }
 
-static int xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
+static void xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata)
 {
 	int ret;
 
 	if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII)
-		return 0;
+		return;
 
 	if (!IS_ENABLED(CONFIG_MDIO_XGENE))
-		return 0;
+		return;
 
 	ret = xgene_enet_phy_connect(pdata->ndev);
 	if (!ret)
 		pdata->mdio_driver = true;
 
-	return 0;
+	return;
 }
 
 static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata)
@@ -1779,10 +1779,6 @@ static int xgene_enet_get_resources(stru
 	if (ret)
 		return ret;
 
-	ret = xgene_enet_check_phy_handle(pdata);
-	if (ret)
-		return ret;
-
 	xgene_enet_gpiod_get(pdata);
 
 	pdata->clk = devm_clk_get(&pdev->dev, NULL);
@@ -2097,9 +2093,11 @@ static int xgene_enet_probe(struct platf
 		goto err;
 	}
 
+	xgene_enet_check_phy_handle(pdata);
+
 	ret = xgene_enet_init_hw(pdata);
 	if (ret)
-		goto err;
+		goto err2;
 
 	link_state = pdata->mac_ops->link_state;
 	if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) {
@@ -2117,29 +2115,30 @@ static int xgene_enet_probe(struct platf
 	spin_lock_init(&pdata->stats_lock);
 	ret = xgene_extd_stats_init(pdata);
 	if (ret)
-		goto err2;
+		goto err1;
 
 	xgene_enet_napi_add(pdata);
 	ret = register_netdev(ndev);
 	if (ret) {
 		netdev_err(ndev, "Failed to register netdev\n");
-		goto err2;
+		goto err1;
 	}
 
 	return 0;
 
-err2:
+err1:
 	/*
 	 * If necessary, free_netdev() will call netif_napi_del() and undo
 	 * the effects of xgene_enet_napi_add()'s calls to netif_napi_add().
 	 */
 
+	xgene_enet_delete_desc_rings(pdata);
+
+err2:
 	if (pdata->mdio_driver)
 		xgene_enet_phy_disconnect(pdata);
 	else if (phy_interface_mode_is_rgmii(pdata->phy_mode))
 		xgene_enet_mdio_remove(pdata);
-err1:
-	xgene_enet_delete_desc_rings(pdata);
 err:
 	free_netdev(ndev);
 	return ret;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_hw.h linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_hw.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_hw.h	2017-09-03 16:56:17.000000000 -0400
@@ -105,8 +105,7 @@ struct aq_hw_ops {
 
 	int (*hw_set_mac_address)(struct aq_hw_s *self, u8 *mac_addr);
 
-	int (*hw_get_link_status)(struct aq_hw_s *self,
-				  struct aq_hw_link_status_s *link_status);
+	int (*hw_get_link_status)(struct aq_hw_s *self);
 
 	int (*hw_set_link_speed)(struct aq_hw_s *self, u32 speed);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_nic.c linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_nic.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_nic.c	2017-09-03 16:56:17.000000000 -0400
@@ -103,6 +103,8 @@ int aq_nic_cfg_start(struct aq_nic_s *se
 	else
 		cfg->vecs = 1U;
 
+	cfg->num_rss_queues = min(cfg->vecs, AQ_CFG_NUM_RSS_QUEUES_DEF);
+
 	cfg->irq_type = aq_pci_func_get_irq_type(self->aq_pci_func);
 
 	if ((cfg->irq_type == AQ_HW_IRQ_LEGACY) ||
@@ -123,33 +125,30 @@ static void aq_nic_service_timer_cb(unsi
 	struct net_device *ndev = aq_nic_get_ndev(self);
 	int err = 0;
 	unsigned int i = 0U;
-	struct aq_hw_link_status_s link_status;
 	struct aq_ring_stats_rx_s stats_rx;
 	struct aq_ring_stats_tx_s stats_tx;
 
 	if (aq_utils_obj_test(&self->header.flags, AQ_NIC_FLAGS_IS_NOT_READY))
 		goto err_exit;
 
-	err = self->aq_hw_ops.hw_get_link_status(self->aq_hw, &link_status);
+	err = self->aq_hw_ops.hw_get_link_status(self->aq_hw);
 	if (err < 0)
 		goto err_exit;
 
-	self->aq_hw_ops.hw_interrupt_moderation_set(self->aq_hw,
-			    self->aq_nic_cfg.is_interrupt_moderation);
+	self->link_status = self->aq_hw->aq_link_status;
 
-	if (memcmp(&link_status, &self->link_status, sizeof(link_status))) {
-		if (link_status.mbps) {
-			aq_utils_obj_set(&self->header.flags,
-					 AQ_NIC_FLAG_STARTED);
-			aq_utils_obj_clear(&self->header.flags,
-					   AQ_NIC_LINK_DOWN);
-			netif_carrier_on(self->ndev);
-		} else {
-			netif_carrier_off(self->ndev);
-			aq_utils_obj_set(&self->header.flags, AQ_NIC_LINK_DOWN);
-		}
+	self->aq_hw_ops.hw_interrupt_moderation_set(self->aq_hw,
+		    self->aq_nic_cfg.is_interrupt_moderation);
 
-		self->link_status = link_status;
+	if (self->link_status.mbps) {
+		aq_utils_obj_set(&self->header.flags,
+				 AQ_NIC_FLAG_STARTED);
+		aq_utils_obj_clear(&self->header.flags,
+				   AQ_NIC_LINK_DOWN);
+		netif_carrier_on(self->ndev);
+	} else {
+		netif_carrier_off(self->ndev);
+		aq_utils_obj_set(&self->header.flags, AQ_NIC_LINK_DOWN);
 	}
 
 	memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s));
@@ -597,14 +596,11 @@ exit:
 }
 
 int aq_nic_xmit(struct aq_nic_s *self, struct sk_buff *skb)
-__releases(&ring->lock)
-__acquires(&ring->lock)
 {
 	struct aq_ring_s *ring = NULL;
 	unsigned int frags = 0U;
 	unsigned int vec = skb->queue_mapping % self->aq_nic_cfg.vecs;
 	unsigned int tc = 0U;
-	unsigned int trys = AQ_CFG_LOCK_TRYS;
 	int err = NETDEV_TX_OK;
 	bool is_nic_in_bad_state;
 
@@ -628,36 +624,21 @@ __acquires(&ring->lock)
 		goto err_exit;
 	}
 
-	do {
-		if (spin_trylock(&ring->header.lock)) {
-			frags = aq_nic_map_skb(self, skb, ring);
-
-			if (likely(frags)) {
-				err = self->aq_hw_ops.hw_ring_tx_xmit(
-								self->aq_hw,
-								ring, frags);
-				if (err >= 0) {
-					if (aq_ring_avail_dx(ring) <
-					    AQ_CFG_SKB_FRAGS_MAX + 1)
-						aq_nic_ndev_queue_stop(
-								self,
-								ring->idx);
+	frags = aq_nic_map_skb(self, skb, ring);
 
-					++ring->stats.tx.packets;
-					ring->stats.tx.bytes += skb->len;
-				}
-			} else {
-				err = NETDEV_TX_BUSY;
-			}
+	if (likely(frags)) {
+		err = self->aq_hw_ops.hw_ring_tx_xmit(self->aq_hw,
+						      ring,
+						      frags);
+		if (err >= 0) {
+			if (aq_ring_avail_dx(ring) < AQ_CFG_SKB_FRAGS_MAX + 1)
+				aq_nic_ndev_queue_stop(self, ring->idx);
 
-			spin_unlock(&ring->header.lock);
-			break;
+			++ring->stats.tx.packets;
+			ring->stats.tx.bytes += skb->len;
 		}
-	} while (--trys);
-
-	if (!trys) {
+	} else {
 		err = NETDEV_TX_BUSY;
-		goto err_exit;
 	}
 
 err_exit:
@@ -688,11 +669,26 @@ int aq_nic_set_multicast_list(struct aq_
 	netdev_for_each_mc_addr(ha, ndev) {
 		ether_addr_copy(self->mc_list.ar[i++], ha->addr);
 		++self->mc_list.count;
+
+		if (i >= AQ_CFG_MULTICAST_ADDRESS_MAX)
+			break;
 	}
 
-	return self->aq_hw_ops.hw_multicast_list_set(self->aq_hw,
+	if (i >= AQ_CFG_MULTICAST_ADDRESS_MAX) {
+		/* Number of filters is too big: atlantic does not support this.
+		 * Force all multi filter to support this.
+		 * With this we disable all UC filters and setup "all pass"
+		 * multicast mask
+		 */
+		self->packet_filter |= IFF_ALLMULTI;
+		self->aq_hw->aq_nic_cfg->mc_list_count = 0;
+		return self->aq_hw_ops.hw_packet_filter_set(self->aq_hw,
+							self->packet_filter);
+	} else {
+		return self->aq_hw_ops.hw_multicast_list_set(self->aq_hw,
 						    self->mc_list.ar,
 						    self->mc_list.count);
+	}
 }
 
 int aq_nic_set_mtu(struct aq_nic_s *self, int new_mtu)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_ring.c linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_ring.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_ring.c	2017-09-03 16:56:17.000000000 -0400
@@ -101,7 +101,6 @@ int aq_ring_init(struct aq_ring_s *self)
 	self->hw_head = 0;
 	self->sw_head = 0;
 	self->sw_tail = 0;
-	spin_lock_init(&self->header.lock);
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_utils.h linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_utils.h
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_utils.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_utils.h	2017-09-03 16:56:17.000000000 -0400
@@ -17,7 +17,6 @@
 #define AQ_DIMOF(_ARY_)  ARRAY_SIZE(_ARY_)
 
 struct aq_obj_s {
-	spinlock_t lock; /* spinlock for nic/rings processing */
 	atomic_t flags;
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_vec.c linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/aq_vec.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/aq_vec.c	2017-09-03 16:56:17.000000000 -0400
@@ -34,8 +34,6 @@ struct aq_vec_s {
 #define AQ_VEC_RX_ID 1
 
 static int aq_vec_poll(struct napi_struct *napi, int budget)
-__releases(&self->lock)
-__acquires(&self->lock)
 {
 	struct aq_vec_s *self = container_of(napi, struct aq_vec_s, napi);
 	struct aq_ring_s *ring = NULL;
@@ -47,7 +45,7 @@ __acquires(&self->lock)
 
 	if (!self) {
 		err = -EINVAL;
-	} else if (spin_trylock(&self->header.lock)) {
+	} else {
 		for (i = 0U, ring = self->ring[0];
 			self->tx_rings > i; ++i, ring = self->ring[i]) {
 			if (self->aq_hw_ops->hw_ring_tx_head_update) {
@@ -105,11 +103,8 @@ __acquires(&self->lock)
 			self->aq_hw_ops->hw_irq_enable(self->aq_hw,
 					1U << self->aq_ring_param.vec_idx);
 		}
-
-err_exit:
-		spin_unlock(&self->header.lock);
 	}
-
+err_exit:
 	return work_done;
 }
 
@@ -185,8 +180,6 @@ int aq_vec_init(struct aq_vec_s *self, s
 	self->aq_hw_ops = aq_hw_ops;
 	self->aq_hw = aq_hw;
 
-	spin_lock_init(&self->header.lock);
-
 	for (i = 0U, ring = self->ring[0];
 		self->tx_rings > i; ++i, ring = self->ring[i]) {
 		err = aq_ring_init(&ring[AQ_VEC_TX_ID]);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c	2017-09-03 16:56:17.000000000 -0400
@@ -629,6 +629,12 @@ static int hw_atl_a0_hw_ring_rx_receive(
 				buff->is_udp_cso = (is_err & 0x10U) ? 0 : 1;
 			else if (0x0U == (pkt_type & 0x1CU))
 				buff->is_tcp_cso = (is_err & 0x10U) ? 0 : 1;
+
+			/* Checksum offload workaround for small packets */
+			if (rxd_wb->pkt_len <= 60) {
+				buff->is_ip_cso = 0U;
+				buff->is_cso_err = 0U;
+			}
 		}
 
 		is_err &= ~0x18U;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c	2017-09-03 16:56:17.000000000 -0400
@@ -645,6 +645,12 @@ static int hw_atl_b0_hw_ring_rx_receive(
 				buff->is_udp_cso = buff->is_cso_err ? 0U : 1U;
 			else if (0x0U == (pkt_type & 0x1CU))
 				buff->is_tcp_cso = buff->is_cso_err ? 0U : 1U;
+
+			/* Checksum offload workaround for small packets */
+			if (rxd_wb->pkt_len <= 60) {
+				buff->is_ip_cso = 0U;
+				buff->is_cso_err = 0U;
+			}
 		}
 
 		is_err &= ~0x18U;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c	2017-09-03 16:56:17.000000000 -0400
@@ -141,6 +141,12 @@ static int hw_atl_utils_init_ucp(struct
 
 	err = hw_atl_utils_ver_match(aq_hw_caps->fw_ver_expected,
 				     aq_hw_read_reg(self, 0x18U));
+
+	if (err < 0)
+		pr_err("%s: Bad FW version detected: expected=%x, actual=%x\n",
+		       AQ_CFG_DRV_NAME,
+		       aq_hw_caps->fw_ver_expected,
+		       aq_hw_read_reg(self, 0x18U));
 	return err;
 }
 
@@ -313,11 +319,11 @@ void hw_atl_utils_mpi_set(struct aq_hw_s
 err_exit:;
 }
 
-int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self,
-				     struct aq_hw_link_status_s *link_status)
+int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self)
 {
 	u32 cp0x036C = aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR);
 	u32 link_speed_mask = cp0x036C >> HW_ATL_MPI_SPEED_SHIFT;
+	struct aq_hw_link_status_s *link_status = &self->aq_link_status;
 
 	if (!link_speed_mask) {
 		link_status->mbps = 0U;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h	2017-09-03 16:56:17.000000000 -0400
@@ -180,8 +180,7 @@ void hw_atl_utils_mpi_set(struct aq_hw_s
 int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed,
 			       enum hal_atl_utils_fw_state_e state);
 
-int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self,
-				     struct aq_hw_link_status_s *link_status);
+int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self);
 
 int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
 				   struct aq_hw_caps_s *aq_hw_caps,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/bcmsysport.c linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/bcmsysport.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/bcmsysport.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/bcmsysport.c	2017-09-03 16:56:17.000000000 -0400
@@ -597,7 +597,7 @@ static int bcm_sysport_set_coalesce(stru
 
 static void bcm_sysport_free_cb(struct bcm_sysport_cb *cb)
 {
-	dev_kfree_skb_any(cb->skb);
+	dev_consume_skb_any(cb->skb);
 	cb->skb = NULL;
 	dma_unmap_addr_set(cb, dma_addr, 0);
 }
@@ -1346,6 +1346,8 @@ static int bcm_sysport_init_tx_ring(stru
 
 	ring->cbs = kcalloc(size, sizeof(struct bcm_sysport_cb), GFP_KERNEL);
 	if (!ring->cbs) {
+		dma_free_coherent(kdev, sizeof(struct dma_desc),
+				  ring->desc_cpu, ring->desc_dma);
 		netif_err(priv, hw, priv->netdev, "CB allocation failed\n");
 		return -ENOMEM;
 	}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2017-09-03 16:56:17.000000000 -0400
@@ -4647,7 +4647,6 @@ static int bnxt_hwrm_func_qcaps(struct b
 		pf->port_id = le16_to_cpu(resp->port_id);
 		bp->dev->dev_port = pf->port_id;
 		memcpy(pf->mac_addr, resp->mac_address, ETH_ALEN);
-		memcpy(bp->dev->dev_addr, pf->mac_addr, ETH_ALEN);
 		pf->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx);
 		pf->max_cp_rings = le16_to_cpu(resp->max_cmpl_rings);
 		pf->max_tx_rings = le16_to_cpu(resp->max_tx_rings);
@@ -4687,16 +4686,6 @@ static int bnxt_hwrm_func_qcaps(struct b
 		vf->max_stat_ctxs = le16_to_cpu(resp->max_stat_ctx);
 
 		memcpy(vf->mac_addr, resp->mac_address, ETH_ALEN);
-		mutex_unlock(&bp->hwrm_cmd_lock);
-
-		if (is_valid_ether_addr(vf->mac_addr)) {
-			/* overwrite netdev dev_adr with admin VF MAC */
-			memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
-		} else {
-			eth_hw_addr_random(bp->dev);
-			rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
-		}
-		return rc;
 #endif
 	}
 
@@ -7152,6 +7141,7 @@ int bnxt_setup_mq_tc(struct net_device *
 		bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
 		netdev_reset_tc(dev);
 	}
+	bp->tx_nr_rings += bp->tx_nr_rings_xdp;
 	bp->cp_nr_rings = sh ? max_t(int, bp->tx_nr_rings, bp->rx_nr_rings) :
 			       bp->tx_nr_rings + bp->rx_nr_rings;
 	bp->num_stat_ctxs = bp->cp_nr_rings;
@@ -7661,6 +7651,28 @@ void bnxt_restore_pf_fw_resources(struct
 	bnxt_subtract_ulp_resources(bp, BNXT_ROCE_ULP);
 }
 
+static int bnxt_init_mac_addr(struct bnxt *bp)
+{
+	int rc = 0;
+
+	if (BNXT_PF(bp)) {
+		memcpy(bp->dev->dev_addr, bp->pf.mac_addr, ETH_ALEN);
+	} else {
+#ifdef CONFIG_BNXT_SRIOV
+		struct bnxt_vf_info *vf = &bp->vf;
+
+		if (is_valid_ether_addr(vf->mac_addr)) {
+			/* overwrite netdev dev_adr with admin VF MAC */
+			memcpy(bp->dev->dev_addr, vf->mac_addr, ETH_ALEN);
+		} else {
+			eth_hw_addr_random(bp->dev);
+			rc = bnxt_approve_mac(bp, bp->dev->dev_addr);
+		}
+#endif
+	}
+	return rc;
+}
+
 static void bnxt_parse_log_pcie_link(struct bnxt *bp)
 {
 	enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
@@ -7789,7 +7801,12 @@ static int bnxt_init_one(struct pci_dev
 		rc = -1;
 		goto init_err_pci_clean;
 	}
-
+	rc = bnxt_init_mac_addr(bp);
+	if (rc) {
+		dev_err(&pdev->dev, "Unable to initialize mac address.\n");
+		rc = -EADDRNOTAVAIL;
+		goto init_err_pci_clean;
+	}
 	rc = bnxt_hwrm_queue_qportcfg(bp);
 	if (rc) {
 		netdev_err(bp->dev, "hwrm query qportcfg failure rc: %x\n",
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c	2017-09-03 16:56:17.000000000 -0400
@@ -84,6 +84,8 @@ static int bnxt_unregister_dev(struct bn
 
 		max_stat_ctxs = bnxt_get_max_func_stat_ctxs(bp);
 		bnxt_set_max_func_stat_ctxs(bp, max_stat_ctxs + 1);
+		if (ulp->msix_requested)
+			edev->en_ops->bnxt_free_msix(edev, ulp_id);
 	}
 	if (ulp->max_async_event_id)
 		bnxt_hwrm_func_rgtr_async_events(bp, NULL, 0);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/genet/bcmgenet.c linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/genet/bcmgenet.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/broadcom/genet/bcmgenet.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/broadcom/genet/bcmgenet.c	2017-09-03 16:56:17.000000000 -0400
@@ -1360,7 +1360,7 @@ static unsigned int __bcmgenet_tx_reclai
 		if (skb) {
 			pkts_compl++;
 			bytes_compl += GENET_CB(skb)->bytes_sent;
-			dev_kfree_skb_any(skb);
+			dev_consume_skb_any(skb);
 		}
 
 		txbds_processed++;
@@ -1875,7 +1875,7 @@ static int bcmgenet_alloc_rx_buffers(str
 		cb = ring->cbs + i;
 		skb = bcmgenet_rx_refill(priv, cb);
 		if (skb)
-			dev_kfree_skb_any(skb);
+			dev_consume_skb_any(skb);
 		if (!cb->skb)
 			return -ENOMEM;
 	}
@@ -1894,7 +1894,7 @@ static void bcmgenet_free_rx_buffers(str
 
 		skb = bcmgenet_free_rx_cb(&priv->pdev->dev, cb);
 		if (skb)
-			dev_kfree_skb_any(skb);
+			dev_consume_skb_any(skb);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c linux-libre-4.13-gnu/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c	2017-09-03 16:56:17.000000000 -0400
@@ -369,12 +369,12 @@ int t4_wr_mbox_meat_timeout(struct adapt
 		list_del(&entry.list);
 		spin_unlock(&adap->mbox_lock);
 		ret = (v == MBOX_OWNER_FW) ? -EBUSY : -ETIMEDOUT;
-		t4_record_mbox(adap, cmd, MBOX_LEN, access, ret);
+		t4_record_mbox(adap, cmd, size, access, ret);
 		return ret;
 	}
 
 	/* Copy in the new mailbox command and send it on its way ... */
-	t4_record_mbox(adap, cmd, MBOX_LEN, access, 0);
+	t4_record_mbox(adap, cmd, size, access, 0);
 	for (i = 0; i < size; i += 8)
 		t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p++));
 
@@ -426,7 +426,7 @@ int t4_wr_mbox_meat_timeout(struct adapt
 	}
 
 	ret = (pcie_fw & PCIE_FW_ERR_F) ? -ENXIO : -ETIMEDOUT;
-	t4_record_mbox(adap, cmd, MBOX_LEN, access, ret);
+	t4_record_mbox(adap, cmd, size, access, ret);
 	dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n",
 		*(const u8 *)cmd, mbox);
 	t4_report_fw_error(adap);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/faraday/ftgmac100.c linux-libre-4.13-gnu/drivers/net/ethernet/faraday/ftgmac100.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/faraday/ftgmac100.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/faraday/ftgmac100.c	2017-09-03 16:56:17.000000000 -0400
@@ -1863,7 +1863,6 @@ err_setup_mdio:
 err_ioremap:
 	release_resource(priv->res);
 err_req_mem:
-	netif_napi_del(&priv->napi);
 	free_netdev(netdev);
 err_alloc_etherdev:
 	return err;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/freescale/fman/mac.c linux-libre-4.13-gnu/drivers/net/ethernet/freescale/fman/mac.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/freescale/fman/mac.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/freescale/fman/mac.c	2017-09-03 16:56:17.000000000 -0400
@@ -623,6 +623,8 @@ static struct platform_device *dpaa_eth_
 		goto no_mem;
 	}
 
+	pdev->dev.of_node = node;
+	pdev->dev.parent = priv->dev;
 	set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
 
 	ret = platform_device_add_data(pdev, &data, sizeof(data));
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/marvell/mvpp2.c linux-libre-4.13-gnu/drivers/net/ethernet/marvell/mvpp2.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/marvell/mvpp2.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/marvell/mvpp2.c	2017-09-03 16:56:17.000000000 -0400
@@ -6504,7 +6504,7 @@ static int mvpp2_port_probe(struct platf
 	struct resource *res;
 	const char *dt_mac_addr;
 	const char *mac_from;
-	char hw_mac_addr[ETH_ALEN];
+	char hw_mac_addr[ETH_ALEN] = {0};
 	u32 id;
 	int features;
 	int phy_mode;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c	2017-09-03 16:56:17.000000000 -0400
@@ -288,13 +288,8 @@ static int mlx5e_dcbnl_ieee_setpfc(struc
 static u8 mlx5e_dcbnl_getdcbx(struct net_device *dev)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
-	struct mlx5e_dcbx *dcbx = &priv->dcbx;
-	u8 mode = DCB_CAP_DCBX_VER_IEEE | DCB_CAP_DCBX_VER_CEE;
-
-	if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_HOST)
-		mode |= DCB_CAP_DCBX_HOST;
 
-	return mode;
+	return priv->dcbx.cap;
 }
 
 static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode)
@@ -312,6 +307,7 @@ static u8 mlx5e_dcbnl_setdcbx(struct net
 		/* set dcbx to fw controlled */
 		if (!mlx5e_dcbnl_set_dcbx_mode(priv, MLX5E_DCBX_PARAM_VER_OPER_AUTO)) {
 			dcbx->mode = MLX5E_DCBX_PARAM_VER_OPER_AUTO;
+			dcbx->cap &= ~DCB_CAP_DCBX_HOST;
 			return 0;
 		}
 
@@ -324,6 +320,8 @@ static u8 mlx5e_dcbnl_setdcbx(struct net
 	if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev)))
 		return 1;
 
+	dcbx->cap = mode;
+
 	return 0;
 }
 
@@ -628,9 +626,9 @@ static u8 mlx5e_dcbnl_getcap(struct net_
 		*cap = false;
 		break;
 	case DCB_CAP_ATTR_DCBX:
-		*cap = (DCB_CAP_DCBX_LLD_MANAGED |
-			DCB_CAP_DCBX_VER_CEE |
-			DCB_CAP_DCBX_STATIC);
+		*cap = priv->dcbx.cap |
+		       DCB_CAP_DCBX_VER_CEE |
+		       DCB_CAP_DCBX_VER_IEEE;
 		break;
 	default:
 		*cap = 0;
@@ -754,8 +752,16 @@ void mlx5e_dcbnl_initialize(struct mlx5e
 {
 	struct mlx5e_dcbx *dcbx = &priv->dcbx;
 
+	if (!MLX5_CAP_GEN(priv->mdev, qos))
+		return;
+
 	if (MLX5_CAP_GEN(priv->mdev, dcbx))
 		mlx5e_dcbnl_query_dcbx_mode(priv, &dcbx->mode);
 
+	priv->dcbx.cap = DCB_CAP_DCBX_VER_CEE |
+			 DCB_CAP_DCBX_VER_IEEE;
+	if (priv->dcbx.mode == MLX5E_DCBX_PARAM_VER_OPER_HOST)
+		priv->dcbx.cap |= DCB_CAP_DCBX_HOST;
+
 	mlx5e_ets_init(priv);
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c	2017-09-03 16:56:17.000000000 -0400
@@ -641,8 +641,10 @@ int mlx5e_ethtool_set_channels(struct ml
 
 	new_channels.params = priv->channels.params;
 	new_channels.params.num_channels = count;
-	mlx5e_build_default_indir_rqt(priv->mdev, new_channels.params.indirection_rqt,
-				      MLX5E_INDIR_RQT_SIZE, count);
+	if (!netif_is_rxfh_configured(priv->netdev))
+		mlx5e_build_default_indir_rqt(priv->mdev,
+					      new_channels.params.indirection_rqt,
+					      MLX5E_INDIR_RQT_SIZE, count);
 
 	if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
 		priv->channels.params = new_channels.params;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en.h	2017-09-03 16:56:17.000000000 -0400
@@ -263,6 +263,7 @@ struct mlx5e_dcbx {
 
 	/* The only setting that cannot be read from FW */
 	u8                         tc_tsa[IEEE_8021QAZ_MAX_TCS];
+	u8                         cap;
 };
 #endif
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_main.c	2017-09-03 16:56:17.000000000 -0400
@@ -1969,6 +1969,7 @@ static void mlx5e_build_rx_cq_param(stru
 	}
 
 	mlx5e_build_common_cq_param(priv, param);
+	param->cq_period_mode = params->rx_cq_period_mode;
 }
 
 static void mlx5e_build_tx_cq_param(struct mlx5e_priv *priv,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c	2017-09-03 16:56:17.000000000 -0400
@@ -222,13 +222,13 @@ static inline int mlx5e_page_alloc_mappe
 	if (unlikely(!page))
 		return -ENOMEM;
 
-	dma_info->page = page;
 	dma_info->addr = dma_map_page(rq->pdev, page, 0,
 				      RQ_PAGE_SIZE(rq), rq->buff.map_dir);
 	if (unlikely(dma_mapping_error(rq->pdev, dma_info->addr))) {
 		put_page(page);
 		return -ENOMEM;
 	}
+	dma_info->page = page;
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c	2017-09-03 16:56:17.000000000 -0400
@@ -1443,12 +1443,10 @@ static int mlx5e_route_lookup_ipv6(struc
 	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 	int ret;
 
-	dst = ip6_route_output(dev_net(mirred_dev), NULL, fl6);
-	ret = dst->error;
-	if (ret) {
-		dst_release(dst);
+	ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
+					 fl6);
+	if (ret < 0)
 		return ret;
-	}
 
 	*out_ttl = ip6_dst_hoplimit(dst);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c	2017-09-03 16:56:17.000000000 -0400
@@ -128,10 +128,10 @@ static inline int mlx5e_skb_l3_header_of
 		return mlx5e_skb_l2_header_offset(skb);
 }
 
-static inline unsigned int mlx5e_calc_min_inline(enum mlx5_inline_modes mode,
-						 struct sk_buff *skb)
+static inline u16 mlx5e_calc_min_inline(enum mlx5_inline_modes mode,
+					struct sk_buff *skb)
 {
-	int hlen;
+	u16 hlen;
 
 	switch (mode) {
 	case MLX5_INLINE_MODE_NONE:
@@ -140,19 +140,22 @@ static inline unsigned int mlx5e_calc_mi
 		hlen = eth_get_headlen(skb->data, skb_headlen(skb));
 		if (hlen == ETH_HLEN && !skb_vlan_tag_present(skb))
 			hlen += VLAN_HLEN;
-		return hlen;
+		break;
 	case MLX5_INLINE_MODE_IP:
 		/* When transport header is set to zero, it means no transport
 		 * header. When transport header is set to 0xff's, it means
 		 * transport header wasn't set.
 		 */
-		if (skb_transport_offset(skb))
-			return mlx5e_skb_l3_header_offset(skb);
+		if (skb_transport_offset(skb)) {
+			hlen = mlx5e_skb_l3_header_offset(skb);
+			break;
+		}
 		/* fall through */
 	case MLX5_INLINE_MODE_L2:
 	default:
-		return mlx5e_skb_l2_header_offset(skb);
+		hlen = mlx5e_skb_l2_header_offset(skb);
 	}
+	return min_t(u16, hlen, skb->len);
 }
 
 static inline void mlx5e_tx_skb_pull_inline(unsigned char **skb_data,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c	2017-09-03 16:56:17.000000000 -0400
@@ -815,7 +815,7 @@ void esw_offloads_cleanup(struct mlx5_es
 	struct mlx5_eswitch_rep *rep;
 	int vport;
 
-	for (vport = 0; vport < nvports; vport++) {
+	for (vport = nvports - 1; vport >= 0; vport--) {
 		rep = &esw->offloads.vport_reps[vport];
 		if (!rep->valid)
 			continue;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2017-09-03 16:56:17.000000000 -0400
@@ -1186,7 +1186,6 @@ static int mlx5_load_one(struct mlx5_cor
 		}
 	}
 
-	clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
 	set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
 out:
 	mutex_unlock(&dev->intf_state_mutex);
@@ -1261,7 +1260,7 @@ static int mlx5_unload_one(struct mlx5_c
 		mlx5_drain_health_recovery(dev);
 
 	mutex_lock(&dev->intf_state_mutex);
-	if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
+	if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {
 		dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n",
 			 __func__);
 		if (cleanup)
@@ -1270,7 +1269,6 @@ static int mlx5_unload_one(struct mlx5_c
 	}
 
 	clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
-	set_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
 
 	if (mlx5_device_registered(dev))
 		mlx5_detach_device(dev);
@@ -1565,8 +1563,6 @@ static void shutdown(struct pci_dev *pde
 	int err;
 
 	dev_info(&pdev->dev, "Shutdown was called\n");
-	/* Notify mlx5 clients that the kernel is being shut down */
-	set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state);
 	err = mlx5_try_fast_unload(dev);
 	if (err)
 		mlx5_unload_one(dev, priv, false);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/srq.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/srq.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlx5/core/srq.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlx5/core/srq.c	2017-09-03 16:56:17.000000000 -0400
@@ -201,13 +201,13 @@ static int destroy_srq_cmd(struct mlx5_c
 static int arm_srq_cmd(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
 		       u16 lwm, int is_srq)
 {
-	/* arm_srq structs missing using identical xrc ones */
-	u32 srq_in[MLX5_ST_SZ_DW(arm_xrc_srq_in)] = {0};
-	u32 srq_out[MLX5_ST_SZ_DW(arm_xrc_srq_out)] = {0};
+	u32 srq_in[MLX5_ST_SZ_DW(arm_rq_in)] = {0};
+	u32 srq_out[MLX5_ST_SZ_DW(arm_rq_out)] = {0};
 
-	MLX5_SET(arm_xrc_srq_in, srq_in, opcode,   MLX5_CMD_OP_ARM_XRC_SRQ);
-	MLX5_SET(arm_xrc_srq_in, srq_in, xrc_srqn, srq->srqn);
-	MLX5_SET(arm_xrc_srq_in, srq_in, lwm,      lwm);
+	MLX5_SET(arm_rq_in, srq_in, opcode, MLX5_CMD_OP_ARM_RQ);
+	MLX5_SET(arm_rq_in, srq_in, op_mod, MLX5_ARM_RQ_IN_OP_MOD_SRQ);
+	MLX5_SET(arm_rq_in, srq_in, srq_number, srq->srqn);
+	MLX5_SET(arm_rq_in, srq_in, lwm,      lwm);
 
 	return  mlx5_cmd_exec(dev, srq_in, sizeof(srq_in),
 			      srq_out, sizeof(srq_out));
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum.c	2017-08-27 21:53:33.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum.c	2017-09-03 17:37:54.000000000 -0400
@@ -4137,6 +4137,8 @@ static int mlxsw_sp_netdevice_port_upper
 			return -EINVAL;
 		if (!info->linking)
 			break;
+		if (netdev_has_any_upper_dev(upper_dev))
+			return -EINVAL;
 		if (netif_is_lag_master(upper_dev) &&
 		    !mlxsw_sp_master_lag_check(mlxsw_sp, upper_dev,
 					       info->upper_info))
@@ -4256,6 +4258,10 @@ static int mlxsw_sp_netdevice_port_vlan_
 		upper_dev = info->upper_dev;
 		if (!netif_is_bridge_master(upper_dev))
 			return -EINVAL;
+		if (!info->linking)
+			break;
+		if (netdev_has_any_upper_dev(upper_dev))
+			return -EINVAL;
 		break;
 	case NETDEV_CHANGEUPPER:
 		upper_dev = info->upper_dev;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c	2017-09-03 16:56:17.000000000 -0400
@@ -705,6 +705,7 @@ static int mlxsw_sp_port_attr_mc_router_
 					    bool is_port_mc_router)
 {
 	struct mlxsw_sp_bridge_port *bridge_port;
+	int err;
 
 	if (switchdev_trans_ph_prepare(trans))
 		return 0;
@@ -715,11 +716,17 @@ static int mlxsw_sp_port_attr_mc_router_
 		return 0;
 
 	if (!bridge_port->bridge_device->multicast_enabled)
-		return 0;
+		goto out;
 
-	return mlxsw_sp_bridge_port_flood_table_set(mlxsw_sp_port, bridge_port,
-						    MLXSW_SP_FLOOD_TYPE_MC,
-						    is_port_mc_router);
+	err = mlxsw_sp_bridge_port_flood_table_set(mlxsw_sp_port, bridge_port,
+						   MLXSW_SP_FLOOD_TYPE_MC,
+						   is_port_mc_router);
+	if (err)
+		return err;
+
+out:
+	bridge_port->mrouter = is_port_mc_router;
+	return 0;
 }
 
 static int mlxsw_sp_port_mc_disabled_set(struct mlxsw_sp_port *mlxsw_sp_port,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/flower/match.c linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/flower/match.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/flower/match.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/flower/match.c	2017-09-03 16:56:17.000000000 -0400
@@ -42,33 +42,29 @@ nfp_flower_compile_meta_tci(struct nfp_f
 			    struct tc_cls_flower_offload *flow, u8 key_type,
 			    bool mask_version)
 {
+	struct fl_flow_key *target = mask_version ? flow->mask : flow->key;
 	struct flow_dissector_key_vlan *flow_vlan;
 	u16 tmp_tci;
 
+	memset(frame, 0, sizeof(struct nfp_flower_meta_two));
 	/* Populate the metadata frame. */
 	frame->nfp_flow_key_layer = key_type;
 	frame->mask_id = ~0;
 
-	if (mask_version) {
-		frame->tci = cpu_to_be16(~0);
-		return;
-	}
-
-	flow_vlan = skb_flow_dissector_target(flow->dissector,
-					      FLOW_DISSECTOR_KEY_VLAN,
-					      flow->key);
-
-	/* Populate the tci field. */
-	if (!flow_vlan->vlan_id) {
-		tmp_tci = 0;
-	} else {
-		tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
-				     flow_vlan->vlan_priority) |
-			  FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
-				     flow_vlan->vlan_id) |
-			  NFP_FLOWER_MASK_VLAN_CFI;
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_VLAN)) {
+		flow_vlan = skb_flow_dissector_target(flow->dissector,
+						      FLOW_DISSECTOR_KEY_VLAN,
+						      target);
+		/* Populate the tci field. */
+		if (flow_vlan->vlan_id) {
+			tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
+					     flow_vlan->vlan_priority) |
+				  FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
+					     flow_vlan->vlan_id) |
+				  NFP_FLOWER_MASK_VLAN_CFI;
+			frame->tci = cpu_to_be16(tmp_tci);
+		}
 	}
-	frame->tci = cpu_to_be16(tmp_tci);
 }
 
 static void
@@ -99,17 +95,18 @@ nfp_flower_compile_mac(struct nfp_flower
 		       bool mask_version)
 {
 	struct fl_flow_key *target = mask_version ? flow->mask : flow->key;
-	struct flow_dissector_key_eth_addrs *flow_mac;
-
-	flow_mac = skb_flow_dissector_target(flow->dissector,
-					     FLOW_DISSECTOR_KEY_ETH_ADDRS,
-					     target);
+	struct flow_dissector_key_eth_addrs *addr;
 
 	memset(frame, 0, sizeof(struct nfp_flower_mac_mpls));
 
-	/* Populate mac frame. */
-	ether_addr_copy(frame->mac_dst, &flow_mac->dst[0]);
-	ether_addr_copy(frame->mac_src, &flow_mac->src[0]);
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
+		addr = skb_flow_dissector_target(flow->dissector,
+						 FLOW_DISSECTOR_KEY_ETH_ADDRS,
+						 target);
+		/* Populate mac frame. */
+		ether_addr_copy(frame->mac_dst, &addr->dst[0]);
+		ether_addr_copy(frame->mac_src, &addr->src[0]);
+	}
 
 	if (mask_version)
 		frame->mpls_lse = cpu_to_be32(~0);
@@ -121,14 +118,17 @@ nfp_flower_compile_tport(struct nfp_flow
 			 bool mask_version)
 {
 	struct fl_flow_key *target = mask_version ? flow->mask : flow->key;
-	struct flow_dissector_key_ports *flow_tp;
+	struct flow_dissector_key_ports *tp;
 
-	flow_tp = skb_flow_dissector_target(flow->dissector,
-					    FLOW_DISSECTOR_KEY_PORTS,
-					    target);
+	memset(frame, 0, sizeof(struct nfp_flower_tp_ports));
 
-	frame->port_src = flow_tp->src;
-	frame->port_dst = flow_tp->dst;
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_PORTS)) {
+		tp = skb_flow_dissector_target(flow->dissector,
+					       FLOW_DISSECTOR_KEY_PORTS,
+					       target);
+		frame->port_src = tp->src;
+		frame->port_dst = tp->dst;
+	}
 }
 
 static void
@@ -137,25 +137,27 @@ nfp_flower_compile_ipv4(struct nfp_flowe
 			bool mask_version)
 {
 	struct fl_flow_key *target = mask_version ? flow->mask : flow->key;
-	struct flow_dissector_key_ipv4_addrs *flow_ipv4;
-	struct flow_dissector_key_basic *flow_basic;
+	struct flow_dissector_key_ipv4_addrs *addr;
+	struct flow_dissector_key_basic *basic;
 
-	flow_ipv4 = skb_flow_dissector_target(flow->dissector,
-					      FLOW_DISSECTOR_KEY_IPV4_ADDRS,
-					      target);
+	/* Wildcard TOS/TTL for now. */
+	memset(frame, 0, sizeof(struct nfp_flower_ipv4));
 
-	flow_basic = skb_flow_dissector_target(flow->dissector,
-					       FLOW_DISSECTOR_KEY_BASIC,
-					       target);
+	if (dissector_uses_key(flow->dissector,
+			       FLOW_DISSECTOR_KEY_IPV4_ADDRS)) {
+		addr = skb_flow_dissector_target(flow->dissector,
+						 FLOW_DISSECTOR_KEY_IPV4_ADDRS,
+						 target);
+		frame->ipv4_src = addr->src;
+		frame->ipv4_dst = addr->dst;
+	}
 
-	/* Populate IPv4 frame. */
-	frame->reserved = 0;
-	frame->ipv4_src = flow_ipv4->src;
-	frame->ipv4_dst = flow_ipv4->dst;
-	frame->proto = flow_basic->ip_proto;
-	/* Wildcard TOS/TTL for now. */
-	frame->tos = 0;
-	frame->ttl = 0;
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_BASIC)) {
+		basic = skb_flow_dissector_target(flow->dissector,
+						  FLOW_DISSECTOR_KEY_BASIC,
+						  target);
+		frame->proto = basic->ip_proto;
+	}
 }
 
 static void
@@ -164,26 +166,27 @@ nfp_flower_compile_ipv6(struct nfp_flowe
 			bool mask_version)
 {
 	struct fl_flow_key *target = mask_version ? flow->mask : flow->key;
-	struct flow_dissector_key_ipv6_addrs *flow_ipv6;
-	struct flow_dissector_key_basic *flow_basic;
+	struct flow_dissector_key_ipv6_addrs *addr;
+	struct flow_dissector_key_basic *basic;
 
-	flow_ipv6 = skb_flow_dissector_target(flow->dissector,
-					      FLOW_DISSECTOR_KEY_IPV6_ADDRS,
-					      target);
+	/* Wildcard LABEL/TOS/TTL for now. */
+	memset(frame, 0, sizeof(struct nfp_flower_ipv6));
 
-	flow_basic = skb_flow_dissector_target(flow->dissector,
-					       FLOW_DISSECTOR_KEY_BASIC,
-					       target);
+	if (dissector_uses_key(flow->dissector,
+			       FLOW_DISSECTOR_KEY_IPV6_ADDRS)) {
+		addr = skb_flow_dissector_target(flow->dissector,
+						 FLOW_DISSECTOR_KEY_IPV6_ADDRS,
+						 target);
+		frame->ipv6_src = addr->src;
+		frame->ipv6_dst = addr->dst;
+	}
 
-	/* Populate IPv6 frame. */
-	frame->reserved = 0;
-	frame->ipv6_src = flow_ipv6->src;
-	frame->ipv6_dst = flow_ipv6->dst;
-	frame->proto = flow_basic->ip_proto;
-	/* Wildcard LABEL/TOS/TTL for now. */
-	frame->ipv6_flow_label_exthdr = 0;
-	frame->tos = 0;
-	frame->ttl = 0;
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_BASIC)) {
+		basic = skb_flow_dissector_target(flow->dissector,
+						  FLOW_DISSECTOR_KEY_BASIC,
+						  target);
+		frame->proto = basic->ip_proto;
+	}
 }
 
 int nfp_flower_compile_flow_match(struct tc_cls_flower_offload *flow,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/flower/offload.c linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/flower/offload.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/flower/offload.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/flower/offload.c	2017-09-03 16:56:17.000000000 -0400
@@ -105,43 +105,62 @@ static int
 nfp_flower_calculate_key_layers(struct nfp_fl_key_ls *ret_key_ls,
 				struct tc_cls_flower_offload *flow)
 {
-	struct flow_dissector_key_control *mask_enc_ctl;
-	struct flow_dissector_key_basic *mask_basic;
-	struct flow_dissector_key_basic *key_basic;
+	struct flow_dissector_key_basic *mask_basic = NULL;
+	struct flow_dissector_key_basic *key_basic = NULL;
+	struct flow_dissector_key_ip *mask_ip = NULL;
 	u32 key_layer_two;
 	u8 key_layer;
 	int key_size;
 
-	mask_enc_ctl = skb_flow_dissector_target(flow->dissector,
-						 FLOW_DISSECTOR_KEY_ENC_CONTROL,
-						 flow->mask);
+	if (dissector_uses_key(flow->dissector,
+			       FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
+		struct flow_dissector_key_control *mask_enc_ctl =
+			skb_flow_dissector_target(flow->dissector,
+						  FLOW_DISSECTOR_KEY_ENC_CONTROL,
+						  flow->mask);
+		/* We are expecting a tunnel. For now we ignore offloading. */
+		if (mask_enc_ctl->addr_type)
+			return -EOPNOTSUPP;
+	}
 
-	mask_basic = skb_flow_dissector_target(flow->dissector,
-					       FLOW_DISSECTOR_KEY_BASIC,
-					       flow->mask);
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_BASIC)) {
+		mask_basic = skb_flow_dissector_target(flow->dissector,
+						       FLOW_DISSECTOR_KEY_BASIC,
+						       flow->mask);
+
+		key_basic = skb_flow_dissector_target(flow->dissector,
+						      FLOW_DISSECTOR_KEY_BASIC,
+						      flow->key);
+	}
+
+	if (dissector_uses_key(flow->dissector, FLOW_DISSECTOR_KEY_IP))
+		mask_ip = skb_flow_dissector_target(flow->dissector,
+						    FLOW_DISSECTOR_KEY_IP,
+						    flow->mask);
 
-	key_basic = skb_flow_dissector_target(flow->dissector,
-					      FLOW_DISSECTOR_KEY_BASIC,
-					      flow->key);
 	key_layer_two = 0;
 	key_layer = NFP_FLOWER_LAYER_PORT | NFP_FLOWER_LAYER_MAC;
 	key_size = sizeof(struct nfp_flower_meta_one) +
 		   sizeof(struct nfp_flower_in_port) +
 		   sizeof(struct nfp_flower_mac_mpls);
 
-	/* We are expecting a tunnel. For now we ignore offloading. */
-	if (mask_enc_ctl->addr_type)
-		return -EOPNOTSUPP;
-
-	if (mask_basic->n_proto) {
+	if (mask_basic && mask_basic->n_proto) {
 		/* Ethernet type is present in the key. */
 		switch (key_basic->n_proto) {
 		case cpu_to_be16(ETH_P_IP):
+			if (mask_ip && mask_ip->tos)
+				return -EOPNOTSUPP;
+			if (mask_ip && mask_ip->ttl)
+				return -EOPNOTSUPP;
 			key_layer |= NFP_FLOWER_LAYER_IPV4;
 			key_size += sizeof(struct nfp_flower_ipv4);
 			break;
 
 		case cpu_to_be16(ETH_P_IPV6):
+			if (mask_ip && mask_ip->tos)
+				return -EOPNOTSUPP;
+			if (mask_ip && mask_ip->ttl)
+				return -EOPNOTSUPP;
 			key_layer |= NFP_FLOWER_LAYER_IPV6;
 			key_size += sizeof(struct nfp_flower_ipv6);
 			break;
@@ -152,6 +171,11 @@ nfp_flower_calculate_key_layers(struct n
 		case cpu_to_be16(ETH_P_ARP):
 			return -EOPNOTSUPP;
 
+		/* Currently we do not offload MPLS. */
+		case cpu_to_be16(ETH_P_MPLS_UC):
+		case cpu_to_be16(ETH_P_MPLS_MC):
+			return -EOPNOTSUPP;
+
 		/* Will be included in layer 2. */
 		case cpu_to_be16(ETH_P_8021Q):
 			break;
@@ -166,7 +190,7 @@ nfp_flower_calculate_key_layers(struct n
 		}
 	}
 
-	if (mask_basic->ip_proto) {
+	if (mask_basic && mask_basic->ip_proto) {
 		/* Ethernet type is present in the key. */
 		switch (key_basic->ip_proto) {
 		case IPPROTO_TCP:
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/nfp_main.c linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/nfp_main.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/nfp_main.c	2017-08-27 21:53:42.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/nfp_main.c	2017-09-03 17:38:03.000000000 -0400
@@ -98,21 +98,20 @@ static int nfp_pcie_sriov_enable(struct
 	struct nfp_pf *pf = pci_get_drvdata(pdev);
 	int err;
 
-	mutex_lock(&pf->lock);
-
 	if (num_vfs > pf->limit_vfs) {
 		nfp_info(pf->cpp, "Firmware limits number of VFs to %u\n",
 			 pf->limit_vfs);
-		err = -EINVAL;
-		goto err_unlock;
+		return -EINVAL;
 	}
 
 	err = pci_enable_sriov(pdev, num_vfs);
 	if (err) {
 		dev_warn(&pdev->dev, "Failed to enable PCI SR-IOV: %d\n", err);
-		goto err_unlock;
+		return err;
 	}
 
+	mutex_lock(&pf->lock);
+
 	err = nfp_app_sriov_enable(pf->app, num_vfs);
 	if (err) {
 		dev_warn(&pdev->dev,
@@ -129,9 +128,8 @@ static int nfp_pcie_sriov_enable(struct
 	return num_vfs;
 
 err_sriov_disable:
-	pci_disable_sriov(pdev);
-err_unlock:
 	mutex_unlock(&pf->lock);
+	pci_disable_sriov(pdev);
 	return err;
 #endif
 	return 0;
@@ -158,10 +156,10 @@ static int nfp_pcie_sriov_disable(struct
 
 	pf->num_vfs = 0;
 
+	mutex_unlock(&pf->lock);
+
 	pci_disable_sriov(pdev);
 	dev_dbg(&pdev->dev, "Removed VFs.\n");
-
-	mutex_unlock(&pf->lock);
 #endif
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_common.c linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_common.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_common.c	2017-09-03 16:56:17.000000000 -0400
@@ -895,6 +895,8 @@ static int nfp_net_tx(struct sk_buff *sk
 
 	netdev_tx_sent_queue(nd_q, txbuf->real_len);
 
+	skb_tx_timestamp(skb);
+
 	tx_ring->wr_p += nr_frags + 1;
 	if (nfp_net_tx_ring_should_stop(tx_ring))
 		nfp_net_tx_ring_stop(nd_q, tx_ring);
@@ -903,8 +905,6 @@ static int nfp_net_tx(struct sk_buff *sk
 	if (!skb->xmit_more || netif_xmit_stopped(nd_q))
 		nfp_net_tx_xmit_more_flush(tx_ring);
 
-	skb_tx_timestamp(skb);
-
 	return NETDEV_TX_OK;
 
 err_unmap:
@@ -1751,6 +1751,10 @@ static int nfp_net_rx(struct nfp_net_rx_
 			continue;
 		}
 
+		nfp_net_dma_unmap_rx(dp, rxbuf->dma_addr);
+
+		nfp_net_rx_give_one(dp, rx_ring, new_frag, new_dma_addr);
+
 		if (likely(!meta.portid)) {
 			netdev = dp->netdev;
 		} else {
@@ -1759,16 +1763,12 @@ static int nfp_net_rx(struct nfp_net_rx_
 			nn = netdev_priv(dp->netdev);
 			netdev = nfp_app_repr_get(nn->app, meta.portid);
 			if (unlikely(!netdev)) {
-				nfp_net_rx_drop(dp, r_vec, rx_ring, rxbuf, skb);
+				nfp_net_rx_drop(dp, r_vec, rx_ring, NULL, skb);
 				continue;
 			}
 			nfp_repr_inc_rx_stats(netdev, pkt_len);
 		}
 
-		nfp_net_dma_unmap_rx(dp, rxbuf->dma_addr);
-
-		nfp_net_rx_give_one(dp, rx_ring, new_frag, new_dma_addr);
-
 		skb_reserve(skb, pkt_off);
 		skb_put(skb, pkt_len);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_main.c linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_main.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/netronome/nfp/nfp_net_main.c	2017-09-03 16:56:17.000000000 -0400
@@ -456,13 +456,9 @@ static int nfp_net_pf_app_start(struct n
 {
 	int err;
 
-	err = nfp_net_pf_app_start_ctrl(pf);
-	if (err)
-		return err;
-
 	err = nfp_app_start(pf->app, pf->ctrl_vnic);
 	if (err)
-		goto err_ctrl_stop;
+		return err;
 
 	if (pf->num_vfs) {
 		err = nfp_app_sriov_enable(pf->app, pf->num_vfs);
@@ -474,8 +470,6 @@ static int nfp_net_pf_app_start(struct n
 
 err_app_stop:
 	nfp_app_stop(pf->app);
-err_ctrl_stop:
-	nfp_net_pf_app_stop_ctrl(pf);
 	return err;
 }
 
@@ -484,7 +478,6 @@ static void nfp_net_pf_app_stop(struct n
 	if (pf->num_vfs)
 		nfp_app_sriov_disable(pf->app);
 	nfp_app_stop(pf->app);
-	nfp_net_pf_app_stop_ctrl(pf);
 }
 
 static void nfp_net_pci_unmap_mem(struct nfp_pf *pf)
@@ -559,7 +552,7 @@ err_unmap_ctrl:
 
 static void nfp_net_pci_remove_finish(struct nfp_pf *pf)
 {
-	nfp_net_pf_app_stop(pf);
+	nfp_net_pf_app_stop_ctrl(pf);
 	/* stop app first, to avoid double free of ctrl vNIC's ddir */
 	nfp_net_debugfs_dir_clean(&pf->ddir);
 
@@ -690,6 +683,7 @@ int nfp_net_pci_probe(struct nfp_pf *pf)
 {
 	struct nfp_net_fw_version fw_ver;
 	u8 __iomem *ctrl_bar, *qc_bar;
+	struct nfp_net *nn;
 	int stride;
 	int err;
 
@@ -766,7 +760,7 @@ int nfp_net_pci_probe(struct nfp_pf *pf)
 	if (err)
 		goto err_free_vnics;
 
-	err = nfp_net_pf_app_start(pf);
+	err = nfp_net_pf_app_start_ctrl(pf);
 	if (err)
 		goto err_free_irqs;
 
@@ -774,12 +768,20 @@ int nfp_net_pci_probe(struct nfp_pf *pf)
 	if (err)
 		goto err_stop_app;
 
+	err = nfp_net_pf_app_start(pf);
+	if (err)
+		goto err_clean_vnics;
+
 	mutex_unlock(&pf->lock);
 
 	return 0;
 
+err_clean_vnics:
+	list_for_each_entry(nn, &pf->vnics, vnic_list)
+		if (nfp_net_is_data_vnic(nn))
+			nfp_net_pf_clean_vnic(pf, nn);
 err_stop_app:
-	nfp_net_pf_app_stop(pf);
+	nfp_net_pf_app_stop_ctrl(pf);
 err_free_irqs:
 	nfp_net_pf_free_irqs(pf);
 err_free_vnics:
@@ -803,6 +805,8 @@ void nfp_net_pci_remove(struct nfp_pf *p
 	if (list_empty(&pf->vnics))
 		goto out;
 
+	nfp_net_pf_app_stop(pf);
+
 	list_for_each_entry(nn, &pf->vnics, vnic_list)
 		if (nfp_net_is_data_vnic(nn))
 			nfp_net_pf_clean_vnic(pf, nn);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c linux-libre-4.13-gnu/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c	2017-09-03 16:56:17.000000000 -0400
@@ -724,7 +724,7 @@ static void ql_build_coredump_seg_header
 	seg_hdr->cookie = MPI_COREDUMP_COOKIE;
 	seg_hdr->segNum = seg_number;
 	seg_hdr->segSize = seg_size;
-	memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1);
+	strncpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1);
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/realtek/r8169.c linux-libre-4.13-gnu/drivers/net/ethernet/realtek/r8169.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/realtek/r8169.c	2017-08-27 21:54:11.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/realtek/r8169.c	2017-09-03 17:38:32.000000000 -0400
@@ -6845,8 +6845,7 @@ static void rtl8169_tx_clear_range(struc
 			rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb,
 					     tp->TxDescArray + entry);
 			if (skb) {
-				tp->dev->stats.tx_dropped++;
-				dev_kfree_skb_any(skb);
+				dev_consume_skb_any(skb);
 				tx_skb->skb = NULL;
 			}
 		}
@@ -7301,7 +7300,7 @@ static void rtl_tx(struct net_device *de
 			tp->tx_stats.packets++;
 			tp->tx_stats.bytes += tx_skb->skb->len;
 			u64_stats_update_end(&tp->tx_stats.syncp);
-			dev_kfree_skb_any(tx_skb->skb);
+			dev_consume_skb_any(tx_skb->skb);
 			tx_skb->skb = NULL;
 		}
 		dirty_tx++;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c linux-libre-4.13-gnu/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c	2017-09-03 16:56:17.000000000 -0400
@@ -47,6 +47,8 @@ static int sxgbe_probe_config_dt(struct
 	plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
 					   sizeof(*plat->mdio_bus_data),
 					   GFP_KERNEL);
+	if (!plat->mdio_bus_data)
+		return -ENOMEM;
 
 	dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), GFP_KERNEL);
 	if (!dma_cfg)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c linux-libre-4.13-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c	2017-09-03 16:56:17.000000000 -0400
@@ -269,7 +269,10 @@ static int socfpga_dwmac_set_phy_mode(st
 	ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
 	ctrl |= val << reg_shift;
 
-	if (dwmac->f2h_ptp_ref_clk) {
+	if (dwmac->f2h_ptp_ref_clk ||
+	    phymode == PHY_INTERFACE_MODE_MII ||
+	    phymode == PHY_INTERFACE_MODE_GMII ||
+	    phymode == PHY_INTERFACE_MODE_SGMII) {
 		ctrl |= SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK << (reg_shift / 2);
 		regmap_read(sys_mgr_base_addr, SYSMGR_FPGAGRP_MODULE_REG,
 			    &module);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c linux-libre-4.13-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c	2017-09-03 16:56:17.000000000 -0400
@@ -979,14 +979,6 @@ static int sun8i_dwmac_probe(struct plat
 }
 
 static const struct of_device_id sun8i_dwmac_match[] = {
-	{ .compatible = "allwinner,sun8i-h3-emac",
-		.data = &emac_variant_h3 },
-	{ .compatible = "allwinner,sun8i-v3s-emac",
-		.data = &emac_variant_v3s },
-	{ .compatible = "allwinner,sun8i-a83t-emac",
-		.data = &emac_variant_a83t },
-	{ .compatible = "allwinner,sun50i-a64-emac",
-		.data = &emac_variant_a64 },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/ethernet/ti/cpsw-common.c linux-libre-4.13-gnu/drivers/net/ethernet/ti/cpsw-common.c
--- linux-libre-4.13-rc7-gnu/drivers/net/ethernet/ti/cpsw-common.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/ethernet/ti/cpsw-common.c	2017-09-03 16:56:17.000000000 -0400
@@ -96,7 +96,7 @@ int ti_cm_get_macid(struct device *dev,
 	if (of_machine_is_compatible("ti,dra7"))
 		return davinci_emac_3517_get_macid(dev, 0x514, slave, mac_addr);
 
-	dev_err(dev, "incompatible machine/device type for reading mac address\n");
+	dev_info(dev, "incompatible machine/device type for reading mac address\n");
 	return -ENOENT;
 }
 EXPORT_SYMBOL_GPL(ti_cm_get_macid);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/hyperv/netvsc_drv.c linux-libre-4.13-gnu/drivers/net/hyperv/netvsc_drv.c
--- linux-libre-4.13-rc7-gnu/drivers/net/hyperv/netvsc_drv.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/hyperv/netvsc_drv.c	2017-09-03 16:56:17.000000000 -0400
@@ -1269,7 +1269,12 @@ static void netvsc_link_change(struct wo
 	bool notify = false, reschedule = false;
 	unsigned long flags, next_reconfig, delay;
 
-	rtnl_lock();
+	/* if changes are happening, comeback later */
+	if (!rtnl_trylock()) {
+		schedule_delayed_work(&ndev_ctx->dwork, LINKCHANGE_INT);
+		return;
+	}
+
 	net_device = rtnl_dereference(ndev_ctx->nvdev);
 	if (!net_device)
 		goto out_unlock;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/macsec.c linux-libre-4.13-gnu/drivers/net/macsec.c
--- linux-libre-4.13-rc7-gnu/drivers/net/macsec.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/macsec.c	2017-09-03 16:56:17.000000000 -0400
@@ -3521,6 +3521,7 @@ module_init(macsec_init);
 module_exit(macsec_exit);
 
 MODULE_ALIAS_RTNL_LINK("macsec");
+MODULE_ALIAS_GENL_FAMILY("macsec");
 
 MODULE_DESCRIPTION("MACsec IEEE 802.1AE");
 MODULE_LICENSE("GPL v2");
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/phy/phy.c linux-libre-4.13-gnu/drivers/net/phy/phy.c
--- linux-libre-4.13-rc7-gnu/drivers/net/phy/phy.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/phy/phy.c	2017-09-03 16:56:17.000000000 -0400
@@ -749,9 +749,6 @@ void phy_stop_machine(struct phy_device
 	if (phydev->state > PHY_UP && phydev->state != PHY_HALTED)
 		phydev->state = PHY_UP;
 	mutex_unlock(&phydev->lock);
-
-	/* Now we can run the state machine synchronously */
-	phy_state_machine(&phydev->state_queue.work);
 }
 
 /**
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/phy/phy_device.c linux-libre-4.13-gnu/drivers/net/phy/phy_device.c
--- linux-libre-4.13-rc7-gnu/drivers/net/phy/phy_device.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/phy/phy_device.c	2017-09-03 16:56:17.000000000 -0400
@@ -864,15 +864,17 @@ EXPORT_SYMBOL(phy_attached_info);
 #define ATTACHED_FMT "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)"
 void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
 {
+	const char *drv_name = phydev->drv ? phydev->drv->name : "unbound";
+
 	if (!fmt) {
 		dev_info(&phydev->mdio.dev, ATTACHED_FMT "\n",
-			 phydev->drv->name, phydev_name(phydev),
+			 drv_name, phydev_name(phydev),
 			 phydev->irq);
 	} else {
 		va_list ap;
 
 		dev_info(&phydev->mdio.dev, ATTACHED_FMT,
-			 phydev->drv->name, phydev_name(phydev),
+			 drv_name, phydev_name(phydev),
 			 phydev->irq);
 
 		va_start(ap, fmt);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/usb/cdc_ncm.c linux-libre-4.13-gnu/drivers/net/usb/cdc_ncm.c
--- linux-libre-4.13-rc7-gnu/drivers/net/usb/cdc_ncm.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/usb/cdc_ncm.c	2017-09-03 16:56:17.000000000 -0400
@@ -1758,6 +1758,13 @@ static const struct usb_device_id cdc_de
 	  .driver_info = (unsigned long)&wwan_noarp_info,
 	},
 
+	/* u-blox TOBY-L4 */
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x1546, 0x1010,
+		USB_CLASS_COMM,
+		USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
+	  .driver_info = (unsigned long)&wwan_info,
+	},
+
 	/* Generic CDC-NCM devices */
 	{ USB_INTERFACE_INFO(USB_CLASS_COMM,
 		USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/virtio_net.c linux-libre-4.13-gnu/drivers/net/virtio_net.c
--- linux-libre-4.13-rc7-gnu/drivers/net/virtio_net.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/virtio_net.c	2017-09-03 16:56:17.000000000 -0400
@@ -1058,7 +1058,7 @@ static void free_old_xmit_skbs(struct se
 		bytes += skb->len;
 		packets++;
 
-		dev_kfree_skb_any(skb);
+		dev_consume_skb_any(skb);
 	}
 
 	/* Avoid overhead when no packets have been processed
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/wireless/intel/iwlwifi/pcie/internal.h linux-libre-4.13-gnu/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
--- linux-libre-4.13-rc7-gnu/drivers/net/wireless/intel/iwlwifi/pcie/internal.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/wireless/intel/iwlwifi/pcie/internal.h	2017-09-03 16:56:17.000000000 -0400
@@ -787,6 +787,8 @@ int iwl_pci_fw_enter_d0i3(struct iwl_tra
 
 void iwl_pcie_enable_rx_wake(struct iwl_trans *trans, bool enable);
 
+void iwl_pcie_rx_allocator_work(struct work_struct *data);
+
 /* common functions that are used by gen2 transport */
 void iwl_pcie_apm_config(struct iwl_trans *trans);
 int iwl_pcie_prepare_card_hw(struct iwl_trans *trans);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/wireless/intel/iwlwifi/pcie/rx.c linux-libre-4.13-gnu/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
--- linux-libre-4.13-rc7-gnu/drivers/net/wireless/intel/iwlwifi/pcie/rx.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/wireless/intel/iwlwifi/pcie/rx.c	2017-09-03 16:56:17.000000000 -0400
@@ -597,7 +597,7 @@ static void iwl_pcie_rx_allocator_get(st
 	rxq->free_count += RX_CLAIM_REQ_ALLOC;
 }
 
-static void iwl_pcie_rx_allocator_work(struct work_struct *data)
+void iwl_pcie_rx_allocator_work(struct work_struct *data)
 {
 	struct iwl_rb_allocator *rba_p =
 		container_of(data, struct iwl_rb_allocator, rx_alloc);
@@ -900,10 +900,6 @@ static int _iwl_pcie_rx_init(struct iwl_
 			return err;
 	}
 	def_rxq = trans_pcie->rxq;
-	if (!rba->alloc_wq)
-		rba->alloc_wq = alloc_workqueue("rb_allocator",
-						WQ_HIGHPRI | WQ_UNBOUND, 1);
-	INIT_WORK(&rba->rx_alloc, iwl_pcie_rx_allocator_work);
 
 	spin_lock(&rba->lock);
 	atomic_set(&rba->req_pending, 0);
@@ -1017,10 +1013,6 @@ void iwl_pcie_rx_free(struct iwl_trans *
 	}
 
 	cancel_work_sync(&rba->rx_alloc);
-	if (rba->alloc_wq) {
-		destroy_workqueue(rba->alloc_wq);
-		rba->alloc_wq = NULL;
-	}
 
 	iwl_pcie_free_rbs_pool(trans);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/wireless/intel/iwlwifi/pcie/trans.c linux-libre-4.13-gnu/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
--- linux-libre-4.13-rc7-gnu/drivers/net/wireless/intel/iwlwifi/pcie/trans.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/wireless/intel/iwlwifi/pcie/trans.c	2017-09-03 16:56:17.000000000 -0400
@@ -1786,6 +1786,11 @@ void iwl_trans_pcie_free(struct iwl_tran
 		iwl_pcie_tx_free(trans);
 	iwl_pcie_rx_free(trans);
 
+	if (trans_pcie->rba.alloc_wq) {
+		destroy_workqueue(trans_pcie->rba.alloc_wq);
+		trans_pcie->rba.alloc_wq = NULL;
+	}
+
 	if (trans_pcie->msix_enabled) {
 		for (i = 0; i < trans_pcie->alloc_vecs; i++) {
 			irq_set_affinity_hint(
@@ -3169,6 +3174,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(s
 		trans_pcie->inta_mask = CSR_INI_SET_MASK;
 	 }
 
+	trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
+						   WQ_HIGHPRI | WQ_UNBOUND, 1);
+	INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
+
 #ifdef CONFIG_IWLWIFI_PCIE_RTPM
 	trans->runtime_pm_mode = IWL_PLAT_PM_MODE_D0I3;
 #else
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/net/wireless/ti/wl1251/main.c linux-libre-4.13-gnu/drivers/net/wireless/ti/wl1251/main.c
--- linux-libre-4.13-rc7-gnu/drivers/net/wireless/ti/wl1251/main.c	2017-08-27 22:00:38.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/net/wireless/ti/wl1251/main.c	2017-09-03 17:44:56.000000000 -0400
@@ -1571,6 +1571,7 @@ struct ieee80211_hw *wl1251_alloc_hw(voi
 
 	wl->state = WL1251_STATE_OFF;
 	mutex_init(&wl->mutex);
+	spin_lock_init(&wl->wl_lock);
 
 	wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE;
 	wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/nvme/host/pci.c linux-libre-4.13-gnu/drivers/nvme/host/pci.c
--- linux-libre-4.13-rc7-gnu/drivers/nvme/host/pci.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/nvme/host/pci.c	2017-09-03 16:56:17.000000000 -0400
@@ -109,6 +109,7 @@ struct nvme_dev {
 	/* host memory buffer support: */
 	u64 host_mem_size;
 	u32 nr_host_mem_descs;
+	dma_addr_t host_mem_descs_dma;
 	struct nvme_host_mem_buf_desc *host_mem_descs;
 	void **host_mem_desc_bufs;
 };
@@ -1565,16 +1566,10 @@ static inline void nvme_release_cmb(stru
 
 static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
 {
-	size_t len = dev->nr_host_mem_descs * sizeof(*dev->host_mem_descs);
+	u64 dma_addr = dev->host_mem_descs_dma;
 	struct nvme_command c;
-	u64 dma_addr;
 	int ret;
 
-	dma_addr = dma_map_single(dev->dev, dev->host_mem_descs, len,
-			DMA_TO_DEVICE);
-	if (dma_mapping_error(dev->dev, dma_addr))
-		return -ENOMEM;
-
 	memset(&c, 0, sizeof(c));
 	c.features.opcode	= nvme_admin_set_features;
 	c.features.fid		= cpu_to_le32(NVME_FEAT_HOST_MEM_BUF);
@@ -1591,7 +1586,6 @@ static int nvme_set_host_mem(struct nvme
 			 "failed to set host mem (err %d, flags %#x).\n",
 			 ret, bits);
 	}
-	dma_unmap_single(dev->dev, dma_addr, len, DMA_TO_DEVICE);
 	return ret;
 }
 
@@ -1609,7 +1603,9 @@ static void nvme_free_host_mem(struct nv
 
 	kfree(dev->host_mem_desc_bufs);
 	dev->host_mem_desc_bufs = NULL;
-	kfree(dev->host_mem_descs);
+	dma_free_coherent(dev->dev,
+			dev->nr_host_mem_descs * sizeof(*dev->host_mem_descs),
+			dev->host_mem_descs, dev->host_mem_descs_dma);
 	dev->host_mem_descs = NULL;
 }
 
@@ -1617,6 +1613,7 @@ static int nvme_alloc_host_mem(struct nv
 {
 	struct nvme_host_mem_buf_desc *descs;
 	u32 chunk_size, max_entries, len;
+	dma_addr_t descs_dma;
 	int i = 0;
 	void **bufs;
 	u64 size = 0, tmp;
@@ -1627,7 +1624,8 @@ retry:
 	tmp = (preferred + chunk_size - 1);
 	do_div(tmp, chunk_size);
 	max_entries = tmp;
-	descs = kcalloc(max_entries, sizeof(*descs), GFP_KERNEL);
+	descs = dma_zalloc_coherent(dev->dev, max_entries * sizeof(*descs),
+			&descs_dma, GFP_KERNEL);
 	if (!descs)
 		goto out;
 
@@ -1661,6 +1659,7 @@ retry:
 	dev->nr_host_mem_descs = i;
 	dev->host_mem_size = size;
 	dev->host_mem_descs = descs;
+	dev->host_mem_descs_dma = descs_dma;
 	dev->host_mem_desc_bufs = bufs;
 	return 0;
 
@@ -1674,7 +1673,8 @@ out_free_bufs:
 
 	kfree(bufs);
 out_free_descs:
-	kfree(descs);
+	dma_free_coherent(dev->dev, max_entries * sizeof(*descs), descs,
+			descs_dma);
 out:
 	/* try a smaller chunk size if we failed early */
 	if (chunk_size >= PAGE_SIZE * 2 && (i == 0 || size < min)) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/nvme/host/rdma.c linux-libre-4.13-gnu/drivers/nvme/host/rdma.c
--- linux-libre-4.13-rc7-gnu/drivers/nvme/host/rdma.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/nvme/host/rdma.c	2017-09-03 16:56:17.000000000 -0400
@@ -920,7 +920,11 @@ static int nvme_rdma_map_sg_fr(struct nv
 	struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl;
 	int nr;
 
-	nr = ib_map_mr_sg(req->mr, req->sg_table.sgl, count, NULL, PAGE_SIZE);
+	/*
+	 * Align the MR to a 4K page size to match the ctrl page size and
+	 * the block virtual boundary.
+	 */
+	nr = ib_map_mr_sg(req->mr, req->sg_table.sgl, count, NULL, SZ_4K);
 	if (nr < count) {
 		if (nr < 0)
 			return nr;
@@ -1583,7 +1587,7 @@ static int nvme_rdma_configure_admin_que
 		goto out_cleanup_queue;
 
 	ctrl->ctrl.max_hw_sectors =
-		(ctrl->max_fr_pages - 1) << (PAGE_SHIFT - 9);
+		(ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9);
 
 	error = nvme_init_identify(&ctrl->ctrl);
 	if (error)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/s390/cio/vfio_ccw_cp.c linux-libre-4.13-gnu/drivers/s390/cio/vfio_ccw_cp.c
--- linux-libre-4.13-rc7-gnu/drivers/s390/cio/vfio_ccw_cp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/s390/cio/vfio_ccw_cp.c	2017-09-03 16:56:17.000000000 -0400
@@ -481,7 +481,7 @@ static int ccwchain_fetch_tic(struct ccw
 		ccw_tail = ccw_head + (iter->ch_len - 1) * sizeof(struct ccw1);
 
 		if ((ccw_head <= ccw->cda) && (ccw->cda <= ccw_tail)) {
-			ccw->cda = (__u32) (addr_t) (iter->ch_ccw +
+			ccw->cda = (__u32) (addr_t) (((char *)iter->ch_ccw) +
 						     (ccw->cda - ccw_head));
 			return 0;
 		}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/scsi/ipr.c linux-libre-4.13-gnu/drivers/scsi/ipr.c
--- linux-libre-4.13-rc7-gnu/drivers/scsi/ipr.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/scsi/ipr.c	2017-09-03 16:56:17.000000000 -0400
@@ -4945,6 +4945,7 @@ static int ipr_slave_configure(struct sc
 		}
 		if (ipr_is_vset_device(res)) {
 			sdev->scsi_level = SCSI_SPC_3;
+			sdev->no_report_opcodes = 1;
 			blk_queue_rq_timeout(sdev->request_queue,
 					     IPR_VSET_RW_TIMEOUT);
 			blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/scsi/qedf/qedf_els.c linux-libre-4.13-gnu/drivers/scsi/qedf/qedf_els.c
--- linux-libre-4.13-rc7-gnu/drivers/scsi/qedf/qedf_els.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/scsi/qedf/qedf_els.c	2017-09-03 16:56:17.000000000 -0400
@@ -489,7 +489,7 @@ static void qedf_srr_compl(struct qedf_e
 
 	/* If a SRR times out, simply free resources */
 	if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)
-		goto out_free;
+		goto out_put;
 
 	/* Normalize response data into struct fc_frame */
 	mp_req = &(srr_req->mp_req);
@@ -501,7 +501,7 @@ static void qedf_srr_compl(struct qedf_e
 	if (!fp) {
 		QEDF_ERR(&(qedf->dbg_ctx),
 		    "fc_frame_alloc failure.\n");
-		goto out_free;
+		goto out_put;
 	}
 
 	/* Copy frame header from firmware into fp */
@@ -526,9 +526,10 @@ static void qedf_srr_compl(struct qedf_e
 	}
 
 	fc_frame_free(fp);
-out_free:
+out_put:
 	/* Put reference for original command since SRR completed */
 	kref_put(&orig_io_req->refcount, qedf_release_cmd);
+out_free:
 	kfree(cb_arg);
 }
 
@@ -780,7 +781,7 @@ static void qedf_rec_compl(struct qedf_e
 
 	/* If a REC times out, free resources */
 	if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)
-		goto out_free;
+		goto out_put;
 
 	/* Normalize response data into struct fc_frame */
 	mp_req = &(rec_req->mp_req);
@@ -792,7 +793,7 @@ static void qedf_rec_compl(struct qedf_e
 	if (!fp) {
 		QEDF_ERR(&(qedf->dbg_ctx),
 		    "fc_frame_alloc failure.\n");
-		goto out_free;
+		goto out_put;
 	}
 
 	/* Copy frame header from firmware into fp */
@@ -884,9 +885,10 @@ static void qedf_rec_compl(struct qedf_e
 
 out_free_frame:
 	fc_frame_free(fp);
-out_free:
+out_put:
 	/* Put reference for original command since REC completed */
 	kref_put(&orig_io_req->refcount, qedf_release_cmd);
+out_free:
 	kfree(cb_arg);
 }
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/scsi/sg.c linux-libre-4.13-gnu/drivers/scsi/sg.c
--- linux-libre-4.13-rc7-gnu/drivers/scsi/sg.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/scsi/sg.c	2017-09-03 16:56:17.000000000 -0400
@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int
 			read_lock_irqsave(&sfp->rq_list_lock, iflags);
 			val = 0;
 			list_for_each_entry(srp, &sfp->rq_list, entry) {
-				if (val > SG_MAX_QUEUE)
+				if (val >= SG_MAX_QUEUE)
 					break;
 				memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
 				rinfo[val].req_state = srp->done + 1;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/drivers/xen/gntdev.c linux-libre-4.13-gnu/drivers/xen/gntdev.c
--- linux-libre-4.13-rc7-gnu/drivers/xen/gntdev.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/drivers/xen/gntdev.c	2017-09-03 16:56:17.000000000 -0400
@@ -484,13 +484,6 @@ static void mn_invl_range_start(struct m
 	mutex_unlock(&priv->lock);
 }
 
-static void mn_invl_page(struct mmu_notifier *mn,
-			 struct mm_struct *mm,
-			 unsigned long address)
-{
-	mn_invl_range_start(mn, mm, address, address + PAGE_SIZE);
-}
-
 static void mn_release(struct mmu_notifier *mn,
 		       struct mm_struct *mm)
 {
@@ -522,7 +515,6 @@ static void mn_release(struct mmu_notifi
 
 static const struct mmu_notifier_ops gntdev_mmu_ops = {
 	.release                = mn_release,
-	.invalidate_page        = mn_invl_page,
 	.invalidate_range_start = mn_invl_range_start,
 };
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/ceph/addr.c linux-libre-4.13-gnu/fs/ceph/addr.c
--- linux-libre-4.13-rc7-gnu/fs/ceph/addr.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/ceph/addr.c	2017-09-03 16:56:17.000000000 -0400
@@ -189,7 +189,7 @@ static int ceph_releasepage(struct page
 /*
  * read a single page, without unlocking it.
  */
-static int readpage_nounlock(struct file *filp, struct page *page)
+static int ceph_do_readpage(struct file *filp, struct page *page)
 {
 	struct inode *inode = file_inode(filp);
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -219,7 +219,7 @@ static int readpage_nounlock(struct file
 
 	err = ceph_readpage_from_fscache(inode, page);
 	if (err == 0)
-		goto out;
+		return -EINPROGRESS;
 
 	dout("readpage inode %p file %p page %p index %lu\n",
 	     inode, filp, page, page->index);
@@ -249,8 +249,11 @@ out:
 
 static int ceph_readpage(struct file *filp, struct page *page)
 {
-	int r = readpage_nounlock(filp, page);
-	unlock_page(page);
+	int r = ceph_do_readpage(filp, page);
+	if (r != -EINPROGRESS)
+		unlock_page(page);
+	else
+		r = 0;
 	return r;
 }
 
@@ -1237,7 +1240,7 @@ retry_locked:
 			goto retry_locked;
 		r = writepage_nounlock(page, NULL);
 		if (r < 0)
-			goto fail_nosnap;
+			goto fail_unlock;
 		goto retry_locked;
 	}
 
@@ -1265,11 +1268,14 @@ retry_locked:
 	}
 
 	/* we need to read it. */
-	r = readpage_nounlock(file, page);
-	if (r < 0)
-		goto fail_nosnap;
+	r = ceph_do_readpage(file, page);
+	if (r < 0) {
+		if (r == -EINPROGRESS)
+			return -EAGAIN;
+		goto fail_unlock;
+	}
 	goto retry_locked;
-fail_nosnap:
+fail_unlock:
 	unlock_page(page);
 	return r;
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/ceph/cache.c linux-libre-4.13-gnu/fs/ceph/cache.c
--- linux-libre-4.13-rc7-gnu/fs/ceph/cache.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/ceph/cache.c	2017-09-03 16:56:17.000000000 -0400
@@ -297,13 +297,7 @@ void ceph_fscache_file_set_cookie(struct
 	}
 }
 
-static void ceph_vfs_readpage_complete(struct page *page, void *data, int error)
-{
-	if (!error)
-		SetPageUptodate(page);
-}
-
-static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int error)
+static void ceph_readpage_from_fscache_complete(struct page *page, void *data, int error)
 {
 	if (!error)
 		SetPageUptodate(page);
@@ -331,7 +325,7 @@ int ceph_readpage_from_fscache(struct in
 		return -ENOBUFS;
 
 	ret = fscache_read_or_alloc_page(ci->fscache, page,
-					 ceph_vfs_readpage_complete, NULL,
+					 ceph_readpage_from_fscache_complete, NULL,
 					 GFP_KERNEL);
 
 	switch (ret) {
@@ -360,7 +354,7 @@ int ceph_readpages_from_fscache(struct i
 		return -ENOBUFS;
 
 	ret = fscache_read_or_alloc_pages(ci->fscache, mapping, pages, nr_pages,
-					  ceph_vfs_readpage_complete_unlock,
+					  ceph_readpage_from_fscache_complete,
 					  NULL, mapping_gfp_mask(mapping));
 
 	switch (ret) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/cifs/connect.c linux-libre-4.13-gnu/fs/cifs/connect.c
--- linux-libre-4.13-rc7-gnu/fs/cifs/connect.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/cifs/connect.c	2017-09-03 16:56:17.000000000 -0400
@@ -1223,6 +1223,7 @@ cifs_parse_mount_options(const char *mou
 	char *tmp_end, *value;
 	char delim;
 	bool got_ip = false;
+	bool got_version = false;
 	unsigned short port = 0;
 	struct sockaddr *dstaddr = (struct sockaddr *)&vol->dstaddr;
 
@@ -1874,24 +1875,35 @@ cifs_parse_mount_options(const char *mou
 				pr_warn("CIFS: server netbiosname longer than 15 truncated.\n");
 			break;
 		case Opt_ver:
+			/* version of mount userspace tools, not dialect */
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
 
+			/* If interface changes in mount.cifs bump to new ver */
 			if (strncasecmp(string, "1", 1) == 0) {
+				if (strlen(string) > 1) {
+					pr_warn("Bad mount helper ver=%s. Did "
+						"you want SMB1 (CIFS) dialect "
+						"and mean to type vers=1.0 "
+						"instead?\n", string);
+					goto cifs_parse_mount_err;
+				}
 				/* This is the default */
 				break;
 			}
 			/* For all other value, error */
-			pr_warn("CIFS: Invalid version specified\n");
+			pr_warn("CIFS: Invalid mount helper version specified\n");
 			goto cifs_parse_mount_err;
 		case Opt_vers:
+			/* protocol version (dialect) */
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
 
 			if (cifs_parse_smb_version(string, vol) != 0)
 				goto cifs_parse_mount_err;
+			got_version = true;
 			break;
 		case Opt_sec:
 			string = match_strdup(args);
@@ -1973,6 +1985,14 @@ cifs_parse_mount_options(const char *mou
 	else if (override_gid == 1)
 		pr_notice("CIFS: ignoring forcegid mount option specified with no gid= option.\n");
 
+	if (got_version == false)
+		pr_warn("No dialect specified on mount. Default has changed to "
+			"a more secure dialect, SMB3 (vers=3.0), from CIFS "
+			"(SMB1). To use the less secure SMB1 dialect to access "
+			"old servers which do not support SMB3 specify vers=1.0"
+			" on mount. For somewhat newer servers such as Windows "
+			"7 try vers=2.1.\n");
+
 	kfree(mountdata_copy);
 	return 0;
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/cifs/dir.c linux-libre-4.13-gnu/fs/cifs/dir.c
--- linux-libre-4.13-rc7-gnu/fs/cifs/dir.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/cifs/dir.c	2017-09-03 16:56:17.000000000 -0400
@@ -205,7 +205,7 @@ check_name(struct dentry *direntry, stru
 	int i;
 
 	if (unlikely(direntry->d_name.len >
-		     tcon->fsAttrInfo.MaxPathNameComponentLength))
+		     le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength)))
 		return -ENAMETOOLONG;
 
 	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/cifs/smb2pdu.c linux-libre-4.13-gnu/fs/cifs/smb2pdu.c
--- linux-libre-4.13-rc7-gnu/fs/cifs/smb2pdu.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/cifs/smb2pdu.c	2017-09-03 16:56:17.000000000 -0400
@@ -514,7 +514,12 @@ SMB2_negotiate(const unsigned int xid, s
 	 * No tcon so can't do
 	 * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
 	 */
-	if (rc != 0)
+	if (rc == -EOPNOTSUPP) {
+		cifs_dbg(VFS, "Dialect not supported by server. Consider "
+			"specifying vers=1.0 or vers=2.1 on mount for accessing"
+			" older servers\n");
+		goto neg_exit;
+	} else if (rc != 0)
 		goto neg_exit;
 
 	cifs_dbg(FYI, "mode 0x%x\n", rsp->SecurityMode);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/cifs/smb2pdu.h linux-libre-4.13-gnu/fs/cifs/smb2pdu.h
--- linux-libre-4.13-rc7-gnu/fs/cifs/smb2pdu.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/cifs/smb2pdu.h	2017-09-03 16:56:17.000000000 -0400
@@ -84,8 +84,8 @@
 
 #define NUMBER_OF_SMB2_COMMANDS	0x0013
 
-/* BB FIXME - analyze following length BB */
-#define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
+/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */
+#define MAX_SMB2_HDR_SIZE 0x00b0
 
 #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe)
 #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/dax.c linux-libre-4.13-gnu/fs/dax.c
--- linux-libre-4.13-rc7-gnu/fs/dax.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/dax.c	2017-09-03 16:56:17.000000000 -0400
@@ -646,11 +646,10 @@ static void dax_mapping_entry_mkclean(st
 	pte_t pte, *ptep = NULL;
 	pmd_t *pmdp = NULL;
 	spinlock_t *ptl;
-	bool changed;
 
 	i_mmap_lock_read(mapping);
 	vma_interval_tree_foreach(vma, &mapping->i_mmap, index, index) {
-		unsigned long address;
+		unsigned long address, start, end;
 
 		cond_resched();
 
@@ -658,8 +657,13 @@ static void dax_mapping_entry_mkclean(st
 			continue;
 
 		address = pgoff_address(index, vma);
-		changed = false;
-		if (follow_pte_pmd(vma->vm_mm, address, &ptep, &pmdp, &ptl))
+
+		/*
+		 * Note because we provide start/end to follow_pte_pmd it will
+		 * call mmu_notifier_invalidate_range_start() on our behalf
+		 * before taking any lock.
+		 */
+		if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
 			continue;
 
 		if (pmdp) {
@@ -676,7 +680,7 @@ static void dax_mapping_entry_mkclean(st
 			pmd = pmd_wrprotect(pmd);
 			pmd = pmd_mkclean(pmd);
 			set_pmd_at(vma->vm_mm, address, pmdp, pmd);
-			changed = true;
+			mmu_notifier_invalidate_range(vma->vm_mm, start, end);
 unlock_pmd:
 			spin_unlock(ptl);
 #endif
@@ -691,13 +695,12 @@ unlock_pmd:
 			pte = pte_wrprotect(pte);
 			pte = pte_mkclean(pte);
 			set_pte_at(vma->vm_mm, address, ptep, pte);
-			changed = true;
+			mmu_notifier_invalidate_range(vma->vm_mm, start, end);
 unlock_pte:
 			pte_unmap_unlock(ptep, ptl);
 		}
 
-		if (changed)
-			mmu_notifier_invalidate_page(vma->vm_mm, address);
+		mmu_notifier_invalidate_range_end(vma->vm_mm, start, end);
 	}
 	i_mmap_unlock_read(mapping);
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/eventpoll.c linux-libre-4.13-gnu/fs/eventpoll.c
--- linux-libre-4.13-rc7-gnu/fs/eventpoll.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/eventpoll.c	2017-09-03 16:56:17.000000000 -0400
@@ -600,8 +600,13 @@ static void ep_remove_wait_queue(struct
 	wait_queue_head_t *whead;
 
 	rcu_read_lock();
-	/* If it is cleared by POLLFREE, it should be rcu-safe */
-	whead = rcu_dereference(pwq->whead);
+	/*
+	 * If it is cleared by POLLFREE, it should be rcu-safe.
+	 * If we read NULL we need a barrier paired with
+	 * smp_store_release() in ep_poll_callback(), otherwise
+	 * we rely on whead->lock.
+	 */
+	whead = smp_load_acquire(&pwq->whead);
 	if (whead)
 		remove_wait_queue(whead, &pwq->wait);
 	rcu_read_unlock();
@@ -1134,17 +1139,6 @@ static int ep_poll_callback(wait_queue_e
 	struct eventpoll *ep = epi->ep;
 	int ewake = 0;
 
-	if ((unsigned long)key & POLLFREE) {
-		ep_pwq_from_wait(wait)->whead = NULL;
-		/*
-		 * whead = NULL above can race with ep_remove_wait_queue()
-		 * which can do another remove_wait_queue() after us, so we
-		 * can't use __remove_wait_queue(). whead->lock is held by
-		 * the caller.
-		 */
-		list_del_init(&wait->entry);
-	}
-
 	spin_lock_irqsave(&ep->lock, flags);
 
 	ep_set_busy_poll_napi_id(epi);
@@ -1228,10 +1222,26 @@ out_unlock:
 	if (pwake)
 		ep_poll_safewake(&ep->poll_wait);
 
-	if (epi->event.events & EPOLLEXCLUSIVE)
-		return ewake;
+	if (!(epi->event.events & EPOLLEXCLUSIVE))
+		ewake = 1;
 
-	return 1;
+	if ((unsigned long)key & POLLFREE) {
+		/*
+		 * If we race with ep_remove_wait_queue() it can miss
+		 * ->whead = NULL and do another remove_wait_queue() after
+		 * us, so we can't use __remove_wait_queue().
+		 */
+		list_del_init(&wait->entry);
+		/*
+		 * ->whead != NULL protects us from the race with ep_free()
+		 * or ep_remove(), ep_remove_wait_queue() takes whead->lock
+		 * held by the caller. Once we nullify it, nothing protects
+		 * ep/epi or even wait.
+		 */
+		smp_store_release(&ep_pwq_from_wait(wait)->whead, NULL);
+	}
+
+	return ewake;
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/jfs/super.c linux-libre-4.13-gnu/fs/jfs/super.c
--- linux-libre-4.13-rc7-gnu/fs/jfs/super.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/jfs/super.c	2017-09-03 16:56:17.000000000 -0400
@@ -619,16 +619,10 @@ static int jfs_fill_super(struct super_b
 	if (!sb->s_root)
 		goto out_no_root;
 
-	/* logical blocks are represented by 40 bits in pxd_t, etc. */
-	sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
-#if BITS_PER_LONG == 32
-	/*
-	 * Page cache is indexed by long.
-	 * I would use MAX_LFS_FILESIZE, but it's only half as big
+	/* logical blocks are represented by 40 bits in pxd_t, etc.
+	 * and page cache is indexed by long
 	 */
-	sb->s_maxbytes = min(((u64) PAGE_SIZE << 32) - 1,
-			     (u64)sb->s_maxbytes);
-#endif
+	sb->s_maxbytes = min(((loff_t)sb->s_blocksize) << 40, MAX_LFS_FILESIZE);
 	sb->s_time_gran = 1;
 	return 0;
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/fs/select.c linux-libre-4.13-gnu/fs/select.c
--- linux-libre-4.13-rc7-gnu/fs/select.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/fs/select.c	2017-09-03 16:56:17.000000000 -0400
@@ -1164,11 +1164,7 @@ int compat_get_fd_set(unsigned long nr,
 	if (ufdset) {
 		return compat_get_bitmap(fdset, ufdset, nr);
 	} else {
-		/* Tricky, must clear full unsigned long in the
-		 * kernel fdset at the end, ALIGN makes sure that
-		 * actually happens.
-		 */
-		memset(fdset, 0, ALIGN(nr, BITS_PER_LONG));
+		zero_fd_set(nr, fdset);
 		return 0;
 	}
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/asm-generic/topology.h linux-libre-4.13-gnu/include/asm-generic/topology.h
--- linux-libre-4.13-rc7-gnu/include/asm-generic/topology.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/asm-generic/topology.h	2017-09-03 16:56:17.000000000 -0400
@@ -48,7 +48,11 @@
 #define parent_node(node)	((void)(node),0)
 #endif
 #ifndef cpumask_of_node
-#define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #ifdef CONFIG_NEED_MULTIPLE_NODES
+    #define cpumask_of_node(node)	((node) == 0 ? cpu_online_mask : cpu_none_mask)
+  #else
+    #define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #endif
 #endif
 #ifndef pcibus_to_node
 #define pcibus_to_node(bus)	((void)(bus), -1)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/ata.h linux-libre-4.13-gnu/include/linux/ata.h
--- linux-libre-4.13-rc7-gnu/include/linux/ata.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/ata.h	2017-09-03 16:56:17.000000000 -0400
@@ -60,7 +60,8 @@ enum {
 	ATA_ID_FW_REV		= 23,
 	ATA_ID_PROD		= 27,
 	ATA_ID_MAX_MULTSECT	= 47,
-	ATA_ID_DWORD_IO		= 48,
+	ATA_ID_DWORD_IO		= 48,	/* before ATA-8 */
+	ATA_ID_TRUSTED		= 48,	/* ATA-8 and later */
 	ATA_ID_CAPABILITY	= 49,
 	ATA_ID_OLD_PIO_MODES	= 51,
 	ATA_ID_OLD_DMA_MODES	= 52,
@@ -889,6 +890,13 @@ static inline bool ata_id_has_dword_io(c
 	return id[ATA_ID_DWORD_IO] & (1 << 0);
 }
 
+static inline bool ata_id_has_trusted(const u16 *id)
+{
+	if (ata_id_major_version(id) <= 7)
+		return false;
+	return id[ATA_ID_TRUSTED] & (1 << 0);
+}
+
 static inline bool ata_id_has_unload(const u16 *id)
 {
 	if (ata_id_major_version(id) >= 7 &&
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/compiler.h linux-libre-4.13-gnu/include/linux/compiler.h
--- linux-libre-4.13-rc7-gnu/include/linux/compiler.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/compiler.h	2017-09-03 16:56:17.000000000 -0400
@@ -517,7 +517,8 @@ static __always_inline void __write_once
 # define __compiletime_error_fallback(condition) do { } while (0)
 #endif
 
-#define __compiletime_assert(condition, msg, prefix, suffix)		\
+#ifdef __OPTIMIZE__
+# define __compiletime_assert(condition, msg, prefix, suffix)		\
 	do {								\
 		bool __cond = !(condition);				\
 		extern void prefix ## suffix(void) __compiletime_error(msg); \
@@ -525,6 +526,9 @@ static __always_inline void __write_once
 			prefix ## suffix();				\
 		__compiletime_error_fallback(__cond);			\
 	} while (0)
+#else
+# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
+#endif
 
 #define _compiletime_assert(condition, msg, prefix, suffix) \
 	__compiletime_assert(condition, msg, prefix, suffix)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/device-mapper.h linux-libre-4.13-gnu/include/linux/device-mapper.h
--- linux-libre-4.13-rc7-gnu/include/linux/device-mapper.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/device-mapper.h	2017-09-03 16:56:17.000000000 -0400
@@ -549,46 +549,29 @@ void *dm_vcalloc(unsigned long nmemb, un
  *---------------------------------------------------------------*/
 #define DM_NAME "device-mapper"
 
-#ifdef CONFIG_PRINTK
-extern struct ratelimit_state dm_ratelimit_state;
-
-#define dm_ratelimit()	__ratelimit(&dm_ratelimit_state)
-#else
-#define dm_ratelimit()	0
-#endif
+#define DM_RATELIMIT(pr_func, fmt, ...)					\
+do {									\
+	static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+									\
+	if (__ratelimit(&rs))						\
+		pr_func(DM_FMT(fmt), ##__VA_ARGS__);			\
+} while (0)
 
 #define DM_FMT(fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n"
 
 #define DMCRIT(fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__)
 
 #define DMERR(fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__)
-#define DMERR_LIMIT(fmt, ...)						\
-do {									\
-	if (dm_ratelimit())						\
-		DMERR(fmt, ##__VA_ARGS__);				\
-} while (0)
-
+#define DMERR_LIMIT(fmt, ...) DM_RATELIMIT(pr_err, fmt, ##__VA_ARGS__)
 #define DMWARN(fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__)
-#define DMWARN_LIMIT(fmt, ...)						\
-do {									\
-	if (dm_ratelimit())						\
-		DMWARN(fmt, ##__VA_ARGS__);				\
-} while (0)
-
+#define DMWARN_LIMIT(fmt, ...) DM_RATELIMIT(pr_warn, fmt, ##__VA_ARGS__)
 #define DMINFO(fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__)
-#define DMINFO_LIMIT(fmt, ...)						\
-do {									\
-	if (dm_ratelimit())						\
-		DMINFO(fmt, ##__VA_ARGS__);				\
-} while (0)
+#define DMINFO_LIMIT(fmt, ...) DM_RATELIMIT(pr_info, fmt, ##__VA_ARGS__)
 
 #ifdef CONFIG_DM_DEBUG
 #define DMDEBUG(fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__)
-#define DMDEBUG_LIMIT(fmt, ...)						\
-do {									\
-	if (dm_ratelimit())						\
-		DMDEBUG(fmt, ##__VA_ARGS__);				\
-} while (0)
+#define DMDEBUG_LIMIT(fmt, ...) DM_RATELIMIT(pr_debug, fmt, ##__VA_ARGS__)
 #else
 #define DMDEBUG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
 #define DMDEBUG_LIMIT(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/mlx5/driver.h linux-libre-4.13-gnu/include/linux/mlx5/driver.h
--- linux-libre-4.13-rc7-gnu/include/linux/mlx5/driver.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/mlx5/driver.h	2017-09-03 16:56:17.000000000 -0400
@@ -673,9 +673,7 @@ enum mlx5_device_state {
 };
 
 enum mlx5_interface_state {
-	MLX5_INTERFACE_STATE_DOWN = BIT(0),
-	MLX5_INTERFACE_STATE_UP = BIT(1),
-	MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2),
+	MLX5_INTERFACE_STATE_UP = BIT(0),
 };
 
 enum mlx5_pci_status {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/mm.h linux-libre-4.13-gnu/include/linux/mm.h
--- linux-libre-4.13-rc7-gnu/include/linux/mm.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/mm.h	2017-09-03 16:56:17.000000000 -0400
@@ -1260,6 +1260,7 @@ int copy_page_range(struct mm_struct *ds
 void unmap_mapping_range(struct address_space *mapping,
 		loff_t const holebegin, loff_t const holelen, int even_cows);
 int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
+			     unsigned long *start, unsigned long *end,
 			     pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp);
 int follow_pfn(struct vm_area_struct *vma, unsigned long address,
 	unsigned long *pfn);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/mmu_notifier.h linux-libre-4.13-gnu/include/linux/mmu_notifier.h
--- linux-libre-4.13-rc7-gnu/include/linux/mmu_notifier.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/mmu_notifier.h	2017-09-03 16:56:17.000000000 -0400
@@ -95,17 +95,6 @@ struct mmu_notifier_ops {
 			   pte_t pte);
 
 	/*
-	 * Before this is invoked any secondary MMU is still ok to
-	 * read/write to the page previously pointed to by the Linux
-	 * pte because the page hasn't been freed yet and it won't be
-	 * freed until this returns. If required set_page_dirty has to
-	 * be called internally to this method.
-	 */
-	void (*invalidate_page)(struct mmu_notifier *mn,
-				struct mm_struct *mm,
-				unsigned long address);
-
-	/*
 	 * invalidate_range_start() and invalidate_range_end() must be
 	 * paired and are called only when the mmap_sem and/or the
 	 * locks protecting the reverse maps are held. If the subsystem
@@ -220,8 +209,6 @@ extern int __mmu_notifier_test_young(str
 				     unsigned long address);
 extern void __mmu_notifier_change_pte(struct mm_struct *mm,
 				      unsigned long address, pte_t pte);
-extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
-					  unsigned long address);
 extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
 				  unsigned long start, unsigned long end);
 extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
@@ -268,13 +255,6 @@ static inline void mmu_notifier_change_p
 		__mmu_notifier_change_pte(mm, address, pte);
 }
 
-static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
-					  unsigned long address)
-{
-	if (mm_has_notifiers(mm))
-		__mmu_notifier_invalidate_page(mm, address);
-}
-
 static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
 				  unsigned long start, unsigned long end)
 {
@@ -442,11 +422,6 @@ static inline void mmu_notifier_change_p
 {
 }
 
-static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
-					  unsigned long address)
-{
-}
-
 static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
 				  unsigned long start, unsigned long end)
 {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/netdevice.h linux-libre-4.13-gnu/include/linux/netdevice.h
--- linux-libre-4.13-rc7-gnu/include/linux/netdevice.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/netdevice.h	2017-09-03 16:56:17.000000000 -0400
@@ -3866,6 +3866,8 @@ int netdev_walk_all_upper_dev_rcu(struct
 bool netdev_has_upper_dev_all_rcu(struct net_device *dev,
 				  struct net_device *upper_dev);
 
+bool netdev_has_any_upper_dev(struct net_device *dev);
+
 void *netdev_lower_get_next_private(struct net_device *dev,
 				    struct list_head **iter);
 void *netdev_lower_get_next_private_rcu(struct net_device *dev,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/nvme.h linux-libre-4.13-gnu/include/linux/nvme.h
--- linux-libre-4.13-rc7-gnu/include/linux/nvme.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/nvme.h	2017-09-03 16:56:17.000000000 -0400
@@ -254,7 +254,7 @@ enum {
 	NVME_CTRL_VWC_PRESENT			= 1 << 0,
 	NVME_CTRL_OACS_SEC_SUPP                 = 1 << 0,
 	NVME_CTRL_OACS_DIRECTIVES		= 1 << 5,
-	NVME_CTRL_OACS_DBBUF_SUPP		= 1 << 7,
+	NVME_CTRL_OACS_DBBUF_SUPP		= 1 << 8,
 };
 
 struct nvme_lbaf {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/perf_event.h linux-libre-4.13-gnu/include/linux/perf_event.h
--- linux-libre-4.13-rc7-gnu/include/linux/perf_event.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/perf_event.h	2017-09-03 16:56:17.000000000 -0400
@@ -1201,7 +1201,7 @@ extern void perf_event_init(void);
 extern void perf_tp_event(u16 event_type, u64 count, void *record,
 			  int entry_size, struct pt_regs *regs,
 			  struct hlist_head *head, int rctx,
-			  struct task_struct *task);
+			  struct task_struct *task, struct perf_event *event);
 extern void perf_bp_event(struct perf_event *event, void *data);
 
 #ifndef perf_misc_flags
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/skbuff.h linux-libre-4.13-gnu/include/linux/skbuff.h
--- linux-libre-4.13-rc7-gnu/include/linux/skbuff.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/skbuff.h	2017-09-03 16:56:17.000000000 -0400
@@ -973,7 +973,23 @@ int __must_check skb_to_sgvec_nomark(str
 int __must_check skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg,
 			      int offset, int len);
 int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
-int skb_pad(struct sk_buff *skb, int pad);
+int __skb_pad(struct sk_buff *skb, int pad, bool free_on_error);
+
+/**
+ *	skb_pad			-	zero pad the tail of an skb
+ *	@skb: buffer to pad
+ *	@pad: space to pad
+ *
+ *	Ensure that a buffer is followed by a padding area that is zero
+ *	filled. Used by network drivers which may DMA or transfer data
+ *	beyond the buffer end onto the wire.
+ *
+ *	May return error in out of memory cases. The skb is freed on error.
+ */
+static inline int skb_pad(struct sk_buff *skb, int pad)
+{
+	return __skb_pad(skb, pad, true);
+}
 #define dev_kfree_skb(a)	consume_skb(a)
 
 int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
@@ -2825,25 +2841,42 @@ static inline int skb_padto(struct sk_bu
  *	skb_put_padto - increase size and pad an skbuff up to a minimal size
  *	@skb: buffer to pad
  *	@len: minimal length
+ *	@free_on_error: free buffer on error
  *
  *	Pads up a buffer to ensure the trailing bytes exist and are
  *	blanked. If the buffer already contains sufficient data it
  *	is untouched. Otherwise it is extended. Returns zero on
- *	success. The skb is freed on error.
+ *	success. The skb is freed on error if @free_on_error is true.
  */
-static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
+static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
+				  bool free_on_error)
 {
 	unsigned int size = skb->len;
 
 	if (unlikely(size < len)) {
 		len -= size;
-		if (skb_pad(skb, len))
+		if (__skb_pad(skb, len, free_on_error))
 			return -ENOMEM;
 		__skb_put(skb, len);
 	}
 	return 0;
 }
 
+/**
+ *	skb_put_padto - increase size and pad an skbuff up to a minimal size
+ *	@skb: buffer to pad
+ *	@len: minimal length
+ *
+ *	Pads up a buffer to ensure the trailing bytes exist and are
+ *	blanked. If the buffer already contains sufficient data it
+ *	is untouched. Otherwise it is extended. Returns zero on
+ *	success. The skb is freed on error.
+ */
+static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
+{
+	return __skb_put_padto(skb, len, true);
+}
+
 static inline int skb_add_data(struct sk_buff *skb,
 			       struct iov_iter *from, int copy)
 {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/linux/trace_events.h linux-libre-4.13-gnu/include/linux/trace_events.h
--- linux-libre-4.13-rc7-gnu/include/linux/trace_events.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/linux/trace_events.h	2017-09-03 16:56:17.000000000 -0400
@@ -508,9 +508,9 @@ void perf_trace_run_bpf_submit(void *raw
 static inline void
 perf_trace_buf_submit(void *raw_data, int size, int rctx, u16 type,
 		       u64 count, struct pt_regs *regs, void *head,
-		       struct task_struct *task)
+		       struct task_struct *task, struct perf_event *event)
 {
-	perf_tp_event(type, count, raw_data, size, regs, head, rctx, task);
+	perf_tp_event(type, count, raw_data, size, regs, head, rctx, task, event);
 }
 #endif
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/net/ip6_fib.h linux-libre-4.13-gnu/include/net/ip6_fib.h
--- linux-libre-4.13-rc7-gnu/include/net/ip6_fib.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/net/ip6_fib.h	2017-09-03 16:56:17.000000000 -0400
@@ -70,6 +70,7 @@ struct fib6_node {
 	__u16			fn_flags;
 	int			fn_sernum;
 	struct rt6_info		*rr_ptr;
+	struct rcu_head		rcu;
 };
 
 #ifndef CONFIG_IPV6_SUBTREES
@@ -104,7 +105,7 @@ struct rt6_info {
 	 * the same cache line.
 	 */
 	struct fib6_table		*rt6i_table;
-	struct fib6_node		*rt6i_node;
+	struct fib6_node __rcu		*rt6i_node;
 
 	struct in6_addr			rt6i_gateway;
 
@@ -167,13 +168,40 @@ static inline void rt6_update_expires(st
 	rt0->rt6i_flags |= RTF_EXPIRES;
 }
 
+/* Function to safely get fn->sernum for passed in rt
+ * and store result in passed in cookie.
+ * Return true if we can get cookie safely
+ * Return false if not
+ */
+static inline bool rt6_get_cookie_safe(const struct rt6_info *rt,
+				       u32 *cookie)
+{
+	struct fib6_node *fn;
+	bool status = false;
+
+	rcu_read_lock();
+	fn = rcu_dereference(rt->rt6i_node);
+
+	if (fn) {
+		*cookie = fn->fn_sernum;
+		status = true;
+	}
+
+	rcu_read_unlock();
+	return status;
+}
+
 static inline u32 rt6_get_cookie(const struct rt6_info *rt)
 {
+	u32 cookie = 0;
+
 	if (rt->rt6i_flags & RTF_PCPU ||
 	    (unlikely(!list_empty(&rt->rt6i_uncached)) && rt->dst.from))
 		rt = (struct rt6_info *)(rt->dst.from);
 
-	return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
+	rt6_get_cookie_safe(rt, &cookie);
+
+	return cookie;
 }
 
 static inline void ip6_rt_put(struct rt6_info *rt)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/net/sch_generic.h linux-libre-4.13-gnu/include/net/sch_generic.h
--- linux-libre-4.13-rc7-gnu/include/net/sch_generic.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/net/sch_generic.h	2017-09-03 16:56:17.000000000 -0400
@@ -101,6 +101,13 @@ struct Qdisc {
 	spinlock_t		busylock ____cacheline_aligned_in_smp;
 };
 
+static inline void qdisc_refcount_inc(struct Qdisc *qdisc)
+{
+	if (qdisc->flags & TCQ_F_BUILTIN)
+		return;
+	refcount_inc(&qdisc->refcnt);
+}
+
 static inline bool qdisc_is_running(const struct Qdisc *qdisc)
 {
 	return (raw_read_seqcount(&qdisc->running) & 1) ? true : false;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/net/tcp.h linux-libre-4.13-gnu/include/net/tcp.h
--- linux-libre-4.13-rc7-gnu/include/net/tcp.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/net/tcp.h	2017-09-03 16:56:17.000000000 -0400
@@ -1004,9 +1004,7 @@ void tcp_get_default_congestion_control(
 void tcp_get_available_congestion_control(char *buf, size_t len);
 void tcp_get_allowed_congestion_control(char *buf, size_t len);
 int tcp_set_allowed_congestion_control(char *allowed);
-int tcp_set_congestion_control(struct sock *sk, const char *name, bool load);
-void tcp_reinit_congestion_control(struct sock *sk,
-				   const struct tcp_congestion_ops *ca);
+int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, bool reinit);
 u32 tcp_slow_start(struct tcp_sock *tp, u32 acked);
 void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/net/udp.h linux-libre-4.13-gnu/include/net/udp.h
--- linux-libre-4.13-rc7-gnu/include/net/udp.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/net/udp.h	2017-09-03 16:56:17.000000000 -0400
@@ -260,7 +260,7 @@ static inline struct sk_buff *skb_recv_u
 }
 
 void udp_v4_early_demux(struct sk_buff *skb);
-void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst);
+bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst);
 int udp_get_port(struct sock *sk, unsigned short snum,
 		 int (*saddr_cmp)(const struct sock *,
 				  const struct sock *));
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/include/uapi/linux/ndctl.h linux-libre-4.13-gnu/include/uapi/linux/ndctl.h
--- linux-libre-4.13-rc7-gnu/include/uapi/linux/ndctl.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/include/uapi/linux/ndctl.h	2017-09-03 16:56:17.000000000 -0400
@@ -145,43 +145,6 @@ struct nd_cmd_clear_error {
 	__u64 cleared;
 } __packed;
 
-struct nd_cmd_trans_spa {
-	__u64 spa;
-	__u32 status;
-	__u8  flags;
-	__u8  _reserved[3];
-	__u64 trans_length;
-	__u32 num_nvdimms;
-	struct nd_nvdimm_device {
-		__u32 nfit_device_handle;
-		__u32 _reserved;
-		__u64 dpa;
-	} __packed devices[0];
-
-} __packed;
-
-struct nd_cmd_ars_err_inj {
-	__u64 err_inj_spa_range_base;
-	__u64 err_inj_spa_range_length;
-	__u8  err_inj_options;
-	__u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_clr {
-	__u64 err_inj_clr_spa_range_base;
-	__u64 err_inj_clr_spa_range_length;
-	__u32 status;
-} __packed;
-
-struct nd_cmd_ars_err_inj_stat {
-	__u32 status;
-	__u32 inj_err_rec_count;
-	struct nd_error_stat_query_record {
-		__u64 err_inj_stat_spa_range_base;
-		__u64 err_inj_stat_spa_range_length;
-	} __packed record[0];
-} __packed;
-
 enum {
 	ND_CMD_IMPLEMENTED = 0,
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/bpf/hashtab.c linux-libre-4.13-gnu/kernel/bpf/hashtab.c
--- linux-libre-4.13-rc7-gnu/kernel/bpf/hashtab.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/bpf/hashtab.c	2017-09-03 16:56:17.000000000 -0400
@@ -652,12 +652,27 @@ static void pcpu_copy_value(struct bpf_h
 	}
 }
 
+static bool fd_htab_map_needs_adjust(const struct bpf_htab *htab)
+{
+	return htab->map.map_type == BPF_MAP_TYPE_HASH_OF_MAPS &&
+	       BITS_PER_LONG == 64;
+}
+
+static u32 htab_size_value(const struct bpf_htab *htab, bool percpu)
+{
+	u32 size = htab->map.value_size;
+
+	if (percpu || fd_htab_map_needs_adjust(htab))
+		size = round_up(size, 8);
+	return size;
+}
+
 static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key,
 					 void *value, u32 key_size, u32 hash,
 					 bool percpu, bool onallcpus,
 					 struct htab_elem *old_elem)
 {
-	u32 size = htab->map.value_size;
+	u32 size = htab_size_value(htab, percpu);
 	bool prealloc = htab_is_prealloc(htab);
 	struct htab_elem *l_new, **pl_new;
 	void __percpu *pptr;
@@ -696,9 +711,6 @@ static struct htab_elem *alloc_htab_elem
 
 	memcpy(l_new->key, key, key_size);
 	if (percpu) {
-		/* round up value_size to 8 bytes */
-		size = round_up(size, 8);
-
 		if (prealloc) {
 			pptr = htab_elem_get_ptr(l_new, key_size);
 		} else {
@@ -1209,17 +1221,9 @@ const struct bpf_map_ops htab_lru_percpu
 
 static struct bpf_map *fd_htab_map_alloc(union bpf_attr *attr)
 {
-	struct bpf_map *map;
-
 	if (attr->value_size != sizeof(u32))
 		return ERR_PTR(-EINVAL);
-
-	/* pointer is stored internally */
-	attr->value_size = sizeof(void *);
-	map = htab_map_alloc(attr);
-	attr->value_size = sizeof(u32);
-
-	return map;
+	return htab_map_alloc(attr);
 }
 
 static void fd_htab_map_free(struct bpf_map *map)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/cgroup/cpuset.c linux-libre-4.13-gnu/kernel/cgroup/cpuset.c
--- linux-libre-4.13-rc7-gnu/kernel/cgroup/cpuset.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/cgroup/cpuset.c	2017-09-03 16:56:17.000000000 -0400
@@ -1892,6 +1892,7 @@ static struct cftype files[] = {
 	{
 		.name = "memory_pressure",
 		.read_u64 = cpuset_read_u64,
+		.private = FILE_MEMORY_PRESSURE,
 	},
 
 	{
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/events/core.c linux-libre-4.13-gnu/kernel/events/core.c
--- linux-libre-4.13-rc7-gnu/kernel/events/core.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/events/core.c	2017-09-03 16:56:17.000000000 -0400
@@ -7906,16 +7906,15 @@ void perf_trace_run_bpf_submit(void *raw
 		}
 	}
 	perf_tp_event(call->event.type, count, raw_data, size, regs, head,
-		      rctx, task);
+		      rctx, task, NULL);
 }
 EXPORT_SYMBOL_GPL(perf_trace_run_bpf_submit);
 
 void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size,
 		   struct pt_regs *regs, struct hlist_head *head, int rctx,
-		   struct task_struct *task)
+		   struct task_struct *task, struct perf_event *event)
 {
 	struct perf_sample_data data;
-	struct perf_event *event;
 
 	struct perf_raw_record raw = {
 		.frag = {
@@ -7929,9 +7928,15 @@ void perf_tp_event(u16 event_type, u64 c
 
 	perf_trace_buf_update(record, event_type);
 
-	hlist_for_each_entry_rcu(event, head, hlist_entry) {
+	/* Use the given event instead of the hlist */
+	if (event) {
 		if (perf_tp_event_match(event, &data, regs))
 			perf_swevent_event(event, count, &data, regs);
+	} else {
+		hlist_for_each_entry_rcu(event, head, hlist_entry) {
+			if (perf_tp_event_match(event, &data, regs))
+				perf_swevent_event(event, count, &data, regs);
+		}
 	}
 
 	/*
@@ -9611,6 +9616,8 @@ static int perf_copy_attr(struct perf_ev
 	if (ret)
 		return -EFAULT;
 
+	attr->size = size;
+
 	if (attr->__reserved_1)
 		return -EINVAL;
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/events/uprobes.c linux-libre-4.13-gnu/kernel/events/uprobes.c
--- linux-libre-4.13-rc7-gnu/kernel/events/uprobes.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/events/uprobes.c	2017-09-03 16:56:17.000000000 -0400
@@ -1262,8 +1262,6 @@ void uprobe_end_dup_mmap(void)
 
 void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
 {
-	newmm->uprobes_state.xol_area = NULL;
-
 	if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) {
 		set_bit(MMF_HAS_UPROBES, &newmm->flags);
 		/* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/fork.c linux-libre-4.13-gnu/kernel/fork.c
--- linux-libre-4.13-rc7-gnu/kernel/fork.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/fork.c	2017-09-03 16:56:17.000000000 -0400
@@ -785,6 +785,13 @@ static void mm_init_owner(struct mm_stru
 #endif
 }
 
+static void mm_init_uprobes_state(struct mm_struct *mm)
+{
+#ifdef CONFIG_UPROBES
+	mm->uprobes_state.xol_area = NULL;
+#endif
+}
+
 static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
 	struct user_namespace *user_ns)
 {
@@ -812,6 +819,7 @@ static struct mm_struct *mm_init(struct
 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
 	mm->pmd_huge_pte = NULL;
 #endif
+	mm_init_uprobes_state(mm);
 
 	if (current->mm) {
 		mm->flags = current->mm->flags & MMF_INIT_MASK;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/kthread.c linux-libre-4.13-gnu/kernel/kthread.c
--- linux-libre-4.13-rc7-gnu/kernel/kthread.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/kthread.c	2017-09-03 16:56:17.000000000 -0400
@@ -637,6 +637,7 @@ repeat:
 		schedule();
 
 	try_to_freeze();
+	cond_resched();
 	goto repeat;
 }
 EXPORT_SYMBOL_GPL(kthread_worker_fn);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/time/timekeeping.c linux-libre-4.13-gnu/kernel/time/timekeeping.c
--- linux-libre-4.13-rc7-gnu/kernel/time/timekeeping.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/time/timekeeping.c	2017-09-03 16:56:17.000000000 -0400
@@ -637,9 +637,7 @@ static inline void tk_update_ktime_data(
 	tk->ktime_sec = seconds;
 
 	/* Update the monotonic raw base */
-	seconds = tk->raw_sec;
-	nsec = (u32)(tk->tkr_raw.xtime_nsec >> tk->tkr_raw.shift);
-	tk->tkr_raw.base = ns_to_ktime(seconds * NSEC_PER_SEC + nsec);
+	tk->tkr_raw.base = ns_to_ktime(tk->raw_sec * NSEC_PER_SEC);
 }
 
 /* must hold timekeeper_lock */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/trace/trace_event_perf.c linux-libre-4.13-gnu/kernel/trace/trace_event_perf.c
--- linux-libre-4.13-rc7-gnu/kernel/trace/trace_event_perf.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/trace/trace_event_perf.c	2017-09-03 16:56:17.000000000 -0400
@@ -306,6 +306,7 @@ static void
 perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,
 			  struct ftrace_ops *ops, struct pt_regs *pt_regs)
 {
+	struct perf_event *event;
 	struct ftrace_entry *entry;
 	struct hlist_head *head;
 	struct pt_regs regs;
@@ -329,8 +330,9 @@ perf_ftrace_function_call(unsigned long
 
 	entry->ip = ip;
 	entry->parent_ip = parent_ip;
+	event = container_of(ops, struct perf_event, ftrace_ops);
 	perf_trace_buf_submit(entry, ENTRY_SIZE, rctx, TRACE_FN,
-			      1, &regs, head, NULL);
+			      1, &regs, head, NULL, event);
 
 #undef ENTRY_SIZE
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/trace/trace_kprobe.c linux-libre-4.13-gnu/kernel/trace/trace_kprobe.c
--- linux-libre-4.13-rc7-gnu/kernel/trace/trace_kprobe.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/trace/trace_kprobe.c	2017-09-03 16:56:17.000000000 -0400
@@ -1200,7 +1200,7 @@ kprobe_perf_func(struct trace_kprobe *tk
 	memset(&entry[1], 0, dsize);
 	store_trace_args(sizeof(*entry), &tk->tp, regs, (u8 *)&entry[1], dsize);
 	perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
-			      head, NULL);
+			      head, NULL, NULL);
 }
 NOKPROBE_SYMBOL(kprobe_perf_func);
 
@@ -1236,7 +1236,7 @@ kretprobe_perf_func(struct trace_kprobe
 	entry->ret_ip = (unsigned long)ri->ret_addr;
 	store_trace_args(sizeof(*entry), &tk->tp, regs, (u8 *)&entry[1], dsize);
 	perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
-			      head, NULL);
+			      head, NULL, NULL);
 }
 NOKPROBE_SYMBOL(kretprobe_perf_func);
 #endif	/* CONFIG_PERF_EVENTS */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/trace/trace_syscalls.c linux-libre-4.13-gnu/kernel/trace/trace_syscalls.c
--- linux-libre-4.13-rc7-gnu/kernel/trace/trace_syscalls.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/trace/trace_syscalls.c	2017-09-03 16:56:17.000000000 -0400
@@ -596,7 +596,7 @@ static void perf_syscall_enter(void *ign
 			       (unsigned long *)&rec->args);
 	perf_trace_buf_submit(rec, size, rctx,
 			      sys_data->enter_event->event.type, 1, regs,
-			      head, NULL);
+			      head, NULL, NULL);
 }
 
 static int perf_sysenter_enable(struct trace_event_call *call)
@@ -667,7 +667,7 @@ static void perf_syscall_exit(void *igno
 	rec->nr = syscall_nr;
 	rec->ret = syscall_get_return_value(current, regs);
 	perf_trace_buf_submit(rec, size, rctx, sys_data->exit_event->event.type,
-			      1, regs, head, NULL);
+			      1, regs, head, NULL, NULL);
 }
 
 static int perf_sysexit_enable(struct trace_event_call *call)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/kernel/trace/trace_uprobe.c linux-libre-4.13-gnu/kernel/trace/trace_uprobe.c
--- linux-libre-4.13-rc7-gnu/kernel/trace/trace_uprobe.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/kernel/trace/trace_uprobe.c	2017-09-03 16:56:17.000000000 -0400
@@ -1156,7 +1156,7 @@ static void __uprobe_perf_func(struct tr
 	}
 
 	perf_trace_buf_submit(entry, size, rctx, call->event.type, 1, regs,
-			      head, NULL);
+			      head, NULL, NULL);
  out:
 	preempt_enable();
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/lib/mpi/mpicoder.c linux-libre-4.13-gnu/lib/mpi/mpicoder.c
--- linux-libre-4.13-rc7-gnu/lib/mpi/mpicoder.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/lib/mpi/mpicoder.c	2017-09-03 16:56:17.000000000 -0400
@@ -364,11 +364,11 @@ MPI mpi_read_raw_from_sgl(struct scatter
 	}
 
 	miter.consumed = lzeros;
-	sg_miter_stop(&miter);
 
 	nbytes -= lzeros;
 	nbits = nbytes * 8;
 	if (nbits > MAX_EXTERN_MPI_BITS) {
+		sg_miter_stop(&miter);
 		pr_info("MPI: mpi too large (%u bits)\n", nbits);
 		return NULL;
 	}
@@ -376,6 +376,8 @@ MPI mpi_read_raw_from_sgl(struct scatter
 	if (nbytes > 0)
 		nbits -= count_leading_zeros(*buff) - (BITS_PER_LONG - 8);
 
+	sg_miter_stop(&miter);
+
 	nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
 	val = mpi_alloc(nlimbs);
 	if (!val)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/Makefile linux-libre-4.13-gnu/Makefile
--- linux-libre-4.13-rc7-gnu/Makefile	2017-08-27 21:40:17.000000000 -0400
+++ linux-libre-4.13-gnu/Makefile	2017-09-03 17:24:25.000000000 -0400
@@ -1,7 +1,7 @@
 VERSION = 4
 PATCHLEVEL = 13
 SUBLEVEL = 0
-EXTRAVERSION = -rc7-gnu
+EXTRAVERSION = -gnu
 NAME = Fearless Coyote
 
 # *DOCUMENTATION*
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/mm/filemap.c linux-libre-4.13-gnu/mm/filemap.c
--- linux-libre-4.13-rc7-gnu/mm/filemap.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/mm/filemap.c	2017-09-03 16:56:17.000000000 -0400
@@ -1041,7 +1041,7 @@ void add_page_wait_queue(struct page *pa
 	unsigned long flags;
 
 	spin_lock_irqsave(&q->lock, flags);
-	__add_wait_queue(q, waiter);
+	__add_wait_queue_entry_tail(q, waiter);
 	SetPageWaiters(page);
 	spin_unlock_irqrestore(&q->lock, flags);
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/mm/madvise.c linux-libre-4.13-gnu/mm/madvise.c
--- linux-libre-4.13-rc7-gnu/mm/madvise.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/mm/madvise.c	2017-09-03 16:56:17.000000000 -0400
@@ -613,6 +613,7 @@ static int madvise_inject_error(int beha
 		unsigned long start, unsigned long end)
 {
 	struct page *page;
+	struct zone *zone;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -646,6 +647,11 @@ static int madvise_inject_error(int beha
 		if (ret)
 			return ret;
 	}
+
+	/* Ensure that all poisoned pages are removed from per-cpu lists */
+	for_each_populated_zone(zone)
+		drain_all_pages(zone);
+
 	return 0;
 }
 #endif
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/mm/memory.c linux-libre-4.13-gnu/mm/memory.c
--- linux-libre-4.13-rc7-gnu/mm/memory.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/mm/memory.c	2017-09-03 16:56:17.000000000 -0400
@@ -4008,7 +4008,8 @@ int __pmd_alloc(struct mm_struct *mm, pu
 #endif /* __PAGETABLE_PMD_FOLDED */
 
 static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,
-		pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
+			    unsigned long *start, unsigned long *end,
+			    pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
 {
 	pgd_t *pgd;
 	p4d_t *p4d;
@@ -4035,17 +4036,29 @@ static int __follow_pte_pmd(struct mm_st
 		if (!pmdpp)
 			goto out;
 
+		if (start && end) {
+			*start = address & PMD_MASK;
+			*end = *start + PMD_SIZE;
+			mmu_notifier_invalidate_range_start(mm, *start, *end);
+		}
 		*ptlp = pmd_lock(mm, pmd);
 		if (pmd_huge(*pmd)) {
 			*pmdpp = pmd;
 			return 0;
 		}
 		spin_unlock(*ptlp);
+		if (start && end)
+			mmu_notifier_invalidate_range_end(mm, *start, *end);
 	}
 
 	if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
 		goto out;
 
+	if (start && end) {
+		*start = address & PAGE_MASK;
+		*end = *start + PAGE_SIZE;
+		mmu_notifier_invalidate_range_start(mm, *start, *end);
+	}
 	ptep = pte_offset_map_lock(mm, pmd, address, ptlp);
 	if (!pte_present(*ptep))
 		goto unlock;
@@ -4053,6 +4066,8 @@ static int __follow_pte_pmd(struct mm_st
 	return 0;
 unlock:
 	pte_unmap_unlock(ptep, *ptlp);
+	if (start && end)
+		mmu_notifier_invalidate_range_end(mm, *start, *end);
 out:
 	return -EINVAL;
 }
@@ -4064,20 +4079,21 @@ static inline int follow_pte(struct mm_s
 
 	/* (void) is needed to make gcc happy */
 	(void) __cond_lock(*ptlp,
-			   !(res = __follow_pte_pmd(mm, address, ptepp, NULL,
-					   ptlp)));
+			   !(res = __follow_pte_pmd(mm, address, NULL, NULL,
+						    ptepp, NULL, ptlp)));
 	return res;
 }
 
 int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
+			     unsigned long *start, unsigned long *end,
 			     pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp)
 {
 	int res;
 
 	/* (void) is needed to make gcc happy */
 	(void) __cond_lock(*ptlp,
-			   !(res = __follow_pte_pmd(mm, address, ptepp, pmdpp,
-					   ptlp)));
+			   !(res = __follow_pte_pmd(mm, address, start, end,
+						    ptepp, pmdpp, ptlp)));
 	return res;
 }
 EXPORT_SYMBOL(follow_pte_pmd);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/mm/mmu_notifier.c linux-libre-4.13-gnu/mm/mmu_notifier.c
--- linux-libre-4.13-rc7-gnu/mm/mmu_notifier.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/mm/mmu_notifier.c	2017-09-03 16:56:17.000000000 -0400
@@ -174,20 +174,6 @@ void __mmu_notifier_change_pte(struct mm
 	srcu_read_unlock(&srcu, id);
 }
 
-void __mmu_notifier_invalidate_page(struct mm_struct *mm,
-					  unsigned long address)
-{
-	struct mmu_notifier *mn;
-	int id;
-
-	id = srcu_read_lock(&srcu);
-	hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list, hlist) {
-		if (mn->ops->invalidate_page)
-			mn->ops->invalidate_page(mn, mm, address);
-	}
-	srcu_read_unlock(&srcu, id);
-}
-
 void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
 				  unsigned long start, unsigned long end)
 {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/mm/page_alloc.c linux-libre-4.13-gnu/mm/page_alloc.c
--- linux-libre-4.13-rc7-gnu/mm/page_alloc.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/mm/page_alloc.c	2017-09-03 16:56:17.000000000 -0400
@@ -3291,10 +3291,13 @@ __alloc_pages_may_oom(gfp_t gfp_mask, un
 	/*
 	 * Go through the zonelist yet one more time, keep very high watermark
 	 * here, this is only to catch a parallel oom killing, we must fail if
-	 * we're still under heavy pressure.
+	 * we're still under heavy pressure. But make sure that this reclaim
+	 * attempt shall not depend on __GFP_DIRECT_RECLAIM && !__GFP_NORETRY
+	 * allocation which will never fail due to oom_lock already held.
 	 */
-	page = get_page_from_freelist(gfp_mask | __GFP_HARDWALL, order,
-					ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
+	page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) &
+				      ~__GFP_DIRECT_RECLAIM, order,
+				      ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
 	if (page)
 		goto out;
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/mm/rmap.c linux-libre-4.13-gnu/mm/rmap.c
--- linux-libre-4.13-rc7-gnu/mm/rmap.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/mm/rmap.c	2017-09-03 16:56:17.000000000 -0400
@@ -887,11 +887,21 @@ static bool page_mkclean_one(struct page
 		.address = address,
 		.flags = PVMW_SYNC,
 	};
+	unsigned long start = address, end;
 	int *cleaned = arg;
-	bool invalidation_needed = false;
+
+	/*
+	 * We have to assume the worse case ie pmd for invalidation. Note that
+	 * the page can not be free from this function.
+	 */
+	end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page)));
+	mmu_notifier_invalidate_range_start(vma->vm_mm, start, end);
 
 	while (page_vma_mapped_walk(&pvmw)) {
+		unsigned long cstart, cend;
 		int ret = 0;
+
+		cstart = address = pvmw.address;
 		if (pvmw.pte) {
 			pte_t entry;
 			pte_t *pte = pvmw.pte;
@@ -899,11 +909,12 @@ static bool page_mkclean_one(struct page
 			if (!pte_dirty(*pte) && !pte_write(*pte))
 				continue;
 
-			flush_cache_page(vma, pvmw.address, pte_pfn(*pte));
-			entry = ptep_clear_flush(vma, pvmw.address, pte);
+			flush_cache_page(vma, address, pte_pfn(*pte));
+			entry = ptep_clear_flush(vma, address, pte);
 			entry = pte_wrprotect(entry);
 			entry = pte_mkclean(entry);
-			set_pte_at(vma->vm_mm, pvmw.address, pte, entry);
+			set_pte_at(vma->vm_mm, address, pte, entry);
+			cend = cstart + PAGE_SIZE;
 			ret = 1;
 		} else {
 #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE
@@ -913,11 +924,13 @@ static bool page_mkclean_one(struct page
 			if (!pmd_dirty(*pmd) && !pmd_write(*pmd))
 				continue;
 
-			flush_cache_page(vma, pvmw.address, page_to_pfn(page));
-			entry = pmdp_huge_clear_flush(vma, pvmw.address, pmd);
+			flush_cache_page(vma, address, page_to_pfn(page));
+			entry = pmdp_huge_clear_flush(vma, address, pmd);
 			entry = pmd_wrprotect(entry);
 			entry = pmd_mkclean(entry);
-			set_pmd_at(vma->vm_mm, pvmw.address, pmd, entry);
+			set_pmd_at(vma->vm_mm, address, pmd, entry);
+			cstart &= PMD_MASK;
+			cend = cstart + PMD_SIZE;
 			ret = 1;
 #else
 			/* unexpected pmd-mapped page? */
@@ -926,15 +939,12 @@ static bool page_mkclean_one(struct page
 		}
 
 		if (ret) {
+			mmu_notifier_invalidate_range(vma->vm_mm, cstart, cend);
 			(*cleaned)++;
-			invalidation_needed = true;
 		}
 	}
 
-	if (invalidation_needed) {
-		mmu_notifier_invalidate_range(vma->vm_mm, address,
-				address + (1UL << compound_order(page)));
-	}
+	mmu_notifier_invalidate_range_end(vma->vm_mm, start, end);
 
 	return true;
 }
@@ -1328,7 +1338,8 @@ static bool try_to_unmap_one(struct page
 	};
 	pte_t pteval;
 	struct page *subpage;
-	bool ret = true, invalidation_needed = false;
+	bool ret = true;
+	unsigned long start = address, end;
 	enum ttu_flags flags = (enum ttu_flags)arg;
 
 	/* munlock has nothing to gain from examining un-locked vmas */
@@ -1340,6 +1351,14 @@ static bool try_to_unmap_one(struct page
 				flags & TTU_MIGRATION, page);
 	}
 
+	/*
+	 * We have to assume the worse case ie pmd for invalidation. Note that
+	 * the page can not be free in this function as call of try_to_unmap()
+	 * must hold a reference on the page.
+	 */
+	end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page)));
+	mmu_notifier_invalidate_range_start(vma->vm_mm, start, end);
+
 	while (page_vma_mapped_walk(&pvmw)) {
 		/*
 		 * If the page is mlock()d, we cannot swap it out.
@@ -1368,9 +1387,11 @@ static bool try_to_unmap_one(struct page
 		VM_BUG_ON_PAGE(!pvmw.pte, page);
 
 		subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
+		address = pvmw.address;
+
 
 		if (!(flags & TTU_IGNORE_ACCESS)) {
-			if (ptep_clear_flush_young_notify(vma, pvmw.address,
+			if (ptep_clear_flush_young_notify(vma, address,
 						pvmw.pte)) {
 				ret = false;
 				page_vma_mapped_walk_done(&pvmw);
@@ -1379,7 +1400,7 @@ static bool try_to_unmap_one(struct page
 		}
 
 		/* Nuke the page table entry. */
-		flush_cache_page(vma, pvmw.address, pte_pfn(*pvmw.pte));
+		flush_cache_page(vma, address, pte_pfn(*pvmw.pte));
 		if (should_defer_flush(mm, flags)) {
 			/*
 			 * We clear the PTE but do not flush so potentially
@@ -1389,12 +1410,11 @@ static bool try_to_unmap_one(struct page
 			 * transition on a cached TLB entry is written through
 			 * and traps if the PTE is unmapped.
 			 */
-			pteval = ptep_get_and_clear(mm, pvmw.address,
-						    pvmw.pte);
+			pteval = ptep_get_and_clear(mm, address, pvmw.pte);
 
 			set_tlb_ubc_flush_pending(mm, pte_dirty(pteval));
 		} else {
-			pteval = ptep_clear_flush(vma, pvmw.address, pvmw.pte);
+			pteval = ptep_clear_flush(vma, address, pvmw.pte);
 		}
 
 		/* Move the dirty bit to the page. Now the pte is gone. */
@@ -1409,12 +1429,12 @@ static bool try_to_unmap_one(struct page
 			if (PageHuge(page)) {
 				int nr = 1 << compound_order(page);
 				hugetlb_count_sub(nr, mm);
-				set_huge_swap_pte_at(mm, pvmw.address,
+				set_huge_swap_pte_at(mm, address,
 						     pvmw.pte, pteval,
 						     vma_mmu_pagesize(vma));
 			} else {
 				dec_mm_counter(mm, mm_counter(page));
-				set_pte_at(mm, pvmw.address, pvmw.pte, pteval);
+				set_pte_at(mm, address, pvmw.pte, pteval);
 			}
 
 		} else if (pte_unused(pteval)) {
@@ -1438,7 +1458,7 @@ static bool try_to_unmap_one(struct page
 			swp_pte = swp_entry_to_pte(entry);
 			if (pte_soft_dirty(pteval))
 				swp_pte = pte_swp_mksoft_dirty(swp_pte);
-			set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
+			set_pte_at(mm, address, pvmw.pte, swp_pte);
 		} else if (PageAnon(page)) {
 			swp_entry_t entry = { .val = page_private(subpage) };
 			pte_t swp_pte;
@@ -1449,6 +1469,7 @@ static bool try_to_unmap_one(struct page
 			if (unlikely(PageSwapBacked(page) != PageSwapCache(page))) {
 				WARN_ON_ONCE(1);
 				ret = false;
+				/* We have to invalidate as we cleared the pte */
 				page_vma_mapped_walk_done(&pvmw);
 				break;
 			}
@@ -1464,7 +1485,7 @@ static bool try_to_unmap_one(struct page
 				 * If the page was redirtied, it cannot be
 				 * discarded. Remap the page to page table.
 				 */
-				set_pte_at(mm, pvmw.address, pvmw.pte, pteval);
+				set_pte_at(mm, address, pvmw.pte, pteval);
 				SetPageSwapBacked(page);
 				ret = false;
 				page_vma_mapped_walk_done(&pvmw);
@@ -1472,7 +1493,7 @@ static bool try_to_unmap_one(struct page
 			}
 
 			if (swap_duplicate(entry) < 0) {
-				set_pte_at(mm, pvmw.address, pvmw.pte, pteval);
+				set_pte_at(mm, address, pvmw.pte, pteval);
 				ret = false;
 				page_vma_mapped_walk_done(&pvmw);
 				break;
@@ -1488,18 +1509,18 @@ static bool try_to_unmap_one(struct page
 			swp_pte = swp_entry_to_pte(entry);
 			if (pte_soft_dirty(pteval))
 				swp_pte = pte_swp_mksoft_dirty(swp_pte);
-			set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
+			set_pte_at(mm, address, pvmw.pte, swp_pte);
 		} else
 			dec_mm_counter(mm, mm_counter_file(page));
 discard:
 		page_remove_rmap(subpage, PageHuge(page));
 		put_page(page);
-		invalidation_needed = true;
+		mmu_notifier_invalidate_range(mm, address,
+					      address + PAGE_SIZE);
 	}
 
-	if (invalidation_needed)
-		mmu_notifier_invalidate_range(mm, address,
-				address + (1UL << compound_order(page)));
+	mmu_notifier_invalidate_range_end(vma->vm_mm, start, end);
+
 	return ret;
 }
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/bridge/br_device.c linux-libre-4.13-gnu/net/bridge/br_device.c
--- linux-libre-4.13-rc7-gnu/net/bridge/br_device.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/bridge/br_device.c	2017-09-03 16:56:17.000000000 -0400
@@ -53,6 +53,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *
 	brstats->tx_bytes += skb->len;
 	u64_stats_update_end(&brstats->syncp);
 
+#ifdef CONFIG_NET_SWITCHDEV
+	skb->offload_fwd_mark = 0;
+#endif
 	BR_INPUT_SKB_CB(skb)->brdev = dev;
 
 	skb_reset_mac_header(skb);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/bridge/br_switchdev.c linux-libre-4.13-gnu/net/bridge/br_switchdev.c
--- linux-libre-4.13-rc7-gnu/net/bridge/br_switchdev.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/bridge/br_switchdev.c	2017-09-03 16:56:17.000000000 -0400
@@ -115,7 +115,7 @@ br_switchdev_fdb_call_notifiers(bool add
 void
 br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
 {
-	if (!fdb->added_by_user)
+	if (!fdb->added_by_user || !fdb->dst)
 		return;
 
 	switch (type) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/core/datagram.c linux-libre-4.13-gnu/net/core/datagram.c
--- linux-libre-4.13-rc7-gnu/net/core/datagram.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/core/datagram.c	2017-09-03 16:56:17.000000000 -0400
@@ -362,7 +362,7 @@ int __sk_queue_drop_skb(struct sock *sk,
 	if (flags & MSG_PEEK) {
 		err = -ENOENT;
 		spin_lock_bh(&sk_queue->lock);
-		if (skb == skb_peek(sk_queue)) {
+		if (skb->next) {
 			__skb_unlink(skb, sk_queue);
 			refcount_dec(&skb->users);
 			if (destructor)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/core/dev.c linux-libre-4.13-gnu/net/core/dev.c
--- linux-libre-4.13-rc7-gnu/net/core/dev.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/core/dev.c	2017-09-03 16:56:17.000000000 -0400
@@ -5289,6 +5289,7 @@ static void busy_poll_stop(struct napi_s
 	 * Ideally, a new ndo_busy_poll_stop() could avoid another round.
 	 */
 	rc = napi->poll(napi, BUSY_POLL_BUDGET);
+	trace_napi_poll(napi, rc, BUSY_POLL_BUDGET);
 	netpoll_poll_unlock(have_poll_lock);
 	if (rc == BUSY_POLL_BUDGET)
 		__napi_schedule(napi);
@@ -5667,12 +5668,13 @@ EXPORT_SYMBOL(netdev_has_upper_dev_all_r
  * Find out if a device is linked to an upper device and return true in case
  * it is. The caller must hold the RTNL lock.
  */
-static bool netdev_has_any_upper_dev(struct net_device *dev)
+bool netdev_has_any_upper_dev(struct net_device *dev)
 {
 	ASSERT_RTNL();
 
 	return !list_empty(&dev->adj_list.upper);
 }
+EXPORT_SYMBOL(netdev_has_any_upper_dev);
 
 /**
  * netdev_master_upper_dev_get - Get master upper device
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/core/filter.c linux-libre-4.13-gnu/net/core/filter.c
--- linux-libre-4.13-rc7-gnu/net/core/filter.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/core/filter.c	2017-09-03 16:56:17.000000000 -0400
@@ -2836,15 +2836,12 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_so
 		   sk->sk_prot->setsockopt == tcp_setsockopt) {
 		if (optname == TCP_CONGESTION) {
 			char name[TCP_CA_NAME_MAX];
+			bool reinit = bpf_sock->op > BPF_SOCK_OPS_NEEDS_ECN;
 
 			strncpy(name, optval, min_t(long, optlen,
 						    TCP_CA_NAME_MAX-1));
 			name[TCP_CA_NAME_MAX-1] = 0;
-			ret = tcp_set_congestion_control(sk, name, false);
-			if (!ret && bpf_sock->op > BPF_SOCK_OPS_NEEDS_ECN)
-				/* replacing an existing ca */
-				tcp_reinit_congestion_control(sk,
-					inet_csk(sk)->icsk_ca_ops);
+			ret = tcp_set_congestion_control(sk, name, false, reinit);
 		} else {
 			struct tcp_sock *tp = tcp_sk(sk);
 
@@ -2872,7 +2869,6 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_so
 				ret = -EINVAL;
 			}
 		}
-		ret = -EINVAL;
 #endif
 	} else {
 		ret = -EINVAL;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/core/skbuff.c linux-libre-4.13-gnu/net/core/skbuff.c
--- linux-libre-4.13-rc7-gnu/net/core/skbuff.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/core/skbuff.c	2017-09-03 16:56:17.000000000 -0400
@@ -1363,18 +1363,20 @@ struct sk_buff *skb_copy_expand(const st
 EXPORT_SYMBOL(skb_copy_expand);
 
 /**
- *	skb_pad			-	zero pad the tail of an skb
+ *	__skb_pad		-	zero pad the tail of an skb
  *	@skb: buffer to pad
  *	@pad: space to pad
+ *	@free_on_error: free buffer on error
  *
  *	Ensure that a buffer is followed by a padding area that is zero
  *	filled. Used by network drivers which may DMA or transfer data
  *	beyond the buffer end onto the wire.
  *
- *	May return error in out of memory cases. The skb is freed on error.
+ *	May return error in out of memory cases. The skb is freed on error
+ *	if @free_on_error is true.
  */
 
-int skb_pad(struct sk_buff *skb, int pad)
+int __skb_pad(struct sk_buff *skb, int pad, bool free_on_error)
 {
 	int err;
 	int ntail;
@@ -1403,10 +1405,11 @@ int skb_pad(struct sk_buff *skb, int pad
 	return 0;
 
 free_skb:
-	kfree_skb(skb);
+	if (free_on_error)
+		kfree_skb(skb);
 	return err;
 }
-EXPORT_SYMBOL(skb_pad);
+EXPORT_SYMBOL(__skb_pad);
 
 /**
  *	pskb_put - add data to the tail of a potentially fragmented buffer
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/dsa/dsa2.c linux-libre-4.13-gnu/net/dsa/dsa2.c
--- linux-libre-4.13-rc7-gnu/net/dsa/dsa2.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/dsa/dsa2.c	2017-09-03 16:56:17.000000000 -0400
@@ -577,7 +577,7 @@ static int dsa_dst_parse(struct dsa_swit
 			return err;
 	}
 
-	if (!dst->cpu_dp->netdev) {
+	if (!dst->cpu_dp) {
 		pr_warn("Tree has no master device\n");
 		return -EINVAL;
 	}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/dsa/tag_ksz.c linux-libre-4.13-gnu/net/dsa/tag_ksz.c
--- linux-libre-4.13-rc7-gnu/net/dsa/tag_ksz.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/dsa/tag_ksz.c	2017-09-03 16:56:17.000000000 -0400
@@ -42,7 +42,8 @@ static struct sk_buff *ksz_xmit(struct s
 	padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
 
 	if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) {
-		if (skb_put_padto(skb, skb->len + padlen))
+		/* Let dsa_slave_xmit() free skb */
+		if (__skb_put_padto(skb, skb->len + padlen, false))
 			return NULL;
 
 		nskb = skb;
@@ -60,12 +61,13 @@ static struct sk_buff *ksz_xmit(struct s
 					 skb_transport_header(skb) - skb->head);
 		skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
 
-		if (skb_put_padto(nskb, nskb->len + padlen)) {
-			kfree_skb(nskb);
+		/* Let skb_put_padto() free nskb, and let dsa_slave_xmit() free
+		 * skb
+		 */
+		if (skb_put_padto(nskb, nskb->len + padlen))
 			return NULL;
-		}
 
-		kfree_skb(skb);
+		consume_skb(skb);
 	}
 
 	tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/dsa/tag_trailer.c linux-libre-4.13-gnu/net/dsa/tag_trailer.c
--- linux-libre-4.13-rc7-gnu/net/dsa/tag_trailer.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/dsa/tag_trailer.c	2017-09-03 16:56:17.000000000 -0400
@@ -40,7 +40,7 @@ static struct sk_buff *trailer_xmit(stru
 	skb_set_network_header(nskb, skb_network_header(skb) - skb->head);
 	skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head);
 	skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
-	kfree_skb(skb);
+	consume_skb(skb);
 
 	if (padlen) {
 		skb_put_zero(nskb, padlen);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/hsr/hsr_device.c linux-libre-4.13-gnu/net/hsr/hsr_device.c
--- linux-libre-4.13-rc7-gnu/net/hsr/hsr_device.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/hsr/hsr_device.c	2017-09-03 16:56:17.000000000 -0400
@@ -314,7 +314,8 @@ static void send_hsr_supervision_frame(s
 	hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload));
 	ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr);
 
-	skb_put_padto(skb, ETH_ZLEN + HSR_HLEN);
+	if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN))
+		return;
 
 	hsr_forward_skb(skb, master);
 	return;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/esp4.c linux-libre-4.13-gnu/net/ipv4/esp4.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/esp4.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/esp4.c	2017-09-03 16:56:17.000000000 -0400
@@ -258,7 +258,7 @@ int esp_output_head(struct xfrm_state *x
 		esp_output_udp_encap(x, skb, esp);
 
 	if (!skb_cloned(skb)) {
-		if (tailen <= skb_availroom(skb)) {
+		if (tailen <= skb_tailroom(skb)) {
 			nfrags = 1;
 			trailer = skb;
 			tail = skb_tail_pointer(trailer);
@@ -292,8 +292,6 @@ int esp_output_head(struct xfrm_state *x
 
 			kunmap_atomic(vaddr);
 
-			spin_unlock_bh(&x->lock);
-
 			nfrags = skb_shinfo(skb)->nr_frags;
 
 			__skb_fill_page_desc(skb, nfrags, page, pfrag->offset,
@@ -301,6 +299,9 @@ int esp_output_head(struct xfrm_state *x
 			skb_shinfo(skb)->nr_frags = ++nfrags;
 
 			pfrag->offset = pfrag->offset + allocsize;
+
+			spin_unlock_bh(&x->lock);
+
 			nfrags++;
 
 			skb->len += tailen;
@@ -381,7 +382,7 @@ int esp_output_tail(struct xfrm_state *x
 		           (unsigned char *)esph - skb->data,
 		           assoclen + ivlen + esp->clen + alen);
 	if (unlikely(err < 0))
-		goto error;
+		goto error_free;
 
 	if (!esp->inplace) {
 		int allocsize;
@@ -392,7 +393,7 @@ int esp_output_tail(struct xfrm_state *x
 		spin_lock_bh(&x->lock);
 		if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
 			spin_unlock_bh(&x->lock);
-			goto error;
+			goto error_free;
 		}
 
 		skb_shinfo(skb)->nr_frags = 1;
@@ -409,7 +410,7 @@ int esp_output_tail(struct xfrm_state *x
 			           (unsigned char *)esph - skb->data,
 			           assoclen + ivlen + esp->clen + alen);
 		if (unlikely(err < 0))
-			goto error;
+			goto error_free;
 	}
 
 	if ((x->props.flags & XFRM_STATE_ESN))
@@ -442,8 +443,9 @@ int esp_output_tail(struct xfrm_state *x
 
 	if (sg != dsg)
 		esp_ssg_unref(x, tmp);
-	kfree(tmp);
 
+error_free:
+	kfree(tmp);
 error:
 	return err;
 }
@@ -695,8 +697,10 @@ skip_cow:
 
 	sg_init_table(sg, nfrags);
 	err = skb_to_sgvec(skb, sg, 0, skb->len);
-	if (unlikely(err < 0))
+	if (unlikely(err < 0)) {
+		kfree(tmp);
 		goto out;
+	}
 
 	skb->ip_summed = CHECKSUM_NONE;
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/esp4_offload.c linux-libre-4.13-gnu/net/ipv4/esp4_offload.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/esp4_offload.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/esp4_offload.c	2017-09-03 16:56:17.000000000 -0400
@@ -257,7 +257,7 @@ static int esp_xmit(struct xfrm_state *x
 	esp.seqno = cpu_to_be64(xo->seq.low + ((u64)xo->seq.hi << 32));
 
 	err = esp_output_tail(x, skb, &esp);
-	if (err < 0)
+	if (err)
 		return err;
 
 	secpath_reset(skb);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/netfilter/arp_tables.c linux-libre-4.13-gnu/net/ipv4/netfilter/arp_tables.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/netfilter/arp_tables.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/netfilter/arp_tables.c	2017-09-03 16:56:17.000000000 -0400
@@ -268,14 +268,14 @@ unsigned int arpt_do_table(struct sk_buf
 		acpar.targinfo = t->data;
 		verdict = t->u.kernel.target->target(skb, &acpar);
 
-		/* Target might have changed stuff. */
-		arp = arp_hdr(skb);
-
-		if (verdict == XT_CONTINUE)
+		if (verdict == XT_CONTINUE) {
+			/* Target might have changed stuff. */
+			arp = arp_hdr(skb);
 			e = arpt_next_entry(e);
-		else
+		} else {
 			/* Verdict */
 			break;
+		}
 	} while (!acpar.hotdrop);
 	xt_write_recseq_end(addend);
 	local_bh_enable();
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/netfilter/ip_tables.c linux-libre-4.13-gnu/net/ipv4/netfilter/ip_tables.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/netfilter/ip_tables.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/netfilter/ip_tables.c	2017-09-03 16:56:17.000000000 -0400
@@ -352,13 +352,14 @@ ipt_do_table(struct sk_buff *skb,
 		acpar.targinfo = t->data;
 
 		verdict = t->u.kernel.target->target(skb, &acpar);
-		/* Target might have changed stuff. */
-		ip = ip_hdr(skb);
-		if (verdict == XT_CONTINUE)
+		if (verdict == XT_CONTINUE) {
+			/* Target might have changed stuff. */
+			ip = ip_hdr(skb);
 			e = ipt_next_entry(e);
-		else
+		} else {
 			/* Verdict */
 			break;
+		}
 	} while (!acpar.hotdrop);
 
 	xt_write_recseq_end(addend);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/netfilter/ipt_CLUSTERIP.c linux-libre-4.13-gnu/net/ipv4/netfilter/ipt_CLUSTERIP.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/netfilter/ipt_CLUSTERIP.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/netfilter/ipt_CLUSTERIP.c	2017-09-03 16:56:17.000000000 -0400
@@ -117,7 +117,8 @@ clusterip_config_entry_put(struct net *n
 		 * functions are also incrementing the refcount on their own,
 		 * so it's safe to remove the entry even if it's in use. */
 #ifdef CONFIG_PROC_FS
-		proc_remove(c->pde);
+		if (cn->procdir)
+			proc_remove(c->pde);
 #endif
 		return;
 	}
@@ -815,6 +816,7 @@ static void clusterip_net_exit(struct ne
 #ifdef CONFIG_PROC_FS
 	struct clusterip_net *cn = net_generic(net, clusterip_net_id);
 	proc_remove(cn->procdir);
+	cn->procdir = NULL;
 #endif
 	nf_unregister_net_hook(net, &cip_arp_ops);
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/tcp.c linux-libre-4.13-gnu/net/ipv4/tcp.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/tcp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/tcp.c	2017-09-03 16:56:17.000000000 -0400
@@ -2481,7 +2481,7 @@ static int do_tcp_setsockopt(struct sock
 		name[val] = 0;
 
 		lock_sock(sk);
-		err = tcp_set_congestion_control(sk, name, true);
+		err = tcp_set_congestion_control(sk, name, true, true);
 		release_sock(sk);
 		return err;
 	}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/tcp_cong.c linux-libre-4.13-gnu/net/ipv4/tcp_cong.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/tcp_cong.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/tcp_cong.c	2017-09-03 16:56:17.000000000 -0400
@@ -189,8 +189,8 @@ void tcp_init_congestion_control(struct
 		INET_ECN_dontxmit(sk);
 }
 
-void tcp_reinit_congestion_control(struct sock *sk,
-				   const struct tcp_congestion_ops *ca)
+static void tcp_reinit_congestion_control(struct sock *sk,
+					  const struct tcp_congestion_ops *ca)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
 
@@ -338,7 +338,7 @@ out:
  * tcp_reinit_congestion_control (if the current congestion control was
  * already initialized.
  */
-int tcp_set_congestion_control(struct sock *sk, const char *name, bool load)
+int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, bool reinit)
 {
 	struct inet_connection_sock *icsk = inet_csk(sk);
 	const struct tcp_congestion_ops *ca;
@@ -360,9 +360,18 @@ int tcp_set_congestion_control(struct so
 	if (!ca) {
 		err = -ENOENT;
 	} else if (!load) {
-		icsk->icsk_ca_ops = ca;
-		if (!try_module_get(ca->owner))
+		const struct tcp_congestion_ops *old_ca = icsk->icsk_ca_ops;
+
+		if (try_module_get(ca->owner)) {
+			if (reinit) {
+				tcp_reinit_congestion_control(sk, ca);
+			} else {
+				icsk->icsk_ca_ops = ca;
+				module_put(old_ca->owner);
+			}
+		} else {
 			err = -EBUSY;
+		}
 	} else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) ||
 		     ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))) {
 		err = -EPERM;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv4/udp.c linux-libre-4.13-gnu/net/ipv4/udp.c
--- linux-libre-4.13-rc7-gnu/net/ipv4/udp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv4/udp.c	2017-09-03 16:56:17.000000000 -0400
@@ -1176,7 +1176,7 @@ static void udp_set_dev_scratch(struct s
 	scratch->csum_unnecessary = !!skb_csum_unnecessary(skb);
 	scratch->is_linear = !skb_is_nonlinear(skb);
 #endif
-	if (likely(!skb->_skb_refdst))
+	if (likely(!skb->_skb_refdst && !skb_sec_path(skb)))
 		scratch->_tsize_state |= UDP_SKB_IS_STATELESS;
 }
 
@@ -1929,14 +1929,16 @@ drop:
 /* For TCP sockets, sk_rx_dst is protected by socket lock
  * For UDP, we use xchg() to guard against concurrent changes.
  */
-void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
+bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
 {
 	struct dst_entry *old;
 
 	if (dst_hold_safe(dst)) {
 		old = xchg(&sk->sk_rx_dst, dst);
 		dst_release(old);
+		return old != dst;
 	}
+	return false;
 }
 EXPORT_SYMBOL(udp_sk_rx_dst_set);
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/addrconf.c linux-libre-4.13-gnu/net/ipv6/addrconf.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/addrconf.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/addrconf.c	2017-09-03 16:56:17.000000000 -0400
@@ -5556,7 +5556,7 @@ static void __ipv6_ifa_notify(int event,
 		 * our DAD process, so we don't need
 		 * to do it again
 		 */
-		if (!(ifp->rt->rt6i_node))
+		if (!rcu_access_pointer(ifp->rt->rt6i_node))
 			ip6_ins_rt(ifp->rt);
 		if (ifp->idev->cnf.forwarding)
 			addrconf_join_anycast(ifp);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/esp6.c linux-libre-4.13-gnu/net/ipv6/esp6.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/esp6.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/esp6.c	2017-09-03 16:56:17.000000000 -0400
@@ -226,7 +226,7 @@ int esp6_output_head(struct xfrm_state *
 	int tailen = esp->tailen;
 
 	if (!skb_cloned(skb)) {
-		if (tailen <= skb_availroom(skb)) {
+		if (tailen <= skb_tailroom(skb)) {
 			nfrags = 1;
 			trailer = skb;
 			tail = skb_tail_pointer(trailer);
@@ -260,8 +260,6 @@ int esp6_output_head(struct xfrm_state *
 
 			kunmap_atomic(vaddr);
 
-			spin_unlock_bh(&x->lock);
-
 			nfrags = skb_shinfo(skb)->nr_frags;
 
 			__skb_fill_page_desc(skb, nfrags, page, pfrag->offset,
@@ -269,6 +267,9 @@ int esp6_output_head(struct xfrm_state *
 			skb_shinfo(skb)->nr_frags = ++nfrags;
 
 			pfrag->offset = pfrag->offset + allocsize;
+
+			spin_unlock_bh(&x->lock);
+
 			nfrags++;
 
 			skb->len += tailen;
@@ -345,7 +346,7 @@ int esp6_output_tail(struct xfrm_state *
 		           (unsigned char *)esph - skb->data,
 		           assoclen + ivlen + esp->clen + alen);
 	if (unlikely(err < 0))
-		goto error;
+		goto error_free;
 
 	if (!esp->inplace) {
 		int allocsize;
@@ -356,7 +357,7 @@ int esp6_output_tail(struct xfrm_state *
 		spin_lock_bh(&x->lock);
 		if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
 			spin_unlock_bh(&x->lock);
-			goto error;
+			goto error_free;
 		}
 
 		skb_shinfo(skb)->nr_frags = 1;
@@ -373,7 +374,7 @@ int esp6_output_tail(struct xfrm_state *
 			           (unsigned char *)esph - skb->data,
 			           assoclen + ivlen + esp->clen + alen);
 		if (unlikely(err < 0))
-			goto error;
+			goto error_free;
 	}
 
 	if ((x->props.flags & XFRM_STATE_ESN))
@@ -406,8 +407,9 @@ int esp6_output_tail(struct xfrm_state *
 
 	if (sg != dsg)
 		esp_ssg_unref(x, tmp);
-	kfree(tmp);
 
+error_free:
+	kfree(tmp);
 error:
 	return err;
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/esp6_offload.c linux-libre-4.13-gnu/net/ipv6/esp6_offload.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/esp6_offload.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/esp6_offload.c	2017-09-03 16:56:17.000000000 -0400
@@ -286,7 +286,7 @@ static int esp6_xmit(struct xfrm_state *
 	esp.seqno = cpu_to_be64(xo->seq.low + ((u64)xo->seq.hi << 32));
 
 	err = esp6_output_tail(x, skb, &esp);
-	if (err < 0)
+	if (err)
 		return err;
 
 	secpath_reset(skb);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/ip6_fib.c linux-libre-4.13-gnu/net/ipv6/ip6_fib.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/ip6_fib.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/ip6_fib.c	2017-09-03 16:56:17.000000000 -0400
@@ -148,11 +148,23 @@ static struct fib6_node *node_alloc(void
 	return fn;
 }
 
-static void node_free(struct fib6_node *fn)
+static void node_free_immediate(struct fib6_node *fn)
 {
 	kmem_cache_free(fib6_node_kmem, fn);
 }
 
+static void node_free_rcu(struct rcu_head *head)
+{
+	struct fib6_node *fn = container_of(head, struct fib6_node, rcu);
+
+	kmem_cache_free(fib6_node_kmem, fn);
+}
+
+static void node_free(struct fib6_node *fn)
+{
+	call_rcu(&fn->rcu, node_free_rcu);
+}
+
 static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt)
 {
 	int cpu;
@@ -601,9 +613,9 @@ insert_above:
 
 		if (!in || !ln) {
 			if (in)
-				node_free(in);
+				node_free_immediate(in);
 			if (ln)
-				node_free(ln);
+				node_free_immediate(ln);
 			return ERR_PTR(-ENOMEM);
 		}
 
@@ -877,7 +889,7 @@ add:
 
 		rt->dst.rt6_next = iter;
 		*ins = rt;
-		rt->rt6i_node = fn;
+		rcu_assign_pointer(rt->rt6i_node, fn);
 		atomic_inc(&rt->rt6i_ref);
 		if (!info->skip_notify)
 			inet6_rt_notify(RTM_NEWROUTE, rt, info, nlflags);
@@ -903,7 +915,7 @@ add:
 			return err;
 
 		*ins = rt;
-		rt->rt6i_node = fn;
+		rcu_assign_pointer(rt->rt6i_node, fn);
 		rt->dst.rt6_next = iter->dst.rt6_next;
 		atomic_inc(&rt->rt6i_ref);
 		if (!info->skip_notify)
@@ -1038,7 +1050,7 @@ int fib6_add(struct fib6_node *root, str
 				   root, and then (in failure) stale node
 				   in main tree.
 				 */
-				node_free(sfn);
+				node_free_immediate(sfn);
 				err = PTR_ERR(sn);
 				goto failure;
 			}
@@ -1468,8 +1480,9 @@ static void fib6_del_route(struct fib6_n
 
 int fib6_del(struct rt6_info *rt, struct nl_info *info)
 {
+	struct fib6_node *fn = rcu_dereference_protected(rt->rt6i_node,
+				    lockdep_is_held(&rt->rt6i_table->tb6_lock));
 	struct net *net = info->nl_net;
-	struct fib6_node *fn = rt->rt6i_node;
 	struct rt6_info **rtp;
 
 #if RT6_DEBUG >= 2
@@ -1658,7 +1671,9 @@ static int fib6_clean_node(struct fib6_w
 			if (res) {
 #if RT6_DEBUG >= 2
 				pr_debug("%s: del failed: rt=%p@%p err=%d\n",
-					 __func__, rt, rt->rt6i_node, res);
+					 __func__, rt,
+					 rcu_access_pointer(rt->rt6i_node),
+					 res);
 #endif
 				continue;
 			}
@@ -1780,8 +1795,10 @@ static int fib6_age(struct rt6_info *rt,
 		}
 		gc_args->more++;
 	} else if (rt->rt6i_flags & RTF_CACHE) {
+		if (time_after_eq(now, rt->dst.lastuse + gc_args->timeout))
+			rt->dst.obsolete = DST_OBSOLETE_KILL;
 		if (atomic_read(&rt->dst.__refcnt) == 1 &&
-		    time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) {
+		    rt->dst.obsolete == DST_OBSOLETE_KILL) {
 			RT6_TRACE("aging clone %p\n", rt);
 			return -1;
 		} else if (rt->rt6i_flags & RTF_GATEWAY) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/ipv6_sockglue.c linux-libre-4.13-gnu/net/ipv6/ipv6_sockglue.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/ipv6_sockglue.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/ipv6_sockglue.c	2017-09-03 16:56:17.000000000 -0400
@@ -242,7 +242,6 @@ static int do_ipv6_setsockopt(struct soc
 			pktopt = xchg(&np->pktoptions, NULL);
 			kfree_skb(pktopt);
 
-			sk->sk_destruct = inet_sock_destruct;
 			/*
 			 * ... and add it to the refcnt debug socks count
 			 * in the new family. -acme
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/output_core.c linux-libre-4.13-gnu/net/ipv6/output_core.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/output_core.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/output_core.c	2017-09-03 16:56:17.000000000 -0400
@@ -86,7 +86,6 @@ int ip6_find_1stfragopt(struct sk_buff *
 
 	while (offset <= packet_len) {
 		struct ipv6_opt_hdr *exthdr;
-		unsigned int len;
 
 		switch (**nexthdr) {
 
@@ -112,10 +111,9 @@ int ip6_find_1stfragopt(struct sk_buff *
 
 		exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) +
 						 offset);
-		len = ipv6_optlen(exthdr);
-		if (len + offset >= IPV6_MAXPLEN)
+		offset += ipv6_optlen(exthdr);
+		if (offset > IPV6_MAXPLEN)
 			return -EINVAL;
-		offset += len;
 		*nexthdr = &exthdr->nexthdr;
 	}
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/route.c linux-libre-4.13-gnu/net/ipv6/route.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/route.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/route.c	2017-09-03 16:56:17.000000000 -0400
@@ -440,7 +440,8 @@ static bool rt6_check_expired(const stru
 		if (time_after(jiffies, rt->dst.expires))
 			return true;
 	} else if (rt->dst.from) {
-		return rt6_check_expired((struct rt6_info *) rt->dst.from);
+		return rt->dst.obsolete != DST_OBSOLETE_FORCE_CHK ||
+		       rt6_check_expired((struct rt6_info *)rt->dst.from);
 	}
 	return false;
 }
@@ -1289,7 +1290,9 @@ static void rt6_dst_from_metrics_check(s
 
 static struct dst_entry *rt6_check(struct rt6_info *rt, u32 cookie)
 {
-	if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie))
+	u32 rt_cookie = 0;
+
+	if (!rt6_get_cookie_safe(rt, &rt_cookie) || rt_cookie != cookie)
 		return NULL;
 
 	if (rt6_check_expired(rt))
@@ -1357,8 +1360,14 @@ static void ip6_link_failure(struct sk_b
 		if (rt->rt6i_flags & RTF_CACHE) {
 			if (dst_hold_safe(&rt->dst))
 				ip6_del_rt(rt);
-		} else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) {
-			rt->rt6i_node->fn_sernum = -1;
+		} else {
+			struct fib6_node *fn;
+
+			rcu_read_lock();
+			fn = rcu_dereference(rt->rt6i_node);
+			if (fn && (rt->rt6i_flags & RTF_DEFAULT))
+				fn->fn_sernum = -1;
+			rcu_read_unlock();
 		}
 	}
 }
@@ -1375,7 +1384,8 @@ static void rt6_do_update_pmtu(struct rt
 static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt)
 {
 	return !(rt->rt6i_flags & RTF_CACHE) &&
-		(rt->rt6i_flags & RTF_PCPU || rt->rt6i_node);
+		(rt->rt6i_flags & RTF_PCPU ||
+		 rcu_access_pointer(rt->rt6i_node));
 }
 
 static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/ipv6/udp.c linux-libre-4.13-gnu/net/ipv6/udp.c
--- linux-libre-4.13-rc7-gnu/net/ipv6/udp.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/ipv6/udp.c	2017-09-03 16:56:17.000000000 -0400
@@ -768,6 +768,15 @@ start_lookup:
 	return 0;
 }
 
+static void udp6_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
+{
+	if (udp_sk_rx_dst_set(sk, dst)) {
+		const struct rt6_info *rt = (const struct rt6_info *)dst;
+
+		inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt);
+	}
+}
+
 int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 		   int proto)
 {
@@ -817,7 +826,7 @@ int __udp6_lib_rcv(struct sk_buff *skb,
 		int ret;
 
 		if (unlikely(sk->sk_rx_dst != dst))
-			udp_sk_rx_dst_set(sk, dst);
+			udp6_sk_rx_dst_set(sk, dst);
 
 		ret = udpv6_queue_rcv_skb(sk, skb);
 		sock_put(sk);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/kcm/kcmsock.c linux-libre-4.13-gnu/net/kcm/kcmsock.c
--- linux-libre-4.13-rc7-gnu/net/kcm/kcmsock.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/kcm/kcmsock.c	2017-09-03 16:56:17.000000000 -0400
@@ -1383,6 +1383,10 @@ static int kcm_attach(struct socket *soc
 	if (!csk)
 		return -EINVAL;
 
+	/* We must prevent loops or risk deadlock ! */
+	if (csk->sk_family == PF_KCM)
+		return -EOPNOTSUPP;
+
 	psock = kmem_cache_zalloc(kcm_psockp, GFP_KERNEL);
 	if (!psock)
 		return -ENOMEM;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/l2tp/l2tp_core.c linux-libre-4.13-gnu/net/l2tp/l2tp_core.c
--- linux-libre-4.13-rc7-gnu/net/l2tp/l2tp_core.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/l2tp/l2tp_core.c	2017-09-03 16:56:17.000000000 -0400
@@ -113,7 +113,6 @@ struct l2tp_net {
 	spinlock_t l2tp_session_hlist_lock;
 };
 
-static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel);
 
 static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk)
 {
@@ -127,39 +126,6 @@ static inline struct l2tp_net *l2tp_pern
 	return net_generic(net, l2tp_net_id);
 }
 
-/* Tunnel reference counts. Incremented per session that is added to
- * the tunnel.
- */
-static inline void l2tp_tunnel_inc_refcount_1(struct l2tp_tunnel *tunnel)
-{
-	refcount_inc(&tunnel->ref_count);
-}
-
-static inline void l2tp_tunnel_dec_refcount_1(struct l2tp_tunnel *tunnel)
-{
-	if (refcount_dec_and_test(&tunnel->ref_count))
-		l2tp_tunnel_free(tunnel);
-}
-#ifdef L2TP_REFCNT_DEBUG
-#define l2tp_tunnel_inc_refcount(_t)					\
-do {									\
-	pr_debug("l2tp_tunnel_inc_refcount: %s:%d %s: cnt=%d\n",	\
-		 __func__, __LINE__, (_t)->name,			\
-		 refcount_read(&_t->ref_count));			\
-	l2tp_tunnel_inc_refcount_1(_t);					\
-} while (0)
-#define l2tp_tunnel_dec_refcount(_t)					\
-do {									\
-	pr_debug("l2tp_tunnel_dec_refcount: %s:%d %s: cnt=%d\n",	\
-		 __func__, __LINE__, (_t)->name,			\
-		 refcount_read(&_t->ref_count));			\
-	l2tp_tunnel_dec_refcount_1(_t);					\
-} while (0)
-#else
-#define l2tp_tunnel_inc_refcount(t) l2tp_tunnel_inc_refcount_1(t)
-#define l2tp_tunnel_dec_refcount(t) l2tp_tunnel_dec_refcount_1(t)
-#endif
-
 /* Session hash global list for L2TPv3.
  * The session_id SHOULD be random according to RFC3931, but several
  * L2TP implementations use incrementing session_ids.  So we do a real
@@ -229,6 +195,27 @@ l2tp_session_id_hash(struct l2tp_tunnel
 	return &tunnel->session_hlist[hash_32(session_id, L2TP_HASH_BITS)];
 }
 
+/* Lookup a tunnel. A new reference is held on the returned tunnel. */
+struct l2tp_tunnel *l2tp_tunnel_get(const struct net *net, u32 tunnel_id)
+{
+	const struct l2tp_net *pn = l2tp_pernet(net);
+	struct l2tp_tunnel *tunnel;
+
+	rcu_read_lock_bh();
+	list_for_each_entry_rcu(tunnel, &pn->l2tp_tunnel_list, list) {
+		if (tunnel->tunnel_id == tunnel_id) {
+			l2tp_tunnel_inc_refcount(tunnel);
+			rcu_read_unlock_bh();
+
+			return tunnel;
+		}
+	}
+	rcu_read_unlock_bh();
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(l2tp_tunnel_get);
+
 /* Lookup a session. A new reference is held on the returned session.
  * Optionally calls session->ref() too if do_ref is true.
  */
@@ -1348,17 +1335,6 @@ static void l2tp_udp_encap_destroy(struc
 	}
 }
 
-/* Really kill the tunnel.
- * Come here only when all sessions have been cleared from the tunnel.
- */
-static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel)
-{
-	BUG_ON(refcount_read(&tunnel->ref_count) != 0);
-	BUG_ON(tunnel->sock != NULL);
-	l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: free...\n", tunnel->name);
-	kfree_rcu(tunnel, rcu);
-}
-
 /* Workqueue tunnel deletion function */
 static void l2tp_tunnel_del_work(struct work_struct *work)
 {
@@ -1844,6 +1820,8 @@ struct l2tp_session *l2tp_session_create
 
 		l2tp_session_set_header_len(session, tunnel->version);
 
+		refcount_set(&session->ref_count, 1);
+
 		err = l2tp_session_add_to_tunnel(tunnel, session);
 		if (err) {
 			kfree(session);
@@ -1851,10 +1829,6 @@ struct l2tp_session *l2tp_session_create
 			return ERR_PTR(err);
 		}
 
-		/* Bump the reference count. The session context is deleted
-		 * only when this drops to zero.
-		 */
-		refcount_set(&session->ref_count, 1);
 		l2tp_tunnel_inc_refcount(tunnel);
 
 		/* Ensure tunnel socket isn't deleted */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/l2tp/l2tp_core.h linux-libre-4.13-gnu/net/l2tp/l2tp_core.h
--- linux-libre-4.13-rc7-gnu/net/l2tp/l2tp_core.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/l2tp/l2tp_core.h	2017-09-03 16:56:17.000000000 -0400
@@ -231,6 +231,8 @@ out:
 	return tunnel;
 }
 
+struct l2tp_tunnel *l2tp_tunnel_get(const struct net *net, u32 tunnel_id);
+
 struct l2tp_session *l2tp_session_get(const struct net *net,
 				      struct l2tp_tunnel *tunnel,
 				      u32 session_id, bool do_ref);
@@ -269,6 +271,17 @@ int l2tp_nl_register_ops(enum l2tp_pwtyp
 void l2tp_nl_unregister_ops(enum l2tp_pwtype pw_type);
 int l2tp_ioctl(struct sock *sk, int cmd, unsigned long arg);
 
+static inline void l2tp_tunnel_inc_refcount(struct l2tp_tunnel *tunnel)
+{
+	refcount_inc(&tunnel->ref_count);
+}
+
+static inline void l2tp_tunnel_dec_refcount(struct l2tp_tunnel *tunnel)
+{
+	if (refcount_dec_and_test(&tunnel->ref_count))
+		kfree_rcu(tunnel, rcu);
+}
+
 /* Session reference counts. Incremented when code obtains a reference
  * to a session.
  */
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/l2tp/l2tp_netlink.c linux-libre-4.13-gnu/net/l2tp/l2tp_netlink.c
--- linux-libre-4.13-rc7-gnu/net/l2tp/l2tp_netlink.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/l2tp/l2tp_netlink.c	2017-09-03 16:56:17.000000000 -0400
@@ -65,10 +65,12 @@ static struct l2tp_session *l2tp_nl_sess
 		   (info->attrs[L2TP_ATTR_CONN_ID])) {
 		tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
 		session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);
-		tunnel = l2tp_tunnel_find(net, tunnel_id);
-		if (tunnel)
+		tunnel = l2tp_tunnel_get(net, tunnel_id);
+		if (tunnel) {
 			session = l2tp_session_get(net, tunnel, session_id,
 						   do_ref);
+			l2tp_tunnel_dec_refcount(tunnel);
+		}
 	}
 
 	return session;
@@ -271,8 +273,8 @@ static int l2tp_nl_cmd_tunnel_delete(str
 	}
 	tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
 
-	tunnel = l2tp_tunnel_find(net, tunnel_id);
-	if (tunnel == NULL) {
+	tunnel = l2tp_tunnel_get(net, tunnel_id);
+	if (!tunnel) {
 		ret = -ENODEV;
 		goto out;
 	}
@@ -282,6 +284,8 @@ static int l2tp_nl_cmd_tunnel_delete(str
 
 	(void) l2tp_tunnel_delete(tunnel);
 
+	l2tp_tunnel_dec_refcount(tunnel);
+
 out:
 	return ret;
 }
@@ -299,8 +303,8 @@ static int l2tp_nl_cmd_tunnel_modify(str
 	}
 	tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
 
-	tunnel = l2tp_tunnel_find(net, tunnel_id);
-	if (tunnel == NULL) {
+	tunnel = l2tp_tunnel_get(net, tunnel_id);
+	if (!tunnel) {
 		ret = -ENODEV;
 		goto out;
 	}
@@ -311,6 +315,8 @@ static int l2tp_nl_cmd_tunnel_modify(str
 	ret = l2tp_tunnel_notify(&l2tp_nl_family, info,
 				 tunnel, L2TP_CMD_TUNNEL_MODIFY);
 
+	l2tp_tunnel_dec_refcount(tunnel);
+
 out:
 	return ret;
 }
@@ -438,34 +444,37 @@ static int l2tp_nl_cmd_tunnel_get(struct
 
 	if (!info->attrs[L2TP_ATTR_CONN_ID]) {
 		ret = -EINVAL;
-		goto out;
+		goto err;
 	}
 
 	tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
 
-	tunnel = l2tp_tunnel_find(net, tunnel_id);
-	if (tunnel == NULL) {
-		ret = -ENODEV;
-		goto out;
-	}
-
 	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
 	if (!msg) {
 		ret = -ENOMEM;
-		goto out;
+		goto err;
+	}
+
+	tunnel = l2tp_tunnel_get(net, tunnel_id);
+	if (!tunnel) {
+		ret = -ENODEV;
+		goto err_nlmsg;
 	}
 
 	ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
 				  NLM_F_ACK, tunnel, L2TP_CMD_TUNNEL_GET);
 	if (ret < 0)
-		goto err_out;
+		goto err_nlmsg_tunnel;
+
+	l2tp_tunnel_dec_refcount(tunnel);
 
 	return genlmsg_unicast(net, msg, info->snd_portid);
 
-err_out:
+err_nlmsg_tunnel:
+	l2tp_tunnel_dec_refcount(tunnel);
+err_nlmsg:
 	nlmsg_free(msg);
-
-out:
+err:
 	return ret;
 }
 
@@ -509,8 +518,9 @@ static int l2tp_nl_cmd_session_create(st
 		ret = -EINVAL;
 		goto out;
 	}
+
 	tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
-	tunnel = l2tp_tunnel_find(net, tunnel_id);
+	tunnel = l2tp_tunnel_get(net, tunnel_id);
 	if (!tunnel) {
 		ret = -ENODEV;
 		goto out;
@@ -518,24 +528,24 @@ static int l2tp_nl_cmd_session_create(st
 
 	if (!info->attrs[L2TP_ATTR_SESSION_ID]) {
 		ret = -EINVAL;
-		goto out;
+		goto out_tunnel;
 	}
 	session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);
 
 	if (!info->attrs[L2TP_ATTR_PEER_SESSION_ID]) {
 		ret = -EINVAL;
-		goto out;
+		goto out_tunnel;
 	}
 	peer_session_id = nla_get_u32(info->attrs[L2TP_ATTR_PEER_SESSION_ID]);
 
 	if (!info->attrs[L2TP_ATTR_PW_TYPE]) {
 		ret = -EINVAL;
-		goto out;
+		goto out_tunnel;
 	}
 	cfg.pw_type = nla_get_u16(info->attrs[L2TP_ATTR_PW_TYPE]);
 	if (cfg.pw_type >= __L2TP_PWTYPE_MAX) {
 		ret = -EINVAL;
-		goto out;
+		goto out_tunnel;
 	}
 
 	if (tunnel->version > 2) {
@@ -557,7 +567,7 @@ static int l2tp_nl_cmd_session_create(st
 			u16 len = nla_len(info->attrs[L2TP_ATTR_COOKIE]);
 			if (len > 8) {
 				ret = -EINVAL;
-				goto out;
+				goto out_tunnel;
 			}
 			cfg.cookie_len = len;
 			memcpy(&cfg.cookie[0], nla_data(info->attrs[L2TP_ATTR_COOKIE]), len);
@@ -566,7 +576,7 @@ static int l2tp_nl_cmd_session_create(st
 			u16 len = nla_len(info->attrs[L2TP_ATTR_PEER_COOKIE]);
 			if (len > 8) {
 				ret = -EINVAL;
-				goto out;
+				goto out_tunnel;
 			}
 			cfg.peer_cookie_len = len;
 			memcpy(&cfg.peer_cookie[0], nla_data(info->attrs[L2TP_ATTR_PEER_COOKIE]), len);
@@ -609,7 +619,7 @@ static int l2tp_nl_cmd_session_create(st
 	if ((l2tp_nl_cmd_ops[cfg.pw_type] == NULL) ||
 	    (l2tp_nl_cmd_ops[cfg.pw_type]->session_create == NULL)) {
 		ret = -EPROTONOSUPPORT;
-		goto out;
+		goto out_tunnel;
 	}
 
 	/* Check that pseudowire-specific params are present */
@@ -619,7 +629,7 @@ static int l2tp_nl_cmd_session_create(st
 	case L2TP_PWTYPE_ETH_VLAN:
 		if (!info->attrs[L2TP_ATTR_VLAN_ID]) {
 			ret = -EINVAL;
-			goto out;
+			goto out_tunnel;
 		}
 		break;
 	case L2TP_PWTYPE_ETH:
@@ -647,6 +657,8 @@ static int l2tp_nl_cmd_session_create(st
 		}
 	}
 
+out_tunnel:
+	l2tp_tunnel_dec_refcount(tunnel);
 out:
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/netfilter/nf_nat_core.c linux-libre-4.13-gnu/net/netfilter/nf_nat_core.c
--- linux-libre-4.13-rc7-gnu/net/netfilter/nf_nat_core.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/netfilter/nf_nat_core.c	2017-09-03 16:56:17.000000000 -0400
@@ -441,7 +441,7 @@ nf_nat_setup_info(struct nf_conn *ct,
 		else
 			ct->status |= IPS_DST_NAT;
 
-		if (nfct_help(ct))
+		if (nfct_help(ct) && !nfct_seqadj(ct))
 			if (!nfct_seqadj_ext_add(ct))
 				return NF_DROP;
 	}
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/netfilter/nft_compat.c linux-libre-4.13-gnu/net/netfilter/nft_compat.c
--- linux-libre-4.13-rc7-gnu/net/netfilter/nft_compat.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/netfilter/nft_compat.c	2017-09-03 16:56:17.000000000 -0400
@@ -305,7 +305,7 @@ static int nft_target_validate(const str
 		const struct nf_hook_ops *ops = &basechain->ops[0];
 
 		hook_mask = 1 << ops->hooknum;
-		if (!(hook_mask & target->hooks))
+		if (target->hooks && !(hook_mask & target->hooks))
 			return -EINVAL;
 
 		ret = nft_compat_chain_validate_dependency(target->table,
@@ -484,7 +484,7 @@ static int nft_match_validate(const stru
 		const struct nf_hook_ops *ops = &basechain->ops[0];
 
 		hook_mask = 1 << ops->hooknum;
-		if (!(hook_mask & match->hooks))
+		if (match->hooks && !(hook_mask & match->hooks))
 			return -EINVAL;
 
 		ret = nft_compat_chain_validate_dependency(match->table,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/netfilter/nft_limit.c linux-libre-4.13-gnu/net/netfilter/nft_limit.c
--- linux-libre-4.13-rc7-gnu/net/netfilter/nft_limit.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/netfilter/nft_limit.c	2017-09-03 16:56:17.000000000 -0400
@@ -65,19 +65,23 @@ static int nft_limit_init(struct nft_lim
 	limit->nsecs = unit * NSEC_PER_SEC;
 	if (limit->rate == 0 || limit->nsecs < unit)
 		return -EOVERFLOW;
-	limit->tokens = limit->tokens_max = limit->nsecs;
-
-	if (tb[NFTA_LIMIT_BURST]) {
-		u64 rate;
 
+	if (tb[NFTA_LIMIT_BURST])
 		limit->burst = ntohl(nla_get_be32(tb[NFTA_LIMIT_BURST]));
+	else
+		limit->burst = 0;
 
-		rate = limit->rate + limit->burst;
-		if (rate < limit->rate)
-			return -EOVERFLOW;
+	if (limit->rate + limit->burst < limit->rate)
+		return -EOVERFLOW;
+
+	/* The token bucket size limits the number of tokens can be
+	 * accumulated. tokens_max specifies the bucket size.
+	 * tokens_max = unit * (rate + burst) / rate.
+	 */
+	limit->tokens = div_u64(limit->nsecs * (limit->rate + limit->burst),
+				limit->rate);
+	limit->tokens_max = limit->tokens;
 
-		limit->rate = rate;
-	}
 	if (tb[NFTA_LIMIT_FLAGS]) {
 		u32 flags = ntohl(nla_get_be32(tb[NFTA_LIMIT_FLAGS]));
 
@@ -95,9 +99,8 @@ static int nft_limit_dump(struct sk_buff
 {
 	u32 flags = limit->invert ? NFT_LIMIT_F_INV : 0;
 	u64 secs = div_u64(limit->nsecs, NSEC_PER_SEC);
-	u64 rate = limit->rate - limit->burst;
 
-	if (nla_put_be64(skb, NFTA_LIMIT_RATE, cpu_to_be64(rate),
+	if (nla_put_be64(skb, NFTA_LIMIT_RATE, cpu_to_be64(limit->rate),
 			 NFTA_LIMIT_PAD) ||
 	    nla_put_be64(skb, NFTA_LIMIT_UNIT, cpu_to_be64(secs),
 			 NFTA_LIMIT_PAD) ||
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/packet/af_packet.c linux-libre-4.13-gnu/net/packet/af_packet.c
--- linux-libre-4.13-rc7-gnu/net/packet/af_packet.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/packet/af_packet.c	2017-09-03 16:56:17.000000000 -0400
@@ -2191,6 +2191,7 @@ static int tpacket_rcv(struct sk_buff *s
 	struct timespec ts;
 	__u32 ts_status;
 	bool is_drop_n_account = false;
+	bool do_vnet = false;
 
 	/* struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT.
 	 * We may add members to them until current aligned size without forcing
@@ -2241,8 +2242,10 @@ static int tpacket_rcv(struct sk_buff *s
 		netoff = TPACKET_ALIGN(po->tp_hdrlen +
 				       (maclen < 16 ? 16 : maclen)) +
 				       po->tp_reserve;
-		if (po->has_vnet_hdr)
+		if (po->has_vnet_hdr) {
 			netoff += sizeof(struct virtio_net_hdr);
+			do_vnet = true;
+		}
 		macoff = netoff - maclen;
 	}
 	if (po->tp_version <= TPACKET_V2) {
@@ -2259,8 +2262,10 @@ static int tpacket_rcv(struct sk_buff *s
 					skb_set_owner_r(copy_skb, sk);
 			}
 			snaplen = po->rx_ring.frame_size - macoff;
-			if ((int)snaplen < 0)
+			if ((int)snaplen < 0) {
 				snaplen = 0;
+				do_vnet = false;
+			}
 		}
 	} else if (unlikely(macoff + snaplen >
 			    GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len)) {
@@ -2273,6 +2278,7 @@ static int tpacket_rcv(struct sk_buff *s
 		if (unlikely((int)snaplen < 0)) {
 			snaplen = 0;
 			macoff = GET_PBDQC_FROM_RB(&po->rx_ring)->max_frame_len;
+			do_vnet = false;
 		}
 	}
 	spin_lock(&sk->sk_receive_queue.lock);
@@ -2298,7 +2304,7 @@ static int tpacket_rcv(struct sk_buff *s
 	}
 	spin_unlock(&sk->sk_receive_queue.lock);
 
-	if (po->has_vnet_hdr) {
+	if (do_vnet) {
 		if (virtio_net_hdr_from_skb(skb, h.raw + macoff -
 					    sizeof(struct virtio_net_hdr),
 					    vio_le(), true)) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/cls_api.c linux-libre-4.13-gnu/net/sched/cls_api.c
--- linux-libre-4.13-rc7-gnu/net/sched/cls_api.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/cls_api.c	2017-09-03 16:56:17.000000000 -0400
@@ -215,9 +215,15 @@ static void tcf_chain_flush(struct tcf_c
 
 static void tcf_chain_destroy(struct tcf_chain *chain)
 {
-	list_del(&chain->list);
-	tcf_chain_flush(chain);
-	kfree(chain);
+	/* May be already removed from the list by the previous call. */
+	if (!list_empty(&chain->list))
+		list_del_init(&chain->list);
+
+	/* There might still be a reference held when we got here from
+	 * tcf_block_put. Wait for the user to drop reference before free.
+	 */
+	if (!chain->refcnt)
+		kfree(chain);
 }
 
 struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
@@ -288,8 +294,10 @@ void tcf_block_put(struct tcf_block *blo
 	if (!block)
 		return;
 
-	list_for_each_entry_safe(chain, tmp, &block->chain_list, list)
+	list_for_each_entry_safe(chain, tmp, &block->chain_list, list) {
+		tcf_chain_flush(chain);
 		tcf_chain_destroy(chain);
+	}
 	kfree(block);
 }
 EXPORT_SYMBOL(tcf_block_put);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_api.c linux-libre-4.13-gnu/net/sched/sch_api.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_api.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_api.c	2017-09-03 16:56:17.000000000 -0400
@@ -836,7 +836,7 @@ static int qdisc_graft(struct net_device
 
 			old = dev_graft_qdisc(dev_queue, new);
 			if (new && i > 0)
-				refcount_inc(&new->refcnt);
+				qdisc_refcount_inc(new);
 
 			if (!ingress)
 				qdisc_destroy(old);
@@ -847,7 +847,7 @@ skip:
 			notify_and_destroy(net, skb, n, classid,
 					   dev->qdisc, new);
 			if (new && !new->ops->attach)
-				refcount_inc(&new->refcnt);
+				qdisc_refcount_inc(new);
 			dev->qdisc = new ? : &noop_qdisc;
 
 			if (new && new->ops->attach)
@@ -1256,7 +1256,7 @@ replay:
 				if (q == p ||
 				    (p && check_loop(q, p, 0)))
 					return -ELOOP;
-				refcount_inc(&q->refcnt);
+				qdisc_refcount_inc(q);
 				goto graft;
 			} else {
 				if (!q)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_cbq.c linux-libre-4.13-gnu/net/sched/sch_cbq.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_cbq.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_cbq.c	2017-09-03 16:56:17.000000000 -0400
@@ -1139,6 +1139,13 @@ static int cbq_init(struct Qdisc *sch, s
 	struct tc_ratespec *r;
 	int err;
 
+	qdisc_watchdog_init(&q->watchdog, sch);
+	hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
+	q->delay_timer.function = cbq_undelay;
+
+	if (!opt)
+		return -EINVAL;
+
 	err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, NULL);
 	if (err < 0)
 		return err;
@@ -1177,9 +1184,6 @@ static int cbq_init(struct Qdisc *sch, s
 	q->link.avpkt = q->link.allot/2;
 	q->link.minidle = -0x7FFFFFFF;
 
-	qdisc_watchdog_init(&q->watchdog, sch);
-	hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
-	q->delay_timer.function = cbq_undelay;
 	q->toplevel = TC_CBQ_MAXLEVEL;
 	q->now = psched_get_time();
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_fq_codel.c linux-libre-4.13-gnu/net/sched/sch_fq_codel.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_fq_codel.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_fq_codel.c	2017-09-03 16:56:17.000000000 -0400
@@ -491,10 +491,8 @@ static int fq_codel_init(struct Qdisc *s
 		if (!q->flows)
 			return -ENOMEM;
 		q->backlogs = kvzalloc(q->flows_cnt * sizeof(u32), GFP_KERNEL);
-		if (!q->backlogs) {
-			kvfree(q->flows);
+		if (!q->backlogs)
 			return -ENOMEM;
-		}
 		for (i = 0; i < q->flows_cnt; i++) {
 			struct fq_codel_flow *flow = q->flows + i;
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_generic.c linux-libre-4.13-gnu/net/sched/sch_generic.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_generic.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_generic.c	2017-09-03 16:56:17.000000000 -0400
@@ -785,7 +785,7 @@ static void attach_default_qdiscs(struct
 	    dev->priv_flags & IFF_NO_QUEUE) {
 		netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
 		dev->qdisc = txq->qdisc_sleeping;
-		refcount_inc(&dev->qdisc->refcnt);
+		qdisc_refcount_inc(dev->qdisc);
 	} else {
 		qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT);
 		if (qdisc) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_hfsc.c linux-libre-4.13-gnu/net/sched/sch_hfsc.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_hfsc.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_hfsc.c	2017-09-03 16:56:17.000000000 -0400
@@ -1418,6 +1418,8 @@ hfsc_init_qdisc(struct Qdisc *sch, struc
 	struct tc_hfsc_qopt *qopt;
 	int err;
 
+	qdisc_watchdog_init(&q->watchdog, sch);
+
 	if (opt == NULL || nla_len(opt) < sizeof(*qopt))
 		return -EINVAL;
 	qopt = nla_data(opt);
@@ -1430,7 +1432,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struc
 
 	err = tcf_block_get(&q->root.block, &q->root.filter_list);
 	if (err)
-		goto err_tcf;
+		return err;
 
 	q->root.cl_common.classid = sch->handle;
 	q->root.refcnt  = 1;
@@ -1448,13 +1450,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struc
 	qdisc_class_hash_insert(&q->clhash, &q->root.cl_common);
 	qdisc_class_hash_grow(sch, &q->clhash);
 
-	qdisc_watchdog_init(&q->watchdog, sch);
-
 	return 0;
-
-err_tcf:
-	qdisc_class_hash_destroy(&q->clhash);
-	return err;
 }
 
 static int
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_hhf.c linux-libre-4.13-gnu/net/sched/sch_hhf.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_hhf.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_hhf.c	2017-09-03 16:56:17.000000000 -0400
@@ -477,6 +477,9 @@ static void hhf_destroy(struct Qdisc *sc
 		kvfree(q->hhf_valid_bits[i]);
 	}
 
+	if (!q->hh_flows)
+		return;
+
 	for (i = 0; i < HH_FLOWS_CNT; i++) {
 		struct hh_flow_state *flow, *next;
 		struct list_head *head = &q->hh_flows[i];
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_htb.c linux-libre-4.13-gnu/net/sched/sch_htb.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_htb.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_htb.c	2017-09-03 16:56:17.000000000 -0400
@@ -1017,6 +1017,9 @@ static int htb_init(struct Qdisc *sch, s
 	int err;
 	int i;
 
+	qdisc_watchdog_init(&q->watchdog, sch);
+	INIT_WORK(&q->work, htb_work_func);
+
 	if (!opt)
 		return -EINVAL;
 
@@ -1041,8 +1044,6 @@ static int htb_init(struct Qdisc *sch, s
 	for (i = 0; i < TC_HTB_NUMPRIO; i++)
 		INIT_LIST_HEAD(q->drops + i);
 
-	qdisc_watchdog_init(&q->watchdog, sch);
-	INIT_WORK(&q->work, htb_work_func);
 	qdisc_skb_head_init(&q->direct_queue);
 
 	if (tb[TCA_HTB_DIRECT_QLEN])
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_multiq.c linux-libre-4.13-gnu/net/sched/sch_multiq.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_multiq.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_multiq.c	2017-09-03 16:56:17.000000000 -0400
@@ -257,12 +257,7 @@ static int multiq_init(struct Qdisc *sch
 	for (i = 0; i < q->max_bands; i++)
 		q->queues[i] = &noop_qdisc;
 
-	err = multiq_tune(sch, opt);
-
-	if (err)
-		kfree(q->queues);
-
-	return err;
+	return multiq_tune(sch, opt);
 }
 
 static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_netem.c linux-libre-4.13-gnu/net/sched/sch_netem.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_netem.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_netem.c	2017-09-03 16:56:17.000000000 -0400
@@ -933,11 +933,11 @@ static int netem_init(struct Qdisc *sch,
 	struct netem_sched_data *q = qdisc_priv(sch);
 	int ret;
 
+	qdisc_watchdog_init(&q->watchdog, sch);
+
 	if (!opt)
 		return -EINVAL;
 
-	qdisc_watchdog_init(&q->watchdog, sch);
-
 	q->loss_model = CLG_RANDOM;
 	ret = netem_change(sch, opt);
 	if (ret)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_sfq.c linux-libre-4.13-gnu/net/sched/sch_sfq.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_sfq.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_sfq.c	2017-09-03 16:56:17.000000000 -0400
@@ -716,13 +716,13 @@ static int sfq_init(struct Qdisc *sch, s
 	int i;
 	int err;
 
+	setup_deferrable_timer(&q->perturb_timer, sfq_perturbation,
+			       (unsigned long)sch);
+
 	err = tcf_block_get(&q->block, &q->filter_list);
 	if (err)
 		return err;
 
-	setup_deferrable_timer(&q->perturb_timer, sfq_perturbation,
-			       (unsigned long)sch);
-
 	for (i = 0; i < SFQ_MAX_DEPTH + 1; i++) {
 		q->dep[i].next = i + SFQ_MAX_FLOWS;
 		q->dep[i].prev = i + SFQ_MAX_FLOWS;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sched/sch_tbf.c linux-libre-4.13-gnu/net/sched/sch_tbf.c
--- linux-libre-4.13-rc7-gnu/net/sched/sch_tbf.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sched/sch_tbf.c	2017-09-03 16:56:17.000000000 -0400
@@ -425,12 +425,13 @@ static int tbf_init(struct Qdisc *sch, s
 {
 	struct tbf_sched_data *q = qdisc_priv(sch);
 
+	qdisc_watchdog_init(&q->watchdog, sch);
+	q->qdisc = &noop_qdisc;
+
 	if (opt == NULL)
 		return -EINVAL;
 
 	q->t_c = ktime_get_ns();
-	qdisc_watchdog_init(&q->watchdog, sch);
-	q->qdisc = &noop_qdisc;
 
 	return tbf_change(sch, opt);
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sctp/sctp_diag.c linux-libre-4.13-gnu/net/sctp/sctp_diag.c
--- linux-libre-4.13-rc7-gnu/net/sctp/sctp_diag.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sctp/sctp_diag.c	2017-09-03 16:56:17.000000000 -0400
@@ -70,7 +70,8 @@ static int inet_diag_msg_sctpladdrs_fill
 
 	info = nla_data(attr);
 	list_for_each_entry_rcu(laddr, address_list, list) {
-		memcpy(info, &laddr->a, addrlen);
+		memcpy(info, &laddr->a, sizeof(laddr->a));
+		memset(info + sizeof(laddr->a), 0, addrlen - sizeof(laddr->a));
 		info += addrlen;
 	}
 
@@ -93,7 +94,9 @@ static int inet_diag_msg_sctpaddrs_fill(
 	info = nla_data(attr);
 	list_for_each_entry(from, &asoc->peer.transport_addr_list,
 			    transports) {
-		memcpy(info, &from->ipaddr, addrlen);
+		memcpy(info, &from->ipaddr, sizeof(from->ipaddr));
+		memset(info + sizeof(from->ipaddr), 0,
+		       addrlen - sizeof(from->ipaddr));
 		info += addrlen;
 	}
 
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/sctp/socket.c linux-libre-4.13-gnu/net/sctp/socket.c
--- linux-libre-4.13-rc7-gnu/net/sctp/socket.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/sctp/socket.c	2017-09-03 16:56:17.000000000 -0400
@@ -4538,8 +4538,7 @@ int sctp_get_sctp_info(struct sock *sk,
 	info->sctpi_ictrlchunks = asoc->stats.ictrlchunks;
 
 	prim = asoc->peer.primary_path;
-	memcpy(&info->sctpi_p_address, &prim->ipaddr,
-	       sizeof(struct sockaddr_storage));
+	memcpy(&info->sctpi_p_address, &prim->ipaddr, sizeof(prim->ipaddr));
 	info->sctpi_p_state = prim->state;
 	info->sctpi_p_cwnd = prim->cwnd;
 	info->sctpi_p_srtt = prim->srtt;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/tipc/bearer.c linux-libre-4.13-gnu/net/tipc/bearer.c
--- linux-libre-4.13-rc7-gnu/net/tipc/bearer.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/tipc/bearer.c	2017-09-03 16:56:17.000000000 -0400
@@ -65,6 +65,8 @@ static struct tipc_bearer *bearer_get(st
 }
 
 static void bearer_disable(struct net *net, struct tipc_bearer *b);
+static int tipc_l2_rcv_msg(struct sk_buff *skb, struct net_device *dev,
+			   struct packet_type *pt, struct net_device *orig_dev);
 
 /**
  * tipc_media_find - locates specified media object by name
@@ -428,6 +430,10 @@ int tipc_enable_l2_media(struct net *net
 
 	/* Associate TIPC bearer with L2 bearer */
 	rcu_assign_pointer(b->media_ptr, dev);
+	b->pt.dev = dev;
+	b->pt.type = htons(ETH_P_TIPC);
+	b->pt.func = tipc_l2_rcv_msg;
+	dev_add_pack(&b->pt);
 	memset(&b->bcast_addr, 0, sizeof(b->bcast_addr));
 	memcpy(b->bcast_addr.value, dev->broadcast, b->media->hwaddr_len);
 	b->bcast_addr.media_id = b->media->type_id;
@@ -447,6 +453,7 @@ void tipc_disable_l2_media(struct tipc_b
 	struct net_device *dev;
 
 	dev = (struct net_device *)rtnl_dereference(b->media_ptr);
+	dev_remove_pack(&b->pt);
 	RCU_INIT_POINTER(dev->tipc_ptr, NULL);
 	synchronize_net();
 	dev_put(dev);
@@ -594,11 +601,12 @@ static int tipc_l2_rcv_msg(struct sk_buf
 	struct tipc_bearer *b;
 
 	rcu_read_lock();
-	b = rcu_dereference_rtnl(dev->tipc_ptr);
+	b = rcu_dereference_rtnl(dev->tipc_ptr) ?:
+		rcu_dereference_rtnl(orig_dev->tipc_ptr);
 	if (likely(b && test_bit(0, &b->up) &&
 		   (skb->pkt_type <= PACKET_MULTICAST))) {
 		skb->next = NULL;
-		tipc_rcv(dev_net(dev), skb, b);
+		tipc_rcv(dev_net(b->pt.dev), skb, b);
 		rcu_read_unlock();
 		return NET_RX_SUCCESS;
 	}
@@ -659,11 +667,6 @@ static int tipc_l2_device_event(struct n
 	return NOTIFY_OK;
 }
 
-static struct packet_type tipc_packet_type __read_mostly = {
-	.type = htons(ETH_P_TIPC),
-	.func = tipc_l2_rcv_msg,
-};
-
 static struct notifier_block notifier = {
 	.notifier_call  = tipc_l2_device_event,
 	.priority	= 0,
@@ -671,19 +674,12 @@ static struct notifier_block notifier =
 
 int tipc_bearer_setup(void)
 {
-	int err;
-
-	err = register_netdevice_notifier(&notifier);
-	if (err)
-		return err;
-	dev_add_pack(&tipc_packet_type);
-	return 0;
+	return register_netdevice_notifier(&notifier);
 }
 
 void tipc_bearer_cleanup(void)
 {
 	unregister_netdevice_notifier(&notifier);
-	dev_remove_pack(&tipc_packet_type);
 }
 
 void tipc_bearer_stop(struct net *net)
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/tipc/bearer.h linux-libre-4.13-gnu/net/tipc/bearer.h
--- linux-libre-4.13-rc7-gnu/net/tipc/bearer.h	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/tipc/bearer.h	2017-09-03 16:56:17.000000000 -0400
@@ -131,6 +131,7 @@ struct tipc_media {
  * @name: bearer name (format = media:interface)
  * @media: ptr to media structure associated with bearer
  * @bcast_addr: media address used in broadcasting
+ * @pt: packet type for bearer
  * @rcu: rcu struct for tipc_bearer
  * @priority: default link priority for bearer
  * @window: default window size for bearer
@@ -151,6 +152,7 @@ struct tipc_bearer {
 	char name[TIPC_MAX_BEARER_NAME];
 	struct tipc_media *media;
 	struct tipc_media_addr bcast_addr;
+	struct packet_type pt;
 	struct rcu_head rcu;
 	u32 priority;
 	u32 window;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/tipc/msg.c linux-libre-4.13-gnu/net/tipc/msg.c
--- linux-libre-4.13-rc7-gnu/net/tipc/msg.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/tipc/msg.c	2017-09-03 16:56:17.000000000 -0400
@@ -479,13 +479,14 @@ bool tipc_msg_make_bundle(struct sk_buff
 bool tipc_msg_reverse(u32 own_node,  struct sk_buff **skb, int err)
 {
 	struct sk_buff *_skb = *skb;
-	struct tipc_msg *hdr = buf_msg(_skb);
+	struct tipc_msg *hdr;
 	struct tipc_msg ohdr;
-	int dlen = min_t(uint, msg_data_sz(hdr), MAX_FORWARD_SIZE);
+	int dlen;
 
 	if (skb_linearize(_skb))
 		goto exit;
 	hdr = buf_msg(_skb);
+	dlen = min_t(uint, msg_data_sz(hdr), MAX_FORWARD_SIZE);
 	if (msg_dest_droppable(hdr))
 		goto exit;
 	if (msg_errcode(hdr))
@@ -511,6 +512,8 @@ bool tipc_msg_reverse(u32 own_node,  str
 	    pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC))
 		goto exit;
 
+	/* reassign after skb header modifications */
+	hdr = buf_msg(_skb);
 	/* Now reverse the concerned fields */
 	msg_set_errcode(hdr, err);
 	msg_set_non_seq(hdr, 0);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/tipc/node.c linux-libre-4.13-gnu/net/tipc/node.c
--- linux-libre-4.13-rc7-gnu/net/tipc/node.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/tipc/node.c	2017-09-03 16:56:17.000000000 -0400
@@ -1126,8 +1126,8 @@ int tipc_node_get_linkname(struct net *n
 		strncpy(linkname, tipc_link_name(link), len);
 		err = 0;
 	}
-exit:
 	tipc_node_read_unlock(node);
+exit:
 	tipc_node_put(node);
 	return err;
 }
@@ -1557,6 +1557,8 @@ void tipc_rcv(struct net *net, struct sk
 
 	/* Check/update node state before receiving */
 	if (unlikely(skb)) {
+		if (unlikely(skb_linearize(skb)))
+			goto discard;
 		tipc_node_write_lock(n);
 		if (tipc_node_check_state(n, skb, bearer_id, &xmitq)) {
 			if (le->link) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/tipc/socket.c linux-libre-4.13-gnu/net/tipc/socket.c
--- linux-libre-4.13-rc7-gnu/net/tipc/socket.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/tipc/socket.c	2017-09-03 16:56:17.000000000 -0400
@@ -2255,8 +2255,8 @@ void tipc_sk_reinit(struct net *net)
 
 	do {
 		tsk = ERR_PTR(rhashtable_walk_start(&iter));
-		if (tsk)
-			continue;
+		if (IS_ERR(tsk))
+			goto walk_stop;
 
 		while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) {
 			spin_lock_bh(&tsk->sk.sk_lock.slock);
@@ -2265,7 +2265,7 @@ void tipc_sk_reinit(struct net *net)
 			msg_set_orignode(msg, tn->own_addr);
 			spin_unlock_bh(&tsk->sk.sk_lock.slock);
 		}
-
+walk_stop:
 		rhashtable_walk_stop(&iter);
 	} while (tsk == ERR_PTR(-EAGAIN));
 }
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/tipc/subscr.c linux-libre-4.13-gnu/net/tipc/subscr.c
--- linux-libre-4.13-rc7-gnu/net/tipc/subscr.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/tipc/subscr.c	2017-09-03 16:56:17.000000000 -0400
@@ -52,7 +52,6 @@ struct tipc_subscriber {
 	struct list_head subscrp_list;
 };
 
-static void tipc_subscrp_delete(struct tipc_subscription *sub);
 static void tipc_subscrb_put(struct tipc_subscriber *subscriber);
 
 /**
@@ -197,15 +196,19 @@ static void tipc_subscrb_subscrp_delete(
 {
 	struct list_head *subscription_list = &subscriber->subscrp_list;
 	struct tipc_subscription *sub, *temp;
+	u32 timeout;
 
 	spin_lock_bh(&subscriber->lock);
 	list_for_each_entry_safe(sub, temp, subscription_list,  subscrp_list) {
 		if (s && memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr)))
 			continue;
 
-		tipc_nametbl_unsubscribe(sub);
-		list_del(&sub->subscrp_list);
-		tipc_subscrp_delete(sub);
+		timeout = htohl(sub->evt.s.timeout, sub->swap);
+		if (timeout == TIPC_WAIT_FOREVER || del_timer(&sub->timer)) {
+			tipc_nametbl_unsubscribe(sub);
+			list_del(&sub->subscrp_list);
+			tipc_subscrp_put(sub);
+		}
 
 		if (s)
 			break;
@@ -236,18 +239,12 @@ static void tipc_subscrb_delete(struct t
 	tipc_subscrb_put(subscriber);
 }
 
-static void tipc_subscrp_delete(struct tipc_subscription *sub)
-{
-	u32 timeout = htohl(sub->evt.s.timeout, sub->swap);
-
-	if (timeout == TIPC_WAIT_FOREVER || del_timer(&sub->timer))
-		tipc_subscrp_put(sub);
-}
-
 static void tipc_subscrp_cancel(struct tipc_subscr *s,
 				struct tipc_subscriber *subscriber)
 {
+	tipc_subscrb_get(subscriber);
 	tipc_subscrb_subscrp_delete(subscriber, s);
+	tipc_subscrb_put(subscriber);
 }
 
 static struct tipc_subscription *tipc_subscrp_create(struct net *net,
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/xfrm/xfrm_policy.c linux-libre-4.13-gnu/net/xfrm/xfrm_policy.c
--- linux-libre-4.13-rc7-gnu/net/xfrm/xfrm_policy.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/xfrm/xfrm_policy.c	2017-09-03 16:56:17.000000000 -0400
@@ -2226,7 +2226,6 @@ struct dst_entry *xfrm_lookup(struct net
 				goto no_transform;
 			}
 
-			dst_hold(&xdst->u.dst);
 			route = xdst->route;
 		}
 	}
@@ -3308,9 +3307,15 @@ int xfrm_migrate(const struct xfrm_selec
 	struct xfrm_state *x_new[XFRM_MAX_DEPTH];
 	struct xfrm_migrate *mp;
 
+	/* Stage 0 - sanity checks */
 	if ((err = xfrm_migrate_check(m, num_migrate)) < 0)
 		goto out;
 
+	if (dir >= XFRM_POLICY_MAX) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	/* Stage 1 - find policy */
 	if ((pol = xfrm_migrate_policy_find(sel, dir, type, net)) == NULL) {
 		err = -ENOENT;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/xfrm/xfrm_state.c linux-libre-4.13-gnu/net/xfrm/xfrm_state.c
--- linux-libre-4.13-rc7-gnu/net/xfrm/xfrm_state.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/xfrm/xfrm_state.c	2017-09-03 16:56:17.000000000 -0400
@@ -1620,6 +1620,7 @@ int
 xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
 	       unsigned short family, struct net *net)
 {
+	int i;
 	int err = 0;
 	struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);
 	if (!afinfo)
@@ -1628,6 +1629,9 @@ xfrm_tmpl_sort(struct xfrm_tmpl **dst, s
 	spin_lock_bh(&net->xfrm.xfrm_state_lock); /*FIXME*/
 	if (afinfo->tmpl_sort)
 		err = afinfo->tmpl_sort(dst, src, n);
+	else
+		for (i = 0; i < n; i++)
+			dst[i] = src[i];
 	spin_unlock_bh(&net->xfrm.xfrm_state_lock);
 	rcu_read_unlock();
 	return err;
@@ -1638,6 +1642,7 @@ int
 xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
 		unsigned short family)
 {
+	int i;
 	int err = 0;
 	struct xfrm_state_afinfo *afinfo = xfrm_state_get_afinfo(family);
 	struct net *net = xs_net(*src);
@@ -1648,6 +1653,9 @@ xfrm_state_sort(struct xfrm_state **dst,
 	spin_lock_bh(&net->xfrm.xfrm_state_lock);
 	if (afinfo->state_sort)
 		err = afinfo->state_sort(dst, src, n);
+	else
+		for (i = 0; i < n; i++)
+			dst[i] = src[i];
 	spin_unlock_bh(&net->xfrm.xfrm_state_lock);
 	rcu_read_unlock();
 	return err;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/net/xfrm/xfrm_user.c linux-libre-4.13-gnu/net/xfrm/xfrm_user.c
--- linux-libre-4.13-rc7-gnu/net/xfrm/xfrm_user.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/net/xfrm/xfrm_user.c	2017-09-03 16:56:17.000000000 -0400
@@ -796,7 +796,7 @@ static int copy_user_offload(struct xfrm
 		return -EMSGSIZE;
 
 	xuo = nla_data(attr);
-
+	memset(xuo, 0, sizeof(*xuo));
 	xuo->ifindex = xso->dev->ifindex;
 	xuo->flags = xso->flags;
 
@@ -1869,6 +1869,7 @@ static int build_aevent(struct sk_buff *
 		return -EMSGSIZE;
 
 	id = nlmsg_data(nlh);
+	memset(&id->sa_id, 0, sizeof(id->sa_id));
 	memcpy(&id->sa_id.daddr, &x->id.daddr, sizeof(x->id.daddr));
 	id->sa_id.spi = x->id.spi;
 	id->sa_id.family = x->props.family;
@@ -2578,6 +2579,8 @@ static int build_expire(struct sk_buff *
 	ue = nlmsg_data(nlh);
 	copy_to_user_state(x, &ue->state);
 	ue->hard = (c->data.hard != 0) ? 1 : 0;
+	/* clear the padding bytes */
+	memset(&ue->hard + 1, 0, sizeof(*ue) - offsetofend(typeof(*ue), hard));
 
 	err = xfrm_mark_put(skb, &x->mark);
 	if (err)
@@ -2715,6 +2718,7 @@ static int xfrm_notify_sa(struct xfrm_st
 		struct nlattr *attr;
 
 		id = nlmsg_data(nlh);
+		memset(id, 0, sizeof(*id));
 		memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr));
 		id->spi = x->id.spi;
 		id->family = x->props.family;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/scripts/dtc/checks.c linux-libre-4.13-gnu/scripts/dtc/checks.c
--- linux-libre-4.13-rc7-gnu/scripts/dtc/checks.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/scripts/dtc/checks.c	2017-09-03 16:56:17.000000000 -0400
@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct
 	while (size--)
 		reg = (reg << 32) | fdt32_to_cpu(*(cells++));
 
-	snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);
+	snprintf(unit_addr, sizeof(unit_addr), "%llx", (unsigned long long)reg);
 	if (!streq(unitname, unit_addr))
 		FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
 		     node->fullpath, unit_addr);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/sound/core/pcm_native.c linux-libre-4.13-gnu/sound/core/pcm_native.c
--- linux-libre-4.13-rc7-gnu/sound/core/pcm_native.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/sound/core/pcm_native.c	2017-09-03 16:56:17.000000000 -0400
@@ -3064,6 +3064,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_
 {
 	snd_pcm_uframes_t *frames = arg;
 	snd_pcm_sframes_t result;
+	int err;
 	
 	switch (cmd) {
 	case SNDRV_PCM_IOCTL_FORWARD:
@@ -3083,7 +3084,10 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_
 	case SNDRV_PCM_IOCTL_START:
 		return snd_pcm_start_lock_irq(substream);
 	case SNDRV_PCM_IOCTL_DRAIN:
-		return snd_pcm_drain(substream, NULL);
+		snd_power_lock(substream->pcm->card);
+		err = snd_pcm_drain(substream, NULL);
+		snd_power_unlock(substream->pcm->card);
+		return err;
 	case SNDRV_PCM_IOCTL_DROP:
 		return snd_pcm_drop(substream);
 	case SNDRV_PCM_IOCTL_DELAY:
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/sound/soc/codecs/rt5670.c linux-libre-4.13-gnu/sound/soc/codecs/rt5670.c
--- linux-libre-4.13-rc7-gnu/sound/soc/codecs/rt5670.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/sound/soc/codecs/rt5670.c	2017-09-03 16:56:17.000000000 -0400
@@ -567,7 +567,7 @@ int rt5670_set_jack_detect(struct snd_so
 
 	rt5670->jack = jack;
 	rt5670->hp_gpio.gpiod_dev = codec->dev;
-	rt5670->hp_gpio.name = "headphone detect";
+	rt5670->hp_gpio.name = "headset";
 	rt5670->hp_gpio.report = SND_JACK_HEADSET |
 		SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2;
 	rt5670->hp_gpio.debounce_time = 150;
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/sound/soc/generic/simple-card-utils.c linux-libre-4.13-gnu/sound/soc/generic/simple-card-utils.c
--- linux-libre-4.13-rc7-gnu/sound/soc/generic/simple-card-utils.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/sound/soc/generic/simple-card-utils.c	2017-09-03 16:56:17.000000000 -0400
@@ -132,7 +132,7 @@ int asoc_simple_card_parse_card_name(str
 
 	/* Parse the card name from DT */
 	ret = snd_soc_of_parse_card_name(card, "label");
-	if (ret < 0) {
+	if (ret < 0 || !card->name) {
 		char prop[128];
 
 		snprintf(prop, sizeof(prop), "%sname", prefix);
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/sound/soc/intel/boards/cht_bsw_rt5672.c linux-libre-4.13-gnu/sound/soc/intel/boards/cht_bsw_rt5672.c
--- linux-libre-4.13-rc7-gnu/sound/soc/intel/boards/cht_bsw_rt5672.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/sound/soc/intel/boards/cht_bsw_rt5672.c	2017-09-03 16:56:17.000000000 -0400
@@ -184,6 +184,13 @@ static int cht_aif1_hw_params(struct snd
 	return 0;
 }
 
+static const struct acpi_gpio_params headset_gpios = { 0, 0, false };
+
+static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
+	{ "headset-gpios", &headset_gpios, 1 },
+	{},
+};
+
 static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 {
 	int ret;
@@ -191,6 +198,9 @@ static int cht_codec_init(struct snd_soc
 	struct snd_soc_codec *codec = codec_dai->codec;
 	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
 
+	if (devm_acpi_dev_add_driver_gpios(codec->dev, cht_rt5672_gpios))
+		dev_warn(runtime->dev, "Unable to add GPIO mapping table\n");
+
 	/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */
 	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24);
 	if (ret < 0) {
diff -druNp --no-dereference linux-libre-4.13-rc7-gnu/virt/kvm/kvm_main.c linux-libre-4.13-gnu/virt/kvm/kvm_main.c
--- linux-libre-4.13-rc7-gnu/virt/kvm/kvm_main.c	2017-08-27 20:20:40.000000000 -0400
+++ linux-libre-4.13-gnu/virt/kvm/kvm_main.c	2017-09-03 16:56:17.000000000 -0400
@@ -322,47 +322,6 @@ static inline struct kvm *mmu_notifier_t
 	return container_of(mn, struct kvm, mmu_notifier);
 }
 
-static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
-					     struct mm_struct *mm,
-					     unsigned long address)
-{
-	struct kvm *kvm = mmu_notifier_to_kvm(mn);
-	int need_tlb_flush, idx;
-
-	/*
-	 * When ->invalidate_page runs, the linux pte has been zapped
-	 * already but the page is still allocated until
-	 * ->invalidate_page returns. So if we increase the sequence
-	 * here the kvm page fault will notice if the spte can't be
-	 * established because the page is going to be freed. If
-	 * instead the kvm page fault establishes the spte before
-	 * ->invalidate_page runs, kvm_unmap_hva will release it
-	 * before returning.
-	 *
-	 * The sequence increase only need to be seen at spin_unlock
-	 * time, and not at spin_lock time.
-	 *
-	 * Increasing the sequence after the spin_unlock would be
-	 * unsafe because the kvm page fault could then establish the
-	 * pte after kvm_unmap_hva returned, without noticing the page
-	 * is going to be freed.
-	 */
-	idx = srcu_read_lock(&kvm->srcu);
-	spin_lock(&kvm->mmu_lock);
-
-	kvm->mmu_notifier_seq++;
-	need_tlb_flush = kvm_unmap_hva(kvm, address) | kvm->tlbs_dirty;
-	/* we've to flush the tlb before the pages can be freed */
-	if (need_tlb_flush)
-		kvm_flush_remote_tlbs(kvm);
-
-	spin_unlock(&kvm->mmu_lock);
-
-	kvm_arch_mmu_notifier_invalidate_page(kvm, address);
-
-	srcu_read_unlock(&kvm->srcu, idx);
-}
-
 static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
 					struct mm_struct *mm,
 					unsigned long address,
@@ -510,7 +469,6 @@ static void kvm_mmu_notifier_release(str
 }
 
 static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
-	.invalidate_page	= kvm_mmu_notifier_invalidate_page,
 	.invalidate_range_start	= kvm_mmu_notifier_invalidate_range_start,
 	.invalidate_range_end	= kvm_mmu_notifier_invalidate_range_end,
 	.clear_flush_young	= kvm_mmu_notifier_clear_flush_young,
