diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/alpha/include/asm/xchg.h linux-libre-4.4.134-gnu/arch/alpha/include/asm/xchg.h
--- linux-libre-4.4.133-gnu/arch/alpha/include/asm/xchg.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/alpha/include/asm/xchg.h	2018-05-30 01:49:18.000000000 -0400
@@ -11,6 +11,10 @@
  * Atomic exchange.
  * Since it can be used to implement critical sections
  * it must clobber "memory" (also for interrupts in UP).
+ *
+ * The leading and the trailing memory barriers guarantee that these
+ * operations are fully ordered.
+ *
  */
 
 static inline unsigned long
@@ -18,6 +22,7 @@ ____xchg(_u8, volatile char *m, unsigned
 {
 	unsigned long ret, tmp, addr64;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"	andnot	%4,7,%3\n"
 	"	insbl	%1,%4,%1\n"
@@ -42,6 +47,7 @@ ____xchg(_u16, volatile short *m, unsign
 {
 	unsigned long ret, tmp, addr64;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"	andnot	%4,7,%3\n"
 	"	inswl	%1,%4,%1\n"
@@ -66,6 +72,7 @@ ____xchg(_u32, volatile int *m, unsigned
 {
 	unsigned long dummy;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"1:	ldl_l %0,%4\n"
 	"	bis $31,%3,%1\n"
@@ -86,6 +93,7 @@ ____xchg(_u64, volatile long *m, unsigne
 {
 	unsigned long dummy;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"1:	ldq_l %0,%4\n"
 	"	bis $31,%3,%1\n"
@@ -127,10 +135,12 @@ ____xchg(, volatile void *ptr, unsigned
  * store NEW in MEM.  Return the initial value in MEM.  Success is
  * indicated by comparing RETURN with OLD.
  *
- * The memory barrier should be placed in SMP only when we actually
- * make the change. If we don't change anything (so if the returned
- * prev is equal to old) then we aren't acquiring anything new and
- * we don't need any memory barrier as far I can tell.
+ * The leading and the trailing memory barriers guarantee that these
+ * operations are fully ordered.
+ *
+ * The trailing memory barrier is placed in SMP unconditionally, in
+ * order to guarantee that dependency ordering is preserved when a
+ * dependency is headed by an unsuccessful operation.
  */
 
 static inline unsigned long
@@ -138,6 +148,7 @@ ____cmpxchg(_u8, volatile char *m, unsig
 {
 	unsigned long prev, tmp, cmp, addr64;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"	andnot	%5,7,%4\n"
 	"	insbl	%1,%5,%1\n"
@@ -149,8 +160,8 @@ ____cmpxchg(_u8, volatile char *m, unsig
 	"	or	%1,%2,%2\n"
 	"	stq_c	%2,0(%4)\n"
 	"	beq	%2,3f\n"
-		__ASM__MB
 	"2:\n"
+		__ASM__MB
 	".subsection 2\n"
 	"3:	br	1b\n"
 	".previous"
@@ -165,6 +176,7 @@ ____cmpxchg(_u16, volatile short *m, uns
 {
 	unsigned long prev, tmp, cmp, addr64;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"	andnot	%5,7,%4\n"
 	"	inswl	%1,%5,%1\n"
@@ -176,8 +188,8 @@ ____cmpxchg(_u16, volatile short *m, uns
 	"	or	%1,%2,%2\n"
 	"	stq_c	%2,0(%4)\n"
 	"	beq	%2,3f\n"
-		__ASM__MB
 	"2:\n"
+		__ASM__MB
 	".subsection 2\n"
 	"3:	br	1b\n"
 	".previous"
@@ -192,6 +204,7 @@ ____cmpxchg(_u32, volatile int *m, int o
 {
 	unsigned long prev, cmp;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"1:	ldl_l %0,%5\n"
 	"	cmpeq %0,%3,%1\n"
@@ -199,8 +212,8 @@ ____cmpxchg(_u32, volatile int *m, int o
 	"	mov %4,%1\n"
 	"	stl_c %1,%2\n"
 	"	beq %1,3f\n"
-		__ASM__MB
 	"2:\n"
+		__ASM__MB
 	".subsection 2\n"
 	"3:	br 1b\n"
 	".previous"
@@ -215,6 +228,7 @@ ____cmpxchg(_u64, volatile long *m, unsi
 {
 	unsigned long prev, cmp;
 
+	smp_mb();
 	__asm__ __volatile__(
 	"1:	ldq_l %0,%5\n"
 	"	cmpeq %0,%3,%1\n"
@@ -222,8 +236,8 @@ ____cmpxchg(_u64, volatile long *m, unsi
 	"	mov %4,%1\n"
 	"	stq_c %1,%2\n"
 	"	beq %1,3f\n"
-		__ASM__MB
 	"2:\n"
+		__ASM__MB
 	".subsection 2\n"
 	"3:	br 1b\n"
 	".previous"
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arc/Kconfig linux-libre-4.4.134-gnu/arch/arc/Kconfig
--- linux-libre-4.4.133-gnu/arch/arc/Kconfig	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arc/Kconfig	2018-05-30 01:49:18.000000000 -0400
@@ -479,7 +479,6 @@ config ARC_CURR_IN_REG
 
 config ARC_EMUL_UNALIGNED
 	bool "Emulate unaligned memory access (userspace only)"
-	default N
 	select SYSCTL_ARCH_UNALIGN_NO_WARN
 	select SYSCTL_ARCH_UNALIGN_ALLOW
 	depends on ISA_ARCOMPACT
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/boot/dts/socfpga.dtsi linux-libre-4.4.134-gnu/arch/arm/boot/dts/socfpga.dtsi
--- linux-libre-4.4.133-gnu/arch/arm/boot/dts/socfpga.dtsi	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/boot/dts/socfpga.dtsi	2018-05-30 01:49:18.000000000 -0400
@@ -738,7 +738,7 @@
 		timer@fffec600 {
 			compatible = "arm,cortex-a9-twd-timer";
 			reg = <0xfffec600 0x100>;
-			interrupts = <1 13 0xf04>;
+			interrupts = <1 13 0xf01>;
 			clocks = <&mpu_periph_clk>;
 		};
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/include/asm/vdso.h linux-libre-4.4.134-gnu/arch/arm/include/asm/vdso.h
--- linux-libre-4.4.133-gnu/arch/arm/include/asm/vdso.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/include/asm/vdso.h	2018-05-30 01:49:18.000000000 -0400
@@ -11,8 +11,6 @@ struct mm_struct;
 
 void arm_install_vdso(struct mm_struct *mm, unsigned long addr);
 
-extern char vdso_start, vdso_end;
-
 extern unsigned int vdso_total_pages;
 
 #else /* CONFIG_VDSO */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/kernel/vdso.c linux-libre-4.4.134-gnu/arch/arm/kernel/vdso.c
--- linux-libre-4.4.133-gnu/arch/arm/kernel/vdso.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/kernel/vdso.c	2018-05-30 01:49:18.000000000 -0400
@@ -38,6 +38,8 @@
 
 static struct page **vdso_text_pagelist;
 
+extern char vdso_start[], vdso_end[];
+
 /* Total number of pages needed for the data and text portions of the VDSO. */
 unsigned int vdso_total_pages __read_mostly;
 
@@ -178,13 +180,13 @@ static int __init vdso_init(void)
 	unsigned int text_pages;
 	int i;
 
-	if (memcmp(&vdso_start, "\177ELF", 4)) {
+	if (memcmp(vdso_start, "\177ELF", 4)) {
 		pr_err("VDSO is not a valid ELF object!\n");
 		return -ENOEXEC;
 	}
 
-	text_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT;
-	pr_debug("vdso: %i text pages at base %p\n", text_pages, &vdso_start);
+	text_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
+	pr_debug("vdso: %i text pages at base %p\n", text_pages, vdso_start);
 
 	/* Allocate the VDSO text pagelist */
 	vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *),
@@ -199,7 +201,7 @@ static int __init vdso_init(void)
 	for (i = 0; i < text_pages; i++) {
 		struct page *page;
 
-		page = virt_to_page(&vdso_start + i * PAGE_SIZE);
+		page = virt_to_page(vdso_start + i * PAGE_SIZE);
 		vdso_text_pagelist[i] = page;
 	}
 
@@ -210,7 +212,7 @@ static int __init vdso_init(void)
 
 	cntvct_ok = cntvct_functional();
 
-	patch_vdso(&vdso_start);
+	patch_vdso(vdso_start);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/mach-omap1/clock.c linux-libre-4.4.134-gnu/arch/arm/mach-omap1/clock.c
--- linux-libre-4.4.133-gnu/arch/arm/mach-omap1/clock.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/mach-omap1/clock.c	2018-05-30 01:49:18.000000000 -0400
@@ -1031,17 +1031,17 @@ static int clk_debugfs_register_one(stru
 		return -ENOMEM;
 	c->dent = d;
 
-	d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
+	d = debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount);
 	if (!d) {
 		err = -ENOMEM;
 		goto err_out;
 	}
-	d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
+	d = debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate);
 	if (!d) {
 		err = -ENOMEM;
 		goto err_out;
 	}
-	d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
+	d = debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags);
 	if (!d) {
 		err = -ENOMEM;
 		goto err_out;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/mach-omap2/pm.c linux-libre-4.4.134-gnu/arch/arm/mach-omap2/pm.c
--- linux-libre-4.4.133-gnu/arch/arm/mach-omap2/pm.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/mach-omap2/pm.c	2018-05-30 01:49:18.000000000 -0400
@@ -231,7 +231,7 @@ static void omap_pm_end(void)
 	cpu_idle_poll_ctrl(false);
 }
 
-static void omap_pm_finish(void)
+static void omap_pm_wake(void)
 {
 	if (cpu_is_omap34xx())
 		omap_prcm_irq_complete();
@@ -241,7 +241,7 @@ static const struct platform_suspend_ops
 	.begin		= omap_pm_begin,
 	.end		= omap_pm_end,
 	.enter		= omap_pm_enter,
-	.finish		= omap_pm_finish,
+	.wake		= omap_pm_wake,
 	.valid		= suspend_valid_only_mem,
 };
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/mach-omap2/timer.c linux-libre-4.4.134-gnu/arch/arm/mach-omap2/timer.c
--- linux-libre-4.4.133-gnu/arch/arm/mach-omap2/timer.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/mach-omap2/timer.c	2018-05-30 01:49:18.000000000 -0400
@@ -136,12 +136,6 @@ static struct clock_event_device clockev
 	.tick_resume		= omap2_gp_timer_shutdown,
 };
 
-static struct property device_disabled = {
-	.name = "status",
-	.length = sizeof("disabled"),
-	.value = "disabled",
-};
-
 static const struct of_device_id omap_timer_match[] __initconst = {
 	{ .compatible = "ti,omap2420-timer", },
 	{ .compatible = "ti,omap3430-timer", },
@@ -183,8 +177,17 @@ static struct device_node * __init omap_
 				  of_get_property(np, "ti,timer-secure", NULL)))
 			continue;
 
-		if (!of_device_is_compatible(np, "ti,omap-counter32k"))
-			of_add_property(np, &device_disabled);
+		if (!of_device_is_compatible(np, "ti,omap-counter32k")) {
+			struct property *prop;
+
+			prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+			if (!prop)
+				return NULL;
+			prop->name = "status";
+			prop->value = "disabled";
+			prop->length = strlen(prop->value);
+			of_add_property(np, prop);
+		}
 		return np;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm/plat-omap/dmtimer.c linux-libre-4.4.134-gnu/arch/arm/plat-omap/dmtimer.c
--- linux-libre-4.4.133-gnu/arch/arm/plat-omap/dmtimer.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm/plat-omap/dmtimer.c	2018-05-30 01:49:18.000000000 -0400
@@ -854,11 +854,8 @@ static int omap_dm_timer_probe(struct pl
 	timer->irq = irq->start;
 	timer->pdev = pdev;
 
-	/* Skip pm_runtime_enable for OMAP1 */
-	if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
-		pm_runtime_enable(dev);
-		pm_runtime_irq_safe(dev);
-	}
+	pm_runtime_enable(dev);
+	pm_runtime_irq_safe(dev);
 
 	if (!timer->reserved) {
 		ret = pm_runtime_get_sync(dev);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/arm64/include/asm/spinlock.h linux-libre-4.4.134-gnu/arch/arm64/include/asm/spinlock.h
--- linux-libre-4.4.133-gnu/arch/arm64/include/asm/spinlock.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/arm64/include/asm/spinlock.h	2018-05-30 01:49:18.000000000 -0400
@@ -94,8 +94,8 @@ static inline int arch_spin_trylock(arch
 	"	cbnz	%w1, 1f\n"
 	"	add	%w1, %w0, %3\n"
 	"	casa	%w0, %w1, %2\n"
-	"	and	%w1, %w1, #0xffff\n"
-	"	eor	%w1, %w1, %w0, lsr #16\n"
+	"	sub	%w1, %w1, %3\n"
+	"	eor	%w1, %w1, %w0\n"
 	"1:")
 	: "=&r" (lockval), "=&r" (tmp), "+Q" (*lock)
 	: "I" (1 << TICKET_SHIFT)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/m68k/coldfire/device.c linux-libre-4.4.134-gnu/arch/m68k/coldfire/device.c
--- linux-libre-4.4.133-gnu/arch/m68k/coldfire/device.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/m68k/coldfire/device.c	2018-05-30 01:49:18.000000000 -0400
@@ -135,7 +135,11 @@ static struct platform_device mcf_fec0 =
 	.id			= 0,
 	.num_resources		= ARRAY_SIZE(mcf_fec0_resources),
 	.resource		= mcf_fec0_resources,
-	.dev.platform_data	= FEC_PDATA,
+	.dev = {
+		.dma_mask		= &mcf_fec0.dev.coherent_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+		.platform_data		= FEC_PDATA,
+	}
 };
 
 #ifdef MCFFEC_BASE1
@@ -167,7 +171,11 @@ static struct platform_device mcf_fec1 =
 	.id			= 1,
 	.num_resources		= ARRAY_SIZE(mcf_fec1_resources),
 	.resource		= mcf_fec1_resources,
-	.dev.platform_data	= FEC_PDATA,
+	.dev = {
+		.dma_mask		= &mcf_fec1.dev.coherent_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+		.platform_data		= FEC_PDATA,
+	}
 };
 #endif /* MCFFEC_BASE1 */
 #endif /* CONFIG_FEC */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/mips/cavium-octeon/octeon-irq.c linux-libre-4.4.134-gnu/arch/mips/cavium-octeon/octeon-irq.c
--- linux-libre-4.4.133-gnu/arch/mips/cavium-octeon/octeon-irq.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/mips/cavium-octeon/octeon-irq.c	2018-05-30 01:49:18.000000000 -0400
@@ -2240,7 +2240,7 @@ static int __init octeon_irq_init_cib(st
 
 	parent_irq = irq_of_parse_and_map(ciu_node, 0);
 	if (!parent_irq) {
-		pr_err("ERROR: Couldn't acquire parent_irq for %s\n.",
+		pr_err("ERROR: Couldn't acquire parent_irq for %s\n",
 			ciu_node->name);
 		return -EINVAL;
 	}
@@ -2252,7 +2252,7 @@ static int __init octeon_irq_init_cib(st
 
 	addr = of_get_address(ciu_node, 0, NULL, NULL);
 	if (!addr) {
-		pr_err("ERROR: Couldn't acquire reg(0) %s\n.", ciu_node->name);
+		pr_err("ERROR: Couldn't acquire reg(0) %s\n", ciu_node->name);
 		return -EINVAL;
 	}
 	host_data->raw_reg = (u64)phys_to_virt(
@@ -2260,7 +2260,7 @@ static int __init octeon_irq_init_cib(st
 
 	addr = of_get_address(ciu_node, 1, NULL, NULL);
 	if (!addr) {
-		pr_err("ERROR: Couldn't acquire reg(1) %s\n.", ciu_node->name);
+		pr_err("ERROR: Couldn't acquire reg(1) %s\n", ciu_node->name);
 		return -EINVAL;
 	}
 	host_data->en_reg = (u64)phys_to_virt(
@@ -2268,7 +2268,7 @@ static int __init octeon_irq_init_cib(st
 
 	r = of_property_read_u32(ciu_node, "cavium,max-bits", &val);
 	if (r) {
-		pr_err("ERROR: Couldn't read cavium,max-bits from %s\n.",
+		pr_err("ERROR: Couldn't read cavium,max-bits from %s\n",
 			ciu_node->name);
 		return r;
 	}
@@ -2278,7 +2278,7 @@ static int __init octeon_irq_init_cib(st
 					   &octeon_irq_domain_cib_ops,
 					   host_data);
 	if (!cib_domain) {
-		pr_err("ERROR: Couldn't irq_domain_add_linear()\n.");
+		pr_err("ERROR: Couldn't irq_domain_add_linear()\n");
 		return -ENOMEM;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/mips/include/asm/mach-ath79/ar71xx_regs.h linux-libre-4.4.134-gnu/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
--- linux-libre-4.4.133-gnu/arch/mips/include/asm/mach-ath79/ar71xx_regs.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/mips/include/asm/mach-ath79/ar71xx_regs.h	2018-05-30 01:49:18.000000000 -0400
@@ -167,7 +167,7 @@
 #define AR71XX_AHB_DIV_MASK		0x7
 
 #define AR724X_PLL_REG_CPU_CONFIG	0x00
-#define AR724X_PLL_REG_PCIE_CONFIG	0x18
+#define AR724X_PLL_REG_PCIE_CONFIG	0x10
 
 #define AR724X_PLL_FB_SHIFT		0
 #define AR724X_PLL_FB_MASK		0x3ff
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/mips/kernel/ptrace32.c linux-libre-4.4.134-gnu/arch/mips/kernel/ptrace32.c
--- linux-libre-4.4.133-gnu/arch/mips/kernel/ptrace32.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/mips/kernel/ptrace32.c	2018-05-30 01:49:18.000000000 -0400
@@ -97,7 +97,7 @@ long compat_arch_ptrace(struct task_stru
 				break;
 			}
 			fregs = get_fpu_regs(child);
-			if (test_thread_flag(TIF_32BIT_FPREGS)) {
+			if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) {
 				/*
 				 * The odd registers are actually the high
 				 * order bits of the values stored in the even
@@ -203,7 +203,7 @@ long compat_arch_ptrace(struct task_stru
 				       sizeof(child->thread.fpu));
 				child->thread.fpu.fcr31 = 0;
 			}
-			if (test_thread_flag(TIF_32BIT_FPREGS)) {
+			if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) {
 				/*
 				 * The odd registers are actually the high
 				 * order bits of the values stored in the even
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/mips/kernel/ptrace.c linux-libre-4.4.134-gnu/arch/mips/kernel/ptrace.c
--- linux-libre-4.4.133-gnu/arch/mips/kernel/ptrace.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/mips/kernel/ptrace.c	2018-05-30 01:49:18.000000000 -0400
@@ -483,7 +483,7 @@ static int fpr_get_msa(struct task_struc
 /*
  * Copy the floating-point context to the supplied NT_PRFPREG buffer.
  * Choose the appropriate helper for general registers, and then copy
- * the FCSR register separately.
+ * the FCSR and FIR registers separately.
  */
 static int fpr_get(struct task_struct *target,
 		   const struct user_regset *regset,
@@ -491,6 +491,7 @@ static int fpr_get(struct task_struct *t
 		   void *kbuf, void __user *ubuf)
 {
 	const int fcr31_pos = NUM_FPU_REGS * sizeof(elf_fpreg_t);
+	const int fir_pos = fcr31_pos + sizeof(u32);
 	int err;
 
 	if (sizeof(target->thread.fpu.fpr[0]) == sizeof(elf_fpreg_t))
@@ -503,6 +504,12 @@ static int fpr_get(struct task_struct *t
 	err = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 				  &target->thread.fpu.fcr31,
 				  fcr31_pos, fcr31_pos + sizeof(u32));
+	if (err)
+		return err;
+
+	err = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
+				  &boot_cpu_data.fpu_id,
+				  fir_pos, fir_pos + sizeof(u32));
 
 	return err;
 }
@@ -551,7 +558,8 @@ static int fpr_set_msa(struct task_struc
 /*
  * Copy the supplied NT_PRFPREG buffer to the floating-point context.
  * Choose the appropriate helper for general registers, and then copy
- * the FCSR register separately.
+ * the FCSR register separately.  Ignore the incoming FIR register
+ * contents though, as the register is read-only.
  *
  * We optimize for the case where `count % sizeof(elf_fpreg_t) == 0',
  * which is supposed to have been guaranteed by the kernel before
@@ -565,6 +573,7 @@ static int fpr_set(struct task_struct *t
 		   const void *kbuf, const void __user *ubuf)
 {
 	const int fcr31_pos = NUM_FPU_REGS * sizeof(elf_fpreg_t);
+	const int fir_pos = fcr31_pos + sizeof(u32);
 	u32 fcr31;
 	int err;
 
@@ -592,6 +601,11 @@ static int fpr_set(struct task_struct *t
 		ptrace_setfcr31(target, fcr31);
 	}
 
+	if (count > 0)
+		err = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
+						fir_pos,
+						fir_pos + sizeof(u32));
+
 	return err;
 }
 
@@ -816,7 +830,7 @@ long arch_ptrace(struct task_struct *chi
 			fregs = get_fpu_regs(child);
 
 #ifdef CONFIG_32BIT
-			if (test_thread_flag(TIF_32BIT_FPREGS)) {
+			if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) {
 				/*
 				 * The odd registers are actually the high
 				 * order bits of the values stored in the even
@@ -905,7 +919,7 @@ long arch_ptrace(struct task_struct *chi
 
 			init_fp_ctx(child);
 #ifdef CONFIG_32BIT
-			if (test_thread_flag(TIF_32BIT_FPREGS)) {
+			if (test_tsk_thread_flag(child, TIF_32BIT_FPREGS)) {
 				/*
 				 * The odd registers are actually the high
 				 * order bits of the values stored in the even
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/mips/kvm/mips.c linux-libre-4.4.134-gnu/arch/mips/kvm/mips.c
--- linux-libre-4.4.133-gnu/arch/mips/kvm/mips.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/mips/kvm/mips.c	2018-05-30 01:49:18.000000000 -0400
@@ -40,7 +40,7 @@ struct kvm_stats_debugfs_item debugfs_en
 	{ "cache",	  VCPU_STAT(cache_exits),	 KVM_STAT_VCPU },
 	{ "signal",	  VCPU_STAT(signal_exits),	 KVM_STAT_VCPU },
 	{ "interrupt",	  VCPU_STAT(int_exits),		 KVM_STAT_VCPU },
-	{ "cop_unsuable", VCPU_STAT(cop_unusable_exits), KVM_STAT_VCPU },
+	{ "cop_unusable", VCPU_STAT(cop_unusable_exits), KVM_STAT_VCPU },
 	{ "tlbmod",	  VCPU_STAT(tlbmod_exits),	 KVM_STAT_VCPU },
 	{ "tlbmiss_ld",	  VCPU_STAT(tlbmiss_ld_exits),	 KVM_STAT_VCPU },
 	{ "tlbmiss_st",	  VCPU_STAT(tlbmiss_st_exits),	 KVM_STAT_VCPU },
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/mips/txx9/rbtx4939/setup.c linux-libre-4.4.134-gnu/arch/mips/txx9/rbtx4939/setup.c
--- linux-libre-4.4.133-gnu/arch/mips/txx9/rbtx4939/setup.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/mips/txx9/rbtx4939/setup.c	2018-05-30 01:49:18.000000000 -0400
@@ -186,7 +186,7 @@ static void __init rbtx4939_update_ioc_p
 
 #define RBTX4939_MAX_7SEGLEDS	8
 
-#if IS_ENABLED(CONFIG_LEDS_CLASS)
+#if IS_BUILTIN(CONFIG_LEDS_CLASS)
 static u8 led_val[RBTX4939_MAX_7SEGLEDS];
 struct rbtx4939_led_data {
 	struct led_classdev cdev;
@@ -261,7 +261,7 @@ static inline void rbtx4939_led_setup(vo
 
 static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val)
 {
-#if IS_ENABLED(CONFIG_LEDS_CLASS)
+#if IS_BUILTIN(CONFIG_LEDS_CLASS)
 	unsigned long flags;
 	local_irq_save(flags);
 	/* bit7: reserved for LED class */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/powerpc/include/asm/irq_work.h linux-libre-4.4.134-gnu/arch/powerpc/include/asm/irq_work.h
--- linux-libre-4.4.133-gnu/arch/powerpc/include/asm/irq_work.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/powerpc/include/asm/irq_work.h	2018-05-30 01:49:18.000000000 -0400
@@ -5,5 +5,6 @@ static inline bool arch_irq_work_has_int
 {
 	return true;
 }
+extern void arch_irq_work_raise(void);
 
 #endif /* _ASM_POWERPC_IRQ_WORK_H */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/powerpc/kvm/book3s_hv.c linux-libre-4.4.134-gnu/arch/powerpc/kvm/book3s_hv.c
--- linux-libre-4.4.133-gnu/arch/powerpc/kvm/book3s_hv.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/powerpc/kvm/book3s_hv.c	2018-05-30 01:49:18.000000000 -0400
@@ -3002,15 +3002,17 @@ static int kvmppc_hv_setup_htab_rma(stru
 		goto up_out;
 
 	psize = vma_kernel_pagesize(vma);
-	porder = __ilog2(psize);
 
 	up_read(&current->mm->mmap_sem);
 
 	/* We can handle 4k, 64k or 16M pages in the VRMA */
-	err = -EINVAL;
-	if (!(psize == 0x1000 || psize == 0x10000 ||
-	      psize == 0x1000000))
-		goto out_srcu;
+	if (psize >= 0x1000000)
+		psize = 0x1000000;
+	else if (psize >= 0x10000)
+		psize = 0x10000;
+	else
+		psize = 0x1000;
+	porder = __ilog2(psize);
 
 	/* Update VRMASD field in the LPCR */
 	senc = slb_pgsize_encoding(psize);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/powerpc/mm/numa.c linux-libre-4.4.134-gnu/arch/powerpc/mm/numa.c
--- linux-libre-4.4.133-gnu/arch/powerpc/mm/numa.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/powerpc/mm/numa.c	2018-05-30 01:49:18.000000000 -0400
@@ -551,7 +551,7 @@ static int numa_setup_cpu(unsigned long
 	nid = of_node_to_nid_single(cpu);
 
 out_present:
-	if (nid < 0 || !node_online(nid))
+	if (nid < 0 || !node_possible(nid))
 		nid = first_online_node;
 
 	map_cpu_to_node(lcpu, nid);
@@ -951,6 +951,32 @@ static void __init setup_node_data(int n
 	NODE_DATA(nid)->node_spanned_pages = spanned_pages;
 }
 
+static void __init find_possible_nodes(void)
+{
+	struct device_node *rtas;
+	u32 numnodes, i;
+
+	if (min_common_depth <= 0)
+		return;
+
+	rtas = of_find_node_by_path("/rtas");
+	if (!rtas)
+		return;
+
+	if (of_property_read_u32_index(rtas,
+				"ibm,max-associativity-domains",
+				min_common_depth, &numnodes))
+		goto out;
+
+	for (i = 0; i < numnodes; i++) {
+		if (!node_possible(i))
+			node_set(i, node_possible_map);
+	}
+
+out:
+	of_node_put(rtas);
+}
+
 void __init initmem_init(void)
 {
 	int nid, cpu;
@@ -966,12 +992,15 @@ void __init initmem_init(void)
 	memblock_dump_all();
 
 	/*
-	 * Reduce the possible NUMA nodes to the online NUMA nodes,
-	 * since we do not support node hotplug. This ensures that  we
-	 * lower the maximum NUMA node ID to what is actually present.
+	 * Modify the set of possible NUMA nodes to reflect information
+	 * available about the set of online nodes, and the set of nodes
+	 * that we expect to make use of for this platform's affinity
+	 * calculations.
 	 */
 	nodes_and(node_possible_map, node_possible_map, node_online_map);
 
+	find_possible_nodes();
+
 	for_each_online_node(nid) {
 		unsigned long start_pfn, end_pfn;
 
@@ -1304,6 +1333,40 @@ static long vphn_get_associativity(unsig
 	return rc;
 }
 
+static inline int find_and_online_cpu_nid(int cpu)
+{
+	__be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
+	int new_nid;
+
+	/* Use associativity from first thread for all siblings */
+	vphn_get_associativity(cpu, associativity);
+	new_nid = associativity_to_nid(associativity);
+	if (new_nid < 0 || !node_possible(new_nid))
+		new_nid = first_online_node;
+
+	if (NODE_DATA(new_nid) == NULL) {
+#ifdef CONFIG_MEMORY_HOTPLUG
+		/*
+		 * Need to ensure that NODE_DATA is initialized for a node from
+		 * available memory (see memblock_alloc_try_nid). If unable to
+		 * init the node, then default to nearest node that has memory
+		 * installed.
+		 */
+		if (try_online_node(new_nid))
+			new_nid = first_online_node;
+#else
+		/*
+		 * Default to using the nearest node that has memory installed.
+		 * Otherwise, it would be necessary to patch the kernel MM code
+		 * to deal with more memoryless-node error conditions.
+		 */
+		new_nid = first_online_node;
+#endif
+	}
+
+	return new_nid;
+}
+
 /*
  * Update the CPU maps and sysfs entries for a single CPU when its NUMA
  * characteristics change. This function doesn't perform any locking and is
@@ -1369,7 +1432,6 @@ int arch_update_cpu_topology(void)
 {
 	unsigned int cpu, sibling, changed = 0;
 	struct topology_update_data *updates, *ud;
-	__be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
 	cpumask_t updated_cpus;
 	struct device *dev;
 	int weight, new_nid, i = 0;
@@ -1404,11 +1466,7 @@ int arch_update_cpu_topology(void)
 			continue;
 		}
 
-		/* Use associativity from first thread for all siblings */
-		vphn_get_associativity(cpu, associativity);
-		new_nid = associativity_to_nid(associativity);
-		if (new_nid < 0 || !node_online(new_nid))
-			new_nid = first_online_node;
+		new_nid = find_and_online_cpu_nid(cpu);
 
 		if (new_nid == numa_cpu_lookup_table[cpu]) {
 			cpumask_andnot(&cpu_associativity_changes_mask,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/powerpc/net/bpf_jit_comp.c linux-libre-4.4.134-gnu/arch/powerpc/net/bpf_jit_comp.c
--- linux-libre-4.4.133-gnu/arch/powerpc/net/bpf_jit_comp.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/powerpc/net/bpf_jit_comp.c	2018-05-30 01:49:18.000000000 -0400
@@ -329,6 +329,9 @@ static int bpf_jit_build_body(struct bpf
 			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
 			PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, len));
 			break;
+		case BPF_LDX | BPF_W | BPF_ABS: /* A = *((u32 *)(seccomp_data + K)); */
+			PPC_LWZ_OFFS(r_A, r_skb, K);
+			break;
 		case BPF_LDX | BPF_W | BPF_LEN: /* X = skb->len; */
 			PPC_LWZ_OFFS(r_X, r_skb, offsetof(struct sk_buff, len));
 			break;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/powerpc/perf/core-book3s.c linux-libre-4.4.134-gnu/arch/powerpc/perf/core-book3s.c
--- linux-libre-4.4.133-gnu/arch/powerpc/perf/core-book3s.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/powerpc/perf/core-book3s.c	2018-05-30 01:49:18.000000000 -0400
@@ -448,6 +448,16 @@ static void power_pmu_bhrb_read(struct c
 				/* invalid entry */
 				continue;
 
+			/*
+			 * BHRB rolling buffer could very much contain the kernel
+			 * addresses at this point. Check the privileges before
+			 * exporting it to userspace (avoid exposure of regions
+			 * where we could have speculative execution)
+			 */
+			if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN) &&
+				is_kernel_addr(addr))
+				continue;
+
 			/* Branches are read most recent first (ie. mfbhrb 0 is
 			 * the most recent branch).
 			 * There are two types of valid entries:
@@ -1188,6 +1198,7 @@ static void power_pmu_disable(struct pmu
 		 */
 		write_mmcr0(cpuhw, val);
 		mb();
+		isync();
 
 		/*
 		 * Disable instruction sampling if it was enabled
@@ -1196,12 +1207,26 @@ static void power_pmu_disable(struct pmu
 			mtspr(SPRN_MMCRA,
 			      cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
 			mb();
+			isync();
 		}
 
 		cpuhw->disabled = 1;
 		cpuhw->n_added = 0;
 
 		ebb_switch_out(mmcr0);
+
+#ifdef CONFIG_PPC64
+		/*
+		 * These are readable by userspace, may contain kernel
+		 * addresses and are not switched by context switch, so clear
+		 * them now to avoid leaking anything to userspace in general
+		 * including to another process.
+		 */
+		if (ppmu->flags & PPMU_ARCH_207S) {
+			mtspr(SPRN_SDAR, 0);
+			mtspr(SPRN_SIAR, 0);
+		}
+#endif
 	}
 
 	local_irq_restore(flags);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/powerpc/sysdev/mpic.c linux-libre-4.4.134-gnu/arch/powerpc/sysdev/mpic.c
--- linux-libre-4.4.133-gnu/arch/powerpc/sysdev/mpic.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/powerpc/sysdev/mpic.c	2018-05-30 01:49:18.000000000 -0400
@@ -626,7 +626,7 @@ static inline u32 mpic_physmask(u32 cpum
 	int i;
 	u32 mask = 0;
 
-	for (i = 0; i < min(32, NR_CPUS); ++i, cpumask >>= 1)
+	for (i = 0; i < min(32, NR_CPUS) && cpu_possible(i); ++i, cpumask >>= 1)
 		mask |= (cpumask & 1) << get_hard_smp_processor_id(i);
 	return mask;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/s390/include/asm/nospec-insn.h linux-libre-4.4.134-gnu/arch/s390/include/asm/nospec-insn.h
--- linux-libre-4.4.133-gnu/arch/s390/include/asm/nospec-insn.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/s390/include/asm/nospec-insn.h	2018-05-30 01:49:18.000000000 -0400
@@ -2,10 +2,15 @@
 #ifndef _ASM_S390_NOSPEC_ASM_H
 #define _ASM_S390_NOSPEC_ASM_H
 
+#include <asm/alternative-asm.h>
+#include <asm/asm-offsets.h>
+
 #ifdef __ASSEMBLY__
 
 #ifdef CONFIG_EXPOLINE
 
+_LC_BR_R1 = __LC_BR_R1
+
 /*
  * The expoline macros are used to create thunks in the same format
  * as gcc generates them. The 'comdat' section flag makes sure that
@@ -101,13 +106,21 @@
 	.endm
 
 	.macro __THUNK_EX_BR reg,ruse
+	# Be very careful when adding instructions to this macro!
+	# The ALTERNATIVE replacement code has a .+10 which targets
+	# the "br \reg" after the code has been patched.
 #ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
 	exrl	0,555f
 	j	.
 #else
+	.ifc \reg,%r1
+	ALTERNATIVE "ex %r0,_LC_BR_R1", ".insn ril,0xc60000000000,0,.+10", 35
+	j	.
+	.else
 	larl	\ruse,555f
 	ex	0,0(\ruse)
 	j	.
+	.endif
 #endif
 555:	br	\reg
 	.endm
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/s390/kernel/asm-offsets.c linux-libre-4.4.134-gnu/arch/s390/kernel/asm-offsets.c
--- linux-libre-4.4.133-gnu/arch/s390/kernel/asm-offsets.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/s390/kernel/asm-offsets.c	2018-05-30 01:49:18.000000000 -0400
@@ -170,6 +170,7 @@ int main(void)
 	OFFSET(__LC_MACHINE_FLAGS, _lowcore, machine_flags);
 	OFFSET(__LC_GMAP, _lowcore, gmap);
 	OFFSET(__LC_PASTE, _lowcore, paste);
+	OFFSET(__LC_BR_R1, _lowcore, br_r1_trampoline);
 	/* software defined ABI-relevant lowcore locations 0xe00 - 0xe20 */
 	OFFSET(__LC_DUMP_REIPL, _lowcore, ipib);
 	/* hardware defined lowcore locations 0x1000 - 0x18ff */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/s390/kernel/mcount.S linux-libre-4.4.134-gnu/arch/s390/kernel/mcount.S
--- linux-libre-4.4.133-gnu/arch/s390/kernel/mcount.S	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/s390/kernel/mcount.S	2018-05-30 01:49:18.000000000 -0400
@@ -8,12 +8,16 @@
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
 #include <asm/ftrace.h>
+#include <asm/nospec-insn.h>
 #include <asm/ptrace.h>
 
+	GEN_BR_THUNK %r1
+	GEN_BR_THUNK %r14
+
 	.section .kprobes.text, "ax"
 
 ENTRY(ftrace_stub)
-	br	%r14
+	BR_EX	%r14
 
 #define STACK_FRAME_SIZE  (STACK_FRAME_OVERHEAD + __PT_SIZE)
 #define STACK_PTREGS	  (STACK_FRAME_OVERHEAD)
@@ -21,7 +25,7 @@ ENTRY(ftrace_stub)
 #define STACK_PTREGS_PSW  (STACK_PTREGS + __PT_PSW)
 
 ENTRY(_mcount)
-	br	%r14
+	BR_EX	%r14
 
 ENTRY(ftrace_caller)
 	.globl	ftrace_regs_caller
@@ -49,7 +53,7 @@ ENTRY(ftrace_caller)
 #endif
 	lgr	%r3,%r14
 	la	%r5,STACK_PTREGS(%r15)
-	basr	%r14,%r1
+	BASR_EX	%r14,%r1
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 # The j instruction gets runtime patched to a nop instruction.
 # See ftrace_enable_ftrace_graph_caller.
@@ -64,7 +68,7 @@ ftrace_graph_caller_end:
 #endif
 	lg	%r1,(STACK_PTREGS_PSW+8)(%r15)
 	lmg	%r2,%r15,(STACK_PTREGS_GPRS+2*8)(%r15)
-	br	%r1
+	BR_EX	%r1
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 
@@ -77,6 +81,6 @@ ENTRY(return_to_handler)
 	aghi	%r15,STACK_FRAME_OVERHEAD
 	lgr	%r14,%r2
 	lmg	%r2,%r5,32(%r15)
-	br	%r14
+	BR_EX	%r14
 
 #endif
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/sh/kernel/entry-common.S linux-libre-4.4.134-gnu/arch/sh/kernel/entry-common.S
--- linux-libre-4.4.133-gnu/arch/sh/kernel/entry-common.S	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/sh/kernel/entry-common.S	2018-05-30 01:49:18.000000000 -0400
@@ -255,7 +255,7 @@ debug_trap:
 	mov.l	@r8, r8
 	jsr	@r8
 	 nop
-	bra	__restore_all
+	bra	ret_from_exception
 	 nop
 	CFI_ENDPROC
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/sparc/include/asm/atomic_64.h linux-libre-4.4.134-gnu/arch/sparc/include/asm/atomic_64.h
--- linux-libre-4.4.133-gnu/arch/sparc/include/asm/atomic_64.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/sparc/include/asm/atomic_64.h	2018-05-30 01:49:18.000000000 -0400
@@ -74,7 +74,11 @@ ATOMIC_OP(xor)
 #define atomic64_add_negative(i, v) (atomic64_add_return(i, v) < 0)
 
 #define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
+
+static inline int atomic_xchg(atomic_t *v, int new)
+{
+	return xchg(&v->counter, new);
+}
 
 static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/kernel/apic/apic.c linux-libre-4.4.134-gnu/arch/x86/kernel/apic/apic.c
--- linux-libre-4.4.133-gnu/arch/x86/kernel/apic/apic.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/kernel/apic/apic.c	2018-05-30 01:49:18.000000000 -0400
@@ -1368,7 +1368,7 @@ void setup_local_APIC(void)
 	 * TODO: set up through-local-APIC from through-I/O-APIC? --macro
 	 */
 	value = apic_read(APIC_LVT0) & APIC_LVT_MASKED;
-	if (!cpu && (pic_mode || !value)) {
+	if (!cpu && (pic_mode || !value || skip_ioapic_setup)) {
 		value = APIC_DM_EXTINT;
 		apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", cpu);
 	} else {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/kernel/devicetree.c linux-libre-4.4.134-gnu/arch/x86/kernel/devicetree.c
--- linux-libre-4.4.133-gnu/arch/x86/kernel/devicetree.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/kernel/devicetree.c	2018-05-30 01:49:18.000000000 -0400
@@ -11,6 +11,7 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/of_irq.h>
+#include <linux/libfdt.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/of_pci.h>
@@ -199,19 +200,22 @@ static struct of_ioapic_type of_ioapic_t
 static int dt_irqdomain_alloc(struct irq_domain *domain, unsigned int virq,
 			      unsigned int nr_irqs, void *arg)
 {
-	struct of_phandle_args *irq_data = (void *)arg;
+	struct irq_fwspec *fwspec = (struct irq_fwspec *)arg;
 	struct of_ioapic_type *it;
 	struct irq_alloc_info tmp;
+	int type_index;
 
-	if (WARN_ON(irq_data->args_count < 2))
+	if (WARN_ON(fwspec->param_count < 2))
 		return -EINVAL;
-	if (irq_data->args[1] >= ARRAY_SIZE(of_ioapic_type))
+
+	type_index = fwspec->param[1];
+	if (type_index >= ARRAY_SIZE(of_ioapic_type))
 		return -EINVAL;
 
-	it = &of_ioapic_type[irq_data->args[1]];
+	it = &of_ioapic_type[type_index];
 	ioapic_set_alloc_attr(&tmp, NUMA_NO_NODE, it->trigger, it->polarity);
 	tmp.ioapic_id = mpc_ioapic_id(mp_irqdomain_ioapic_idx(domain));
-	tmp.ioapic_pin = irq_data->args[0];
+	tmp.ioapic_pin = fwspec->param[0];
 
 	return mp_irqdomain_alloc(domain, virq, nr_irqs, &tmp);
 }
@@ -276,14 +280,15 @@ static void __init x86_flattree_get_conf
 
 	map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128);
 
-	initial_boot_params = dt = early_memremap(initial_dtb, map_len);
-	size = of_get_flat_dt_size();
+	dt = early_memremap(initial_dtb, map_len);
+	size = fdt_totalsize(dt);
 	if (map_len < size) {
 		early_memunmap(dt, map_len);
-		initial_boot_params = dt = early_memremap(initial_dtb, size);
+		dt = early_memremap(initial_dtb, size);
 		map_len = size;
 	}
 
+	early_init_dt_verify(dt);
 	unflatten_and_copy_device_tree();
 	early_memunmap(dt, map_len);
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/kernel/smpboot.c linux-libre-4.4.134-gnu/arch/x86/kernel/smpboot.c
--- linux-libre-4.4.133-gnu/arch/x86/kernel/smpboot.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/kernel/smpboot.c	2018-05-30 01:49:18.000000000 -0400
@@ -1344,6 +1344,7 @@ static void remove_siblinginfo(int cpu)
 	cpumask_clear(topology_core_cpumask(cpu));
 	c->phys_proc_id = 0;
 	c->cpu_core_id = 0;
+	c->booted_cores = 0;
 	cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
 }
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/kvm/lapic.c linux-libre-4.4.134-gnu/arch/x86/kvm/lapic.c
--- linux-libre-4.4.133-gnu/arch/x86/kvm/lapic.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/kvm/lapic.c	2018-05-30 01:49:18.000000000 -0400
@@ -288,8 +288,16 @@ void kvm_apic_set_version(struct kvm_vcp
 	if (!kvm_vcpu_has_lapic(vcpu))
 		return;
 
+	/*
+	 * KVM emulates 82093AA datasheet (with in-kernel IOAPIC implementation)
+	 * which doesn't have EOI register; Some buggy OSes (e.g. Windows with
+	 * Hyper-V role) disable EOI broadcast in lapic not checking for IOAPIC
+	 * version first and level-triggered interrupts never get EOIed in
+	 * IOAPIC.
+	 */
 	feat = kvm_find_cpuid_entry(apic->vcpu, 0x1, 0);
-	if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31))))
+	if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31))) &&
+	    !ioapic_in_kernel(vcpu->kvm))
 		v |= APIC_LVR_DIRECTED_EOI;
 	apic_set_reg(apic, APIC_LVR, v);
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/kvm/vmx.c linux-libre-4.4.134-gnu/arch/x86/kvm/vmx.c
--- linux-libre-4.4.133-gnu/arch/x86/kvm/vmx.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/kvm/vmx.c	2018-05-30 01:49:18.000000000 -0400
@@ -2319,6 +2319,8 @@ static void vmx_queue_exception(struct k
 		return;
 	}
 
+	WARN_ON_ONCE(vmx->emulation_required);
+
 	if (kvm_exception_is_soft(nr)) {
 		vmcs_write32(VM_ENTRY_INSTRUCTION_LEN,
 			     vmx->vcpu.arch.event_exit_inst_len);
@@ -6037,12 +6039,12 @@ static int handle_invalid_guest_state(st
 			goto out;
 		}
 
-		if (err != EMULATE_DONE) {
-			vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
-			vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
-			vcpu->run->internal.ndata = 0;
-			return 0;
-		}
+		if (err != EMULATE_DONE)
+			goto emulation_error;
+
+		if (vmx->emulation_required && !vmx->rmode.vm86_active &&
+		    vcpu->arch.exception.pending)
+			goto emulation_error;
 
 		if (vcpu->arch.halt_request) {
 			vcpu->arch.halt_request = 0;
@@ -6058,6 +6060,12 @@ static int handle_invalid_guest_state(st
 
 out:
 	return ret;
+
+emulation_error:
+	vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
+	vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
+	vcpu->run->internal.ndata = 0;
+	return 0;
 }
 
 static int __grow_ple_window(int val)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/kvm/x86.c linux-libre-4.4.134-gnu/arch/x86/kvm/x86.c
--- linux-libre-4.4.133-gnu/arch/x86/kvm/x86.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/kvm/x86.c	2018-05-30 01:49:18.000000000 -0400
@@ -3973,13 +3973,14 @@ long kvm_arch_vm_ioctl(struct file *filp
 		mutex_unlock(&kvm->lock);
 		break;
 	case KVM_XEN_HVM_CONFIG: {
+		struct kvm_xen_hvm_config xhc;
 		r = -EFAULT;
-		if (copy_from_user(&kvm->arch.xen_hvm_config, argp,
-				   sizeof(struct kvm_xen_hvm_config)))
+		if (copy_from_user(&xhc, argp, sizeof(xhc)))
 			goto out;
 		r = -EINVAL;
-		if (kvm->arch.xen_hvm_config.flags)
+		if (xhc.flags)
 			goto out;
+		memcpy(&kvm->arch.xen_hvm_config, &xhc, sizeof(xhc));
 		r = 0;
 		break;
 	}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/mm/pgtable.c linux-libre-4.4.134-gnu/arch/x86/mm/pgtable.c
--- linux-libre-4.4.133-gnu/arch/x86/mm/pgtable.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/mm/pgtable.c	2018-05-30 01:49:18.000000000 -0400
@@ -1,5 +1,6 @@
 #include <linux/mm.h>
 #include <linux/gfp.h>
+#include <linux/hugetlb.h>
 #include <asm/pgalloc.h>
 #include <asm/pgtable.h>
 #include <asm/tlb.h>
@@ -600,6 +601,10 @@ int pud_set_huge(pud_t *pud, phys_addr_t
 	    (mtrr != MTRR_TYPE_WRBACK))
 		return 0;
 
+	/* Bail out if we are we on a populated non-leaf entry: */
+	if (pud_present(*pud) && !pud_huge(*pud))
+		return 0;
+
 	prot = pgprot_4k_2_large(prot);
 
 	set_pte((pte_t *)pud, pfn_pte(
@@ -628,6 +633,10 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_t
 		return 0;
 	}
 
+	/* Bail out if we are we on a populated non-leaf entry: */
+	if (pmd_present(*pmd) && !pmd_huge(*pmd))
+		return 0;
+
 	prot = pgprot_4k_2_large(prot);
 
 	set_pte((pte_t *)pmd, pfn_pte(
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/power/hibernate_32.c linux-libre-4.4.134-gnu/arch/x86/power/hibernate_32.c
--- linux-libre-4.4.133-gnu/arch/x86/power/hibernate_32.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/power/hibernate_32.c	2018-05-30 01:49:18.000000000 -0400
@@ -142,7 +142,7 @@ static inline void resume_init_first_lev
 #endif
 }
 
-int swsusp_arch_resume(void)
+asmlinkage int swsusp_arch_resume(void)
 {
 	int error;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/arch/x86/power/hibernate_64.c linux-libre-4.4.134-gnu/arch/x86/power/hibernate_64.c
--- linux-libre-4.4.133-gnu/arch/x86/power/hibernate_64.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/arch/x86/power/hibernate_64.c	2018-05-30 01:49:18.000000000 -0400
@@ -78,7 +78,7 @@ static int set_up_temporary_mappings(voi
 	return 0;
 }
 
-int swsusp_arch_resume(void)
+asmlinkage int swsusp_arch_resume(void)
 {
 	int error;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/Documentation/device-mapper/thin-provisioning.txt linux-libre-4.4.134-gnu/Documentation/device-mapper/thin-provisioning.txt
--- linux-libre-4.4.133-gnu/Documentation/device-mapper/thin-provisioning.txt	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/Documentation/device-mapper/thin-provisioning.txt	2018-05-30 01:49:18.000000000 -0400
@@ -112,9 +112,11 @@ $low_water_mark is expressed in blocks o
 free space on the data device drops below this level then a dm event
 will be triggered which a userspace daemon should catch allowing it to
 extend the pool device.  Only one such event will be sent.
-Resuming a device with a new table itself triggers an event so the
-userspace daemon can use this to detect a situation where a new table
-already exceeds the threshold.
+
+No special event is triggered if a just resumed device's free space is below
+the low water mark. However, resuming a device always triggers an
+event; a userspace daemon should verify that free space exceeds the low
+water mark when handling this event.
 
 A low water mark for the metadata device is maintained in the kernel and
 will trigger a dm event if free space on the metadata device drops below
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/acpi/acpica/evevent.c linux-libre-4.4.134-gnu/drivers/acpi/acpica/evevent.c
--- linux-libre-4.4.133-gnu/drivers/acpi/acpica/evevent.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/acpi/acpica/evevent.c	2018-05-30 01:49:18.000000000 -0400
@@ -204,6 +204,7 @@ u32 acpi_ev_fixed_event_detect(void)
 	u32 fixed_status;
 	u32 fixed_enable;
 	u32 i;
+	acpi_status status;
 
 	ACPI_FUNCTION_NAME(ev_fixed_event_detect);
 
@@ -211,8 +212,12 @@ u32 acpi_ev_fixed_event_detect(void)
 	 * Read the fixed feature status and enable registers, as all the cases
 	 * depend on their values. Ignore errors here.
 	 */
-	(void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status);
-	(void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
+	status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status);
+	status |=
+	    acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
+	if (ACPI_FAILURE(status)) {
+		return (int_status);
+	}
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
 			  "Fixed Event Block: Enable %08X Status %08X\n",
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/acpi/acpica/nseval.c linux-libre-4.4.134-gnu/drivers/acpi/acpica/nseval.c
--- linux-libre-4.4.133-gnu/drivers/acpi/acpica/nseval.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/acpi/acpica/nseval.c	2018-05-30 01:49:18.000000000 -0400
@@ -308,6 +308,14 @@ acpi_status acpi_ns_evaluate(struct acpi
 		/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
 
 		status = AE_OK;
+	} else if (ACPI_FAILURE(status)) {
+
+		/* If return_object exists, delete it */
+
+		if (info->return_object) {
+			acpi_ut_remove_reference(info->return_object);
+			info->return_object = NULL;
+		}
 	}
 
 	ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/acpi/acpi_pad.c linux-libre-4.4.134-gnu/drivers/acpi/acpi_pad.c
--- linux-libre-4.4.133-gnu/drivers/acpi/acpi_pad.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/acpi/acpi_pad.c	2018-05-30 01:49:18.000000000 -0400
@@ -108,6 +108,7 @@ static void round_robin_cpu(unsigned int
 		cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus);
 	if (cpumask_empty(tmp)) {
 		mutex_unlock(&round_robin_lock);
+		free_cpumask_var(tmp);
 		return;
 	}
 	for_each_cpu(cpu, tmp) {
@@ -125,6 +126,8 @@ static void round_robin_cpu(unsigned int
 	mutex_unlock(&round_robin_lock);
 
 	set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu));
+
+	free_cpumask_var(tmp);
 }
 
 static void exit_round_robin(unsigned int tsk_index)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/acpi/processor_perflib.c linux-libre-4.4.134-gnu/drivers/acpi/processor_perflib.c
--- linux-libre-4.4.133-gnu/drivers/acpi/processor_perflib.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/acpi/processor_perflib.c	2018-05-30 01:49:18.000000000 -0400
@@ -161,7 +161,7 @@ int acpi_processor_ppc_has_changed(struc
 {
 	int ret;
 
-	if (ignore_ppc) {
+	if (ignore_ppc || !pr->performance) {
 		/*
 		 * Only when it is notification event, the _OST object
 		 * will be evaluated. Otherwise it is skipped.
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/ata/libata-core.c linux-libre-4.4.134-gnu/drivers/ata/libata-core.c
--- linux-libre-4.4.133-gnu/drivers/ata/libata-core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/ata/libata-core.c	2018-05-30 01:49:18.000000000 -0400
@@ -4187,6 +4187,10 @@ static const struct ata_blacklist_entry
 	/* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */
 	{ "C300-CTFDDAC128MAG",	"0001",		ATA_HORKAGE_NONCQ, },
 
+	/* Some Sandisk SSDs lock up hard with NCQ enabled.  Reported on
+	   SD7SN6S256G and SD8SN8U256G */
+	{ "SanDisk SD[78]SN*G",	NULL,		ATA_HORKAGE_NONCQ, },
+
 	/* devices which puke on READ_NATIVE_MAX */
 	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_HORKAGE_BROKEN_HPA, },
 	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA },
@@ -4247,6 +4251,8 @@ static const struct ata_blacklist_entry
 	{ "SanDisk SD7UB3Q*G1001",	NULL,	ATA_HORKAGE_NOLPM, },
 
 	/* devices that don't properly handle queued TRIM commands */
+	{ "Micron_M500IT_*",		"MU01",	ATA_HORKAGE_NO_NCQ_TRIM |
+						ATA_HORKAGE_ZERO_AFTER_TRIM, },
 	{ "Micron_M500_*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
 						ATA_HORKAGE_ZERO_AFTER_TRIM, },
 	{ "Crucial_CT*M500*",		NULL,	ATA_HORKAGE_NO_NCQ_TRIM |
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/block/paride/pcd.c linux-libre-4.4.134-gnu/drivers/block/paride/pcd.c
--- linux-libre-4.4.133-gnu/drivers/block/paride/pcd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/block/paride/pcd.c	2018-05-30 01:49:18.000000000 -0400
@@ -230,6 +230,8 @@ static int pcd_block_open(struct block_d
 	struct pcd_unit *cd = bdev->bd_disk->private_data;
 	int ret;
 
+	check_disk_change(bdev);
+
 	mutex_lock(&pcd_mutex);
 	ret = cdrom_open(&cd->info, bdev, mode);
 	mutex_unlock(&pcd_mutex);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/bluetooth/btusb.c linux-libre-4.4.134-gnu/drivers/bluetooth/btusb.c
--- linux-libre-4.4.133-gnu/drivers/bluetooth/btusb.c	2018-05-26 03:45:23.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/bluetooth/btusb.c	2018-05-30 03:00:41.000000000 -0400
@@ -336,6 +336,9 @@ static const struct usb_device_id blackl
 	{ USB_DEVICE(0x13d3, 0x3459), .driver_info = BTUSB_REALTEK },
 	{ USB_DEVICE(0x13d3, 0x3494), .driver_info = BTUSB_REALTEK },
 
+	/* Additional Realtek 8723BU Bluetooth devices */
+	{ USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK },
+
 	/* Additional Realtek 8821AE Bluetooth devices */
 	{ USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK },
 	{ USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
@@ -343,6 +346,9 @@ static const struct usb_device_id blackl
 	{ USB_DEVICE(0x13d3, 0x3461), .driver_info = BTUSB_REALTEK },
 	{ USB_DEVICE(0x13d3, 0x3462), .driver_info = BTUSB_REALTEK },
 
+	/* Additional Realtek 8822BE Bluetooth devices */
+	{ USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
+
 	/* Silicon Wave based devices */
 	{ USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE },
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/cdrom/cdrom.c linux-libre-4.4.134-gnu/drivers/cdrom/cdrom.c
--- linux-libre-4.4.133-gnu/drivers/cdrom/cdrom.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/cdrom/cdrom.c	2018-05-30 01:49:18.000000000 -0400
@@ -1154,9 +1154,6 @@ int cdrom_open(struct cdrom_device_info
 
 	cd_dbg(CD_OPEN, "entering cdrom_open\n");
 
-	/* open is event synchronization point, check events first */
-	check_disk_change(bdev);
-
 	/* if this was a O_NONBLOCK open and we should honor the flags,
 	 * do a quick open without drive/disc integrity checks. */
 	cdi->use_count++;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/cdrom/gdrom.c linux-libre-4.4.134-gnu/drivers/cdrom/gdrom.c
--- linux-libre-4.4.133-gnu/drivers/cdrom/gdrom.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/cdrom/gdrom.c	2018-05-30 01:49:18.000000000 -0400
@@ -497,6 +497,9 @@ static struct cdrom_device_ops gdrom_ops
 static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode)
 {
 	int ret;
+
+	check_disk_change(bdev);
+
 	mutex_lock(&gdrom_mutex);
 	ret = cdrom_open(gd.cd_info, bdev, mode);
 	mutex_unlock(&gdrom_mutex);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/char/hw_random/stm32-rng.c linux-libre-4.4.134-gnu/drivers/char/hw_random/stm32-rng.c
--- linux-libre-4.4.133-gnu/drivers/char/hw_random/stm32-rng.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/char/hw_random/stm32-rng.c	2018-05-30 01:49:18.000000000 -0400
@@ -21,6 +21,7 @@
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 
 #define RNG_CR 0x00
@@ -46,6 +47,7 @@ struct stm32_rng_private {
 	struct hwrng rng;
 	void __iomem *base;
 	struct clk *clk;
+	struct reset_control *rst;
 };
 
 static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
@@ -140,6 +142,13 @@ static int stm32_rng_probe(struct platfo
 	if (IS_ERR(priv->clk))
 		return PTR_ERR(priv->clk);
 
+	priv->rst = devm_reset_control_get(&ofdev->dev, NULL);
+	if (!IS_ERR(priv->rst)) {
+		reset_control_assert(priv->rst);
+		udelay(2);
+		reset_control_deassert(priv->rst);
+	}
+
 	dev_set_drvdata(dev, priv);
 
 	priv->rng.name = dev_driver_string(dev),
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/char/ipmi/ipmi_powernv.c linux-libre-4.4.134-gnu/drivers/char/ipmi/ipmi_powernv.c
--- linux-libre-4.4.133-gnu/drivers/char/ipmi/ipmi_powernv.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/char/ipmi/ipmi_powernv.c	2018-05-30 01:49:18.000000000 -0400
@@ -251,8 +251,9 @@ static int ipmi_powernv_probe(struct pla
 		ipmi->irq = opal_event_request(prop);
 	}
 
-	if (request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
-				"opal-ipmi", ipmi)) {
+	rc = request_irq(ipmi->irq, ipmi_opal_event, IRQ_TYPE_LEVEL_HIGH,
+			 "opal-ipmi", ipmi);
+	if (rc) {
 		dev_warn(dev, "Unable to request irq\n");
 		goto err_dispose;
 	}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/char/ipmi/ipmi_ssif.c linux-libre-4.4.134-gnu/drivers/char/ipmi/ipmi_ssif.c
--- linux-libre-4.4.133-gnu/drivers/char/ipmi/ipmi_ssif.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/char/ipmi/ipmi_ssif.c	2018-05-30 01:49:18.000000000 -0400
@@ -757,7 +757,7 @@ static void msg_done_handler(struct ssif
 			ssif_info->ssif_state = SSIF_NORMAL;
 			ipmi_ssif_unlock_cond(ssif_info, flags);
 			pr_warn(PFX "Error getting flags: %d %d, %x\n",
-			       result, len, data[2]);
+			       result, len, (len >= 3) ? data[2] : 0);
 		} else if (data[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
 			   || data[1] != IPMI_GET_MSG_FLAGS_CMD) {
 			/*
@@ -779,7 +779,7 @@ static void msg_done_handler(struct ssif
 		if ((result < 0) || (len < 3) || (data[2] != 0)) {
 			/* Error clearing flags */
 			pr_warn(PFX "Error clearing flags: %d %d, %x\n",
-			       result, len, data[2]);
+			       result, len, (len >= 3) ? data[2] : 0);
 		} else if (data[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2
 			   || data[1] != IPMI_CLEAR_MSG_FLAGS_CMD) {
 			pr_warn(PFX "Invalid response clearing flags: %x %x\n",
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/clk.c linux-libre-4.4.134-gnu/drivers/clk/clk.c
--- linux-libre-4.4.133-gnu/drivers/clk/clk.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/clk.c	2018-05-30 01:49:18.000000000 -0400
@@ -1905,6 +1905,9 @@ static int clk_core_get_phase(struct clk
 	int ret;
 
 	clk_prepare_lock();
+	/* Always try to update cached phase if possible */
+	if (core->ops->get_phase)
+		core->phase = core->ops->get_phase(core->hw);
 	ret = core->phase;
 	clk_prepare_unlock();
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/rockchip/clk-mmc-phase.c linux-libre-4.4.134-gnu/drivers/clk/rockchip/clk-mmc-phase.c
--- linux-libre-4.4.133-gnu/drivers/clk/rockchip/clk-mmc-phase.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/rockchip/clk-mmc-phase.c	2018-05-30 01:49:18.000000000 -0400
@@ -60,6 +60,12 @@ static int rockchip_mmc_get_phase(struct
 	u16 degrees;
 	u32 delay_num = 0;
 
+	/* See the comment for rockchip_mmc_set_phase below */
+	if (!rate) {
+		pr_err("%s: invalid clk rate\n", __func__);
+		return -EINVAL;
+	}
+
 	raw_value = readl(mmc_clock->reg) >> (mmc_clock->shift);
 
 	degrees = (raw_value & ROCKCHIP_MMC_DEGREE_MASK) * 90;
@@ -86,6 +92,23 @@ static int rockchip_mmc_set_phase(struct
 	u32 raw_value;
 	u32 delay;
 
+	/*
+	 * The below calculation is based on the output clock from
+	 * MMC host to the card, which expects the phase clock inherits
+	 * the clock rate from its parent, namely the output clock
+	 * provider of MMC host. However, things may go wrong if
+	 * (1) It is orphan.
+	 * (2) It is assigned to the wrong parent.
+	 *
+	 * This check help debug the case (1), which seems to be the
+	 * most likely problem we often face and which makes it difficult
+	 * for people to debug unstable mmc tuning results.
+	 */
+	if (!rate) {
+		pr_err("%s: invalid clk rate\n", __func__);
+		return -EINVAL;
+	}
+
 	nineties = degrees / 90;
 	remainder = (degrees % 90);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos3250.c linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos3250.c
--- linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos3250.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos3250.c	2018-05-30 01:49:18.000000000 -0400
@@ -683,7 +683,7 @@ static struct samsung_pll_rate_table exy
 	PLL_36XX_RATE(144000000,  96, 2, 3,     0),
 	PLL_36XX_RATE( 96000000, 128, 2, 4,     0),
 	PLL_36XX_RATE( 84000000, 112, 2, 4,     0),
-	PLL_36XX_RATE( 80000004, 106, 2, 4, 43691),
+	PLL_36XX_RATE( 80000003, 106, 2, 4, 43691),
 	PLL_36XX_RATE( 73728000,  98, 2, 4, 19923),
 	PLL_36XX_RATE( 67737598, 270, 3, 5, 62285),
 	PLL_36XX_RATE( 65535999, 174, 2, 5, 49982),
@@ -719,7 +719,7 @@ static struct samsung_pll_rate_table exy
 	PLL_36XX_RATE(148352005,  98, 2, 3, 59070),
 	PLL_36XX_RATE(108000000, 144, 2, 4,     0),
 	PLL_36XX_RATE( 74250000,  99, 2, 4,     0),
-	PLL_36XX_RATE( 74176002,  98, 3, 4, 59070),
+	PLL_36XX_RATE( 74176002,  98, 2, 4, 59070),
 	PLL_36XX_RATE( 54054000, 216, 3, 5, 14156),
 	PLL_36XX_RATE( 54000000, 144, 2, 5,     0),
 	{ /* sentinel */ }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos5250.c linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos5250.c
--- linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos5250.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos5250.c	2018-05-30 01:49:18.000000000 -0400
@@ -711,13 +711,13 @@ static struct samsung_pll_rate_table epl
 	/* sorted in descending order */
 	/* PLL_36XX_RATE(rate, m, p, s, k) */
 	PLL_36XX_RATE(192000000, 64, 2, 2, 0),
-	PLL_36XX_RATE(180633600, 90, 3, 2, 20762),
+	PLL_36XX_RATE(180633605, 90, 3, 2, 20762),
 	PLL_36XX_RATE(180000000, 90, 3, 2, 0),
 	PLL_36XX_RATE(73728000, 98, 2, 4, 19923),
-	PLL_36XX_RATE(67737600, 90, 2, 4, 20762),
+	PLL_36XX_RATE(67737602, 90, 2, 4, 20762),
 	PLL_36XX_RATE(49152000, 98, 3, 4, 19923),
-	PLL_36XX_RATE(45158400, 90, 3, 4, 20762),
-	PLL_36XX_RATE(32768000, 131, 3, 5, 4719),
+	PLL_36XX_RATE(45158401, 90, 3, 4, 20762),
+	PLL_36XX_RATE(32768001, 131, 3, 5, 4719),
 	{ },
 };
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos5260.c linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos5260.c
--- linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos5260.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos5260.c	2018-05-30 01:49:18.000000000 -0400
@@ -65,7 +65,7 @@ static struct samsung_pll_rate_table pll
 	PLL_36XX_RATE(480000000, 160, 2, 2, 0),
 	PLL_36XX_RATE(432000000, 144, 2, 2, 0),
 	PLL_36XX_RATE(400000000, 200, 3, 2, 0),
-	PLL_36XX_RATE(394073130, 459, 7, 2, 49282),
+	PLL_36XX_RATE(394073128, 459, 7, 2, 49282),
 	PLL_36XX_RATE(333000000, 111, 2, 2, 0),
 	PLL_36XX_RATE(300000000, 100, 2, 2, 0),
 	PLL_36XX_RATE(266000000, 266, 3, 3, 0),
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos5433.c linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos5433.c
--- linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-exynos5433.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-exynos5433.c	2018-05-30 01:49:18.000000000 -0400
@@ -747,7 +747,7 @@ static struct samsung_pll_rate_table exy
 	PLL_35XX_RATE(800000000U,  400, 6,  1),
 	PLL_35XX_RATE(733000000U,  733, 12, 1),
 	PLL_35XX_RATE(700000000U,  175, 3,  1),
-	PLL_35XX_RATE(667000000U,  222, 4,  1),
+	PLL_35XX_RATE(666000000U,  222, 4,  1),
 	PLL_35XX_RATE(633000000U,  211, 4,  1),
 	PLL_35XX_RATE(600000000U,  500, 5,  2),
 	PLL_35XX_RATE(552000000U,  460, 5,  2),
@@ -773,12 +773,12 @@ static struct samsung_pll_rate_table exy
 /* AUD_PLL */
 static struct samsung_pll_rate_table exynos5443_aud_pll_rates[] = {
 	PLL_36XX_RATE(400000000U, 200, 3, 2,      0),
-	PLL_36XX_RATE(393216000U, 197, 3, 2, -25690),
+	PLL_36XX_RATE(393216003U, 197, 3, 2, -25690),
 	PLL_36XX_RATE(384000000U, 128, 2, 2,      0),
-	PLL_36XX_RATE(368640000U, 246, 4, 2, -15729),
-	PLL_36XX_RATE(361507200U, 181, 3, 2, -16148),
-	PLL_36XX_RATE(338688000U, 113, 2, 2,  -6816),
-	PLL_36XX_RATE(294912000U,  98, 1, 3,  19923),
+	PLL_36XX_RATE(368639991U, 246, 4, 2, -15729),
+	PLL_36XX_RATE(361507202U, 181, 3, 2, -16148),
+	PLL_36XX_RATE(338687988U, 113, 2, 2,  -6816),
+	PLL_36XX_RATE(294912002U,  98, 1, 3,  19923),
 	PLL_36XX_RATE(288000000U,  96, 1, 3,      0),
 	PLL_36XX_RATE(252000000U,  84, 1, 3,      0),
 	{ /* sentinel */ }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-s3c2410.c linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-s3c2410.c
--- linux-libre-4.4.133-gnu/drivers/clk/samsung/clk-s3c2410.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clk/samsung/clk-s3c2410.c	2018-05-30 01:49:18.000000000 -0400
@@ -168,7 +168,7 @@ static struct samsung_pll_rate_table pll
 	PLL_35XX_RATE(226000000, 105, 1, 1),
 	PLL_35XX_RATE(210000000, 132, 2, 1),
 	/* 2410 common */
-	PLL_35XX_RATE(203000000, 161, 3, 1),
+	PLL_35XX_RATE(202800000, 161, 3, 1),
 	PLL_35XX_RATE(192000000, 88, 1, 1),
 	PLL_35XX_RATE(186000000, 85, 1, 1),
 	PLL_35XX_RATE(180000000, 82, 1, 1),
@@ -178,18 +178,18 @@ static struct samsung_pll_rate_table pll
 	PLL_35XX_RATE(147000000, 90, 2, 1),
 	PLL_35XX_RATE(135000000, 82, 2, 1),
 	PLL_35XX_RATE(124000000, 116, 1, 2),
-	PLL_35XX_RATE(118000000, 150, 2, 2),
+	PLL_35XX_RATE(118500000, 150, 2, 2),
 	PLL_35XX_RATE(113000000, 105, 1, 2),
-	PLL_35XX_RATE(101000000, 127, 2, 2),
+	PLL_35XX_RATE(101250000, 127, 2, 2),
 	PLL_35XX_RATE(90000000, 112, 2, 2),
-	PLL_35XX_RATE(85000000, 105, 2, 2),
+	PLL_35XX_RATE(84750000, 105, 2, 2),
 	PLL_35XX_RATE(79000000, 71, 1, 2),
-	PLL_35XX_RATE(68000000, 82, 2, 2),
-	PLL_35XX_RATE(56000000, 142, 2, 3),
+	PLL_35XX_RATE(67500000, 82, 2, 2),
+	PLL_35XX_RATE(56250000, 142, 2, 3),
 	PLL_35XX_RATE(48000000, 120, 2, 3),
-	PLL_35XX_RATE(51000000, 161, 3, 3),
+	PLL_35XX_RATE(50700000, 161, 3, 3),
 	PLL_35XX_RATE(45000000, 82, 1, 3),
-	PLL_35XX_RATE(34000000, 82, 2, 3),
+	PLL_35XX_RATE(33750000, 82, 2, 3),
 	{ /* sentinel */ },
 };
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/clocksource/fsl_ftm_timer.c linux-libre-4.4.134-gnu/drivers/clocksource/fsl_ftm_timer.c
--- linux-libre-4.4.133-gnu/drivers/clocksource/fsl_ftm_timer.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/clocksource/fsl_ftm_timer.c	2018-05-30 01:49:18.000000000 -0400
@@ -281,7 +281,7 @@ static int __init __ftm_clk_init(struct
 
 static unsigned long __init ftm_clk_init(struct device_node *np)
 {
-	unsigned long freq;
+	long freq;
 
 	freq = __ftm_clk_init(np, "ftm-evt-counter-en", "ftm-evt");
 	if (freq <= 0)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/cpufreq/cppc_cpufreq.c linux-libre-4.4.134-gnu/drivers/cpufreq/cppc_cpufreq.c
--- linux-libre-4.4.133-gnu/drivers/cpufreq/cppc_cpufreq.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/cpufreq/cppc_cpufreq.c	2018-05-30 01:49:18.000000000 -0400
@@ -100,9 +100,19 @@ static int cppc_cpufreq_cpu_init(struct
 	policy->cpuinfo.max_freq = policy->max;
 	policy->shared_type = cpu->shared_type;
 
-	if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
+	if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
+		int i;
+
 		cpumask_copy(policy->cpus, cpu->shared_cpu_map);
-	else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
+
+		for_each_cpu(i, policy->cpus) {
+			if (unlikely(i == policy->cpu))
+				continue;
+
+			memcpy(&all_cpu_data[i]->perf_caps, &cpu->perf_caps,
+			       sizeof(cpu->perf_caps));
+		}
+	} else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
 		/* Support only SW_ANY for now. */
 		pr_debug("Unsupported CPU co-ord type\n");
 		return -EFAULT;
@@ -166,8 +176,13 @@ static int __init cppc_cpufreq_init(void
 	return ret;
 
 out:
-	for_each_possible_cpu(i)
-		kfree(all_cpu_data[i]);
+	for_each_possible_cpu(i) {
+		cpu = all_cpu_data[i];
+		if (!cpu)
+			break;
+		free_cpumask_var(cpu->shared_cpu_map);
+		kfree(cpu);
+	}
 
 	kfree(all_cpu_data);
 	return -ENODEV;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/crypto/sunxi-ss/sun4i-ss-core.c linux-libre-4.4.134-gnu/drivers/crypto/sunxi-ss/sun4i-ss-core.c
--- linux-libre-4.4.133-gnu/drivers/crypto/sunxi-ss/sun4i-ss-core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/crypto/sunxi-ss/sun4i-ss-core.c	2018-05-30 01:49:18.000000000 -0400
@@ -422,6 +422,7 @@ static struct platform_driver sun4i_ss_d
 
 module_platform_driver(sun4i_ss_driver);
 
+MODULE_ALIAS("platform:sun4i-ss");
 MODULE_DESCRIPTION("Allwinner Security System cryptographic accelerator");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Corentin LABBE <clabbe.montjoie@gmail.com>");
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/dma/pl330.c linux-libre-4.4.134-gnu/drivers/dma/pl330.c
--- linux-libre-4.4.133-gnu/drivers/dma/pl330.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/dma/pl330.c	2018-05-30 01:49:18.000000000 -0400
@@ -1533,7 +1533,7 @@ static void pl330_dotask(unsigned long d
 /* Returns 1 if state was updated, 0 otherwise */
 static int pl330_update(struct pl330_dmac *pl330)
 {
-	struct dma_pl330_desc *descdone, *tmp;
+	struct dma_pl330_desc *descdone;
 	unsigned long flags;
 	void __iomem *regs;
 	u32 val;
@@ -1611,7 +1611,9 @@ static int pl330_update(struct pl330_dma
 	}
 
 	/* Now that we are in no hurry, do the callbacks */
-	list_for_each_entry_safe(descdone, tmp, &pl330->req_done, rqd) {
+	while (!list_empty(&pl330->req_done)) {
+		descdone = list_first_entry(&pl330->req_done,
+					    struct dma_pl330_desc, rqd);
 		list_del(&descdone->rqd);
 		spin_unlock_irqrestore(&pl330->lock, flags);
 		dma_pl330_rqcb(descdone, PL330_ERR_NONE);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/dma/sh/rcar-dmac.c linux-libre-4.4.134-gnu/drivers/dma/sh/rcar-dmac.c
--- linux-libre-4.4.133-gnu/drivers/dma/sh/rcar-dmac.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/dma/sh/rcar-dmac.c	2018-05-30 01:49:18.000000000 -0400
@@ -851,7 +851,7 @@ rcar_dmac_chan_prep_sg(struct rcar_dmac_
 
 	rcar_dmac_chan_configure_desc(chan, desc);
 
-	max_chunk_size = (RCAR_DMATCR_MASK + 1) << desc->xfer_shift;
+	max_chunk_size = RCAR_DMATCR_MASK << desc->xfer_shift;
 
 	/*
 	 * Allocate and fill the transfer chunk descriptors. We own the only
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/firewire/ohci.c linux-libre-4.4.134-gnu/drivers/firewire/ohci.c
--- linux-libre-4.4.133-gnu/drivers/firewire/ohci.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/firewire/ohci.c	2018-05-30 01:49:18.000000000 -0400
@@ -1130,7 +1130,13 @@ static int context_add_buffer(struct con
 		return -ENOMEM;
 
 	offset = (void *)&desc->buffer - (void *)desc;
-	desc->buffer_size = PAGE_SIZE - offset;
+	/*
+	 * Some controllers, like JMicron ones, always issue 0x20-byte DMA reads
+	 * for descriptors, even 0x10-byte ones. This can cause page faults when
+	 * an IOMMU is in use and the oversized read crosses a page boundary.
+	 * Work around this by always leaving at least 0x10 bytes of padding.
+	 */
+	desc->buffer_size = PAGE_SIZE - offset - 0x10;
 	desc->buffer_bus = bus_addr + offset;
 	desc->used = 0;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/firmware/dmi_scan.c linux-libre-4.4.134-gnu/drivers/firmware/dmi_scan.c
--- linux-libre-4.4.133-gnu/drivers/firmware/dmi_scan.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/firmware/dmi_scan.c	2018-05-30 01:49:18.000000000 -0400
@@ -18,7 +18,7 @@ EXPORT_SYMBOL_GPL(dmi_kobj);
  * of and an antecedent to, SMBIOS, which stands for System
  * Management BIOS.  See further: http://www.dmtf.org/standards
  */
-static const char dmi_empty_string[] = "        ";
+static const char dmi_empty_string[] = "";
 
 static u32 dmi_ver __initdata;
 static u32 dmi_len;
@@ -44,25 +44,21 @@ static int dmi_memdev_nr;
 static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)
 {
 	const u8 *bp = ((u8 *) dm) + dm->length;
+	const u8 *nsp;
 
 	if (s) {
-		s--;
-		while (s > 0 && *bp) {
+		while (--s > 0 && *bp)
 			bp += strlen(bp) + 1;
-			s--;
-		}
-
-		if (*bp != 0) {
-			size_t len = strlen(bp)+1;
-			size_t cmp_len = len > 8 ? 8 : len;
 
-			if (!memcmp(bp, dmi_empty_string, cmp_len))
-				return dmi_empty_string;
+		/* Strings containing only spaces are considered empty */
+		nsp = bp;
+		while (*nsp == ' ')
+			nsp++;
+		if (*nsp != '\0')
 			return bp;
-		}
 	}
 
-	return "";
+	return dmi_empty_string;
 }
 
 static const char * __init dmi_string(const struct dmi_header *dm, u8 s)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/gpu/drm/exynos/regs-fimc.h linux-libre-4.4.134-gnu/drivers/gpu/drm/exynos/regs-fimc.h
--- linux-libre-4.4.133-gnu/drivers/gpu/drm/exynos/regs-fimc.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/gpu/drm/exynos/regs-fimc.h	2018-05-30 01:49:18.000000000 -0400
@@ -569,7 +569,7 @@
 #define EXYNOS_CIIMGEFF_FIN_EMBOSSING		(4 << 26)
 #define EXYNOS_CIIMGEFF_FIN_SILHOUETTE		(5 << 26)
 #define EXYNOS_CIIMGEFF_FIN_MASK			(7 << 26)
-#define EXYNOS_CIIMGEFF_PAT_CBCR_MASK		((0xff < 13) | (0xff < 0))
+#define EXYNOS_CIIMGEFF_PAT_CBCR_MASK		((0xff << 13) | (0xff << 0))
 
 /* Real input DMA size register */
 #define EXYNOS_CIREAL_ISIZE_AUTOLOAD_ENABLE	(1 << 31)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/gpu/drm/rockchip/rockchip_drm_gem.c linux-libre-4.4.134-gnu/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
--- linux-libre-4.4.133-gnu/drivers/gpu/drm/rockchip/rockchip_drm_gem.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/gpu/drm/rockchip/rockchip_drm_gem.c	2018-05-30 01:49:18.000000000 -0400
@@ -67,7 +67,6 @@ static int rockchip_drm_gem_object_mmap(
 	 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
 	 */
 	vma->vm_flags &= ~VM_PFNMAP;
-	vma->vm_pgoff = 0;
 
 	ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr,
 			     obj->size, &rk_obj->dma_attrs);
@@ -99,6 +98,12 @@ int rockchip_gem_mmap(struct file *filp,
 	if (ret)
 		return ret;
 
+	/*
+	 * Set vm_pgoff (used as a fake buffer offset by DRM) to 0 and map the
+	 * whole buffer from the start.
+	 */
+	vma->vm_pgoff = 0;
+
 	obj = vma->vm_private_data;
 
 	return rockchip_drm_gem_object_mmap(obj, vma);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/gpu/drm/virtio/virtgpu_ioctl.c linux-libre-4.4.134-gnu/drivers/gpu/drm/virtio/virtgpu_ioctl.c
--- linux-libre-4.4.133-gnu/drivers/gpu/drm/virtio/virtgpu_ioctl.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/gpu/drm/virtio/virtgpu_ioctl.c	2018-05-30 01:49:18.000000000 -0400
@@ -208,6 +208,9 @@ static int virtio_gpu_getparam_ioctl(str
 	case VIRTGPU_PARAM_3D_FEATURES:
 		value = vgdev->has_virgl_3d == true ? 1 : 0;
 		break;
+	case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
+		value = 1;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -483,7 +486,7 @@ static int virtio_gpu_get_caps_ioctl(str
 {
 	struct virtio_gpu_device *vgdev = dev->dev_private;
 	struct drm_virtgpu_get_caps *args = data;
-	int size;
+	unsigned size, host_caps_size;
 	int i;
 	int found_valid = -1;
 	int ret;
@@ -492,6 +495,10 @@ static int virtio_gpu_get_caps_ioctl(str
 	if (vgdev->num_capsets == 0)
 		return -ENOSYS;
 
+	/* don't allow userspace to pass 0 */
+	if (args->size == 0)
+		return -EINVAL;
+
 	spin_lock(&vgdev->display_info_lock);
 	for (i = 0; i < vgdev->num_capsets; i++) {
 		if (vgdev->capsets[i].id == args->cap_set_id) {
@@ -507,11 +514,9 @@ static int virtio_gpu_get_caps_ioctl(str
 		return -EINVAL;
 	}
 
-	size = vgdev->capsets[found_valid].max_size;
-	if (args->size > size) {
-		spin_unlock(&vgdev->display_info_lock);
-		return -EINVAL;
-	}
+	host_caps_size = vgdev->capsets[found_valid].max_size;
+	/* only copy to user the minimum of the host caps size or the guest caps size */
+	size = min(args->size, host_caps_size);
 
 	list_for_each_entry(cache_ent, &vgdev->cap_cache, head) {
 		if (cache_ent->id == args->cap_set_id &&
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/hid/hid-roccat-kovaplus.c linux-libre-4.4.134-gnu/drivers/hid/hid-roccat-kovaplus.c
--- linux-libre-4.4.133-gnu/drivers/hid/hid-roccat-kovaplus.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/hid/hid-roccat-kovaplus.c	2018-05-30 01:49:18.000000000 -0400
@@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(u
 static void kovaplus_profile_activated(struct kovaplus_device *kovaplus,
 		uint new_profile_index)
 {
+	if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings))
+		return;
 	kovaplus->actual_profile = new_profile_index;
 	kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level;
 	kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/hwmon/nct6775.c linux-libre-4.4.134-gnu/drivers/hwmon/nct6775.c
--- linux-libre-4.4.133-gnu/drivers/hwmon/nct6775.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/hwmon/nct6775.c	2018-05-30 01:49:18.000000000 -0400
@@ -1390,7 +1390,7 @@ static void nct6775_update_pwm(struct de
 		duty_is_dc = data->REG_PWM_MODE[i] &&
 		  (nct6775_read_value(data, data->REG_PWM_MODE[i])
 		   & data->PWM_MODE_MASK[i]);
-		data->pwm_mode[i] = duty_is_dc;
+		data->pwm_mode[i] = !duty_is_dc;
 
 		fanmodecfg = nct6775_read_value(data, data->REG_FAN_MODE[i]);
 		for (j = 0; j < ARRAY_SIZE(data->REG_PWM); j++) {
@@ -2267,7 +2267,7 @@ show_pwm_mode(struct device *dev, struct
 	struct nct6775_data *data = nct6775_update_device(dev);
 	struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
 
-	return sprintf(buf, "%d\n", !data->pwm_mode[sattr->index]);
+	return sprintf(buf, "%d\n", data->pwm_mode[sattr->index]);
 }
 
 static ssize_t
@@ -2288,9 +2288,9 @@ store_pwm_mode(struct device *dev, struc
 	if (val > 1)
 		return -EINVAL;
 
-	/* Setting DC mode is not supported for all chips/channels */
+	/* Setting DC mode (0) is not supported for all chips/channels */
 	if (data->REG_PWM_MODE[nr] == 0) {
-		if (val)
+		if (!val)
 			return -EINVAL;
 		return count;
 	}
@@ -2299,7 +2299,7 @@ store_pwm_mode(struct device *dev, struc
 	data->pwm_mode[nr] = val;
 	reg = nct6775_read_value(data, data->REG_PWM_MODE[nr]);
 	reg &= ~data->PWM_MODE_MASK[nr];
-	if (val)
+	if (!val)
 		reg |= data->PWM_MODE_MASK[nr];
 	nct6775_write_value(data, data->REG_PWM_MODE[nr], reg);
 	mutex_unlock(&data->update_lock);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/hwmon/pmbus/adm1275.c linux-libre-4.4.134-gnu/drivers/hwmon/pmbus/adm1275.c
--- linux-libre-4.4.133-gnu/drivers/hwmon/pmbus/adm1275.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/hwmon/pmbus/adm1275.c	2018-05-30 01:49:18.000000000 -0400
@@ -141,7 +141,7 @@ static int adm1275_read_word_data(struct
 	const struct adm1275_data *data = to_adm1275_data(info);
 	int ret = 0;
 
-	if (page)
+	if (page > 0)
 		return -ENXIO;
 
 	switch (reg) {
@@ -218,7 +218,7 @@ static int adm1275_write_word_data(struc
 	const struct adm1275_data *data = to_adm1275_data(info);
 	int ret;
 
-	if (page)
+	if (page > 0)
 		return -ENXIO;
 
 	switch (reg) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/hwmon/pmbus/max8688.c linux-libre-4.4.134-gnu/drivers/hwmon/pmbus/max8688.c
--- linux-libre-4.4.133-gnu/drivers/hwmon/pmbus/max8688.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/hwmon/pmbus/max8688.c	2018-05-30 01:49:18.000000000 -0400
@@ -45,7 +45,7 @@ static int max8688_read_word_data(struct
 {
 	int ret;
 
-	if (page)
+	if (page > 0)
 		return -ENXIO;
 
 	switch (reg) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/i2c/busses/i2c-mv64xxx.c linux-libre-4.4.134-gnu/drivers/i2c/busses/i2c-mv64xxx.c
--- linux-libre-4.4.133-gnu/drivers/i2c/busses/i2c-mv64xxx.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/i2c/busses/i2c-mv64xxx.c	2018-05-30 01:49:18.000000000 -0400
@@ -856,12 +856,16 @@ mv64xxx_of_config(struct mv64xxx_i2c_dat
 	 */
 	if (of_device_is_compatible(np, "marvell,mv78230-i2c")) {
 		drv_data->offload_enabled = true;
-		drv_data->errata_delay = true;
+		/* The delay is only needed in standard mode (100kHz) */
+		if (bus_freq <= 100000)
+			drv_data->errata_delay = true;
 	}
 
 	if (of_device_is_compatible(np, "marvell,mv78230-a0-i2c")) {
 		drv_data->offload_enabled = false;
-		drv_data->errata_delay = true;
+		/* The delay is only needed in standard mode (100kHz) */
+		if (bus_freq <= 100000)
+			drv_data->errata_delay = true;
 	}
 
 	if (of_device_is_compatible(np, "allwinner,sun6i-a31-i2c"))
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/ide/ide-cd.c linux-libre-4.4.134-gnu/drivers/ide/ide-cd.c
--- linux-libre-4.4.133-gnu/drivers/ide/ide-cd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/ide/ide-cd.c	2018-05-30 01:49:18.000000000 -0400
@@ -1593,6 +1593,8 @@ static int idecd_open(struct block_devic
 	struct cdrom_info *info;
 	int rc = -ENXIO;
 
+	check_disk_change(bdev);
+
 	mutex_lock(&ide_cd_mutex);
 	info = ide_cd_get(bdev->bd_disk);
 	if (!info)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/infiniband/core/ucma.c linux-libre-4.4.134-gnu/drivers/infiniband/core/ucma.c
--- linux-libre-4.4.133-gnu/drivers/infiniband/core/ucma.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/infiniband/core/ucma.c	2018-05-30 01:49:18.000000000 -0400
@@ -1295,7 +1295,7 @@ static ssize_t ucma_set_option(struct uc
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
 
-	if (unlikely(cmd.optval > KMALLOC_MAX_SIZE))
+	if (unlikely(cmd.optlen > KMALLOC_MAX_SIZE))
 		return -EINVAL;
 
 	optval = memdup_user((void __user *) (unsigned long) cmd.optval,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/infiniband/hw/mlx5/qp.c linux-libre-4.4.134-gnu/drivers/infiniband/hw/mlx5/qp.c
--- linux-libre-4.4.133-gnu/drivers/infiniband/hw/mlx5/qp.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/infiniband/hw/mlx5/qp.c	2018-05-30 01:49:18.000000000 -0400
@@ -3161,12 +3161,9 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd
 	int err;
 
 	err = mlx5_core_xrcd_dealloc(dev->mdev, xrcdn);
-	if (err) {
+	if (err)
 		mlx5_ib_warn(dev, "failed to dealloc xrcdn 0x%x\n", xrcdn);
-		return err;
-	}
 
 	kfree(xrcd);
-
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c linux-libre-4.4.134-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c
--- linux-libre-4.4.133-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c	2018-05-30 01:49:18.000000000 -0400
@@ -1953,6 +1953,9 @@ static struct net_device *ipoib_add_port
 		goto event_failed;
 	}
 
+	/* call event handler to ensure pkey in sync */
+	queue_work(ipoib_workqueue, &priv->flush_heavy);
+
 	result = register_netdev(priv->dev);
 	if (result) {
 		printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/irqchip/irq-gic-v3.c linux-libre-4.4.134-gnu/drivers/irqchip/irq-gic-v3.c
--- linux-libre-4.4.133-gnu/drivers/irqchip/irq-gic-v3.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/irqchip/irq-gic-v3.c	2018-05-30 01:49:18.000000000 -0400
@@ -589,7 +589,7 @@ static void gic_send_sgi(u64 cluster_id,
 	       MPIDR_TO_SGI_AFFINITY(cluster_id, 1)	|
 	       tlist << ICC_SGI1R_TARGET_LIST_SHIFT);
 
-	pr_debug("CPU%d: ICC_SGI1R_EL1 %llx\n", smp_processor_id(), val);
+	pr_devel("CPU%d: ICC_SGI1R_EL1 %llx\n", smp_processor_id(), val);
 	gic_write_sgi1r(val);
 }
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/alloc.c linux-libre-4.4.134-gnu/drivers/md/bcache/alloc.c
--- linux-libre-4.4.133-gnu/drivers/md/bcache/alloc.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/alloc.c	2018-05-30 01:49:18.000000000 -0400
@@ -285,8 +285,10 @@ do {									\
 			break;						\
 									\
 		mutex_unlock(&(ca)->set->bucket_lock);			\
-		if (kthread_should_stop())				\
+		if (kthread_should_stop()) {				\
+			set_current_state(TASK_RUNNING);		\
 			return 0;					\
+		}							\
 									\
 		try_to_freeze();					\
 		schedule();						\
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/bcache.h linux-libre-4.4.134-gnu/drivers/md/bcache/bcache.h
--- linux-libre-4.4.133-gnu/drivers/md/bcache/bcache.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/bcache.h	2018-05-30 01:49:18.000000000 -0400
@@ -904,7 +904,7 @@ void bcache_write_super(struct cache_set
 
 int bch_flash_dev_create(struct cache_set *c, uint64_t size);
 
-int bch_cached_dev_attach(struct cached_dev *, struct cache_set *);
+int bch_cached_dev_attach(struct cached_dev *, struct cache_set *, uint8_t *);
 void bch_cached_dev_detach(struct cached_dev *);
 void bch_cached_dev_run(struct cached_dev *);
 void bcache_device_stop(struct bcache_device *);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/btree.c linux-libre-4.4.134-gnu/drivers/md/bcache/btree.c
--- linux-libre-4.4.133-gnu/drivers/md/bcache/btree.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/btree.c	2018-05-30 01:49:18.000000000 -0400
@@ -1869,14 +1869,17 @@ void bch_initial_gc_finish(struct cache_
 	 */
 	for_each_cache(ca, c, i) {
 		for_each_bucket(b, ca) {
-			if (fifo_full(&ca->free[RESERVE_PRIO]))
+			if (fifo_full(&ca->free[RESERVE_PRIO]) &&
+			    fifo_full(&ca->free[RESERVE_BTREE]))
 				break;
 
 			if (bch_can_invalidate_bucket(ca, b) &&
 			    !GC_MARK(b)) {
 				__bch_invalidate_one_bucket(ca, b);
-				fifo_push(&ca->free[RESERVE_PRIO],
-					  b - ca->buckets);
+				if (!fifo_push(&ca->free[RESERVE_PRIO],
+				   b - ca->buckets))
+					fifo_push(&ca->free[RESERVE_BTREE],
+						  b - ca->buckets);
 			}
 		}
 	}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/request.c linux-libre-4.4.134-gnu/drivers/md/bcache/request.c
--- linux-libre-4.4.133-gnu/drivers/md/bcache/request.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/request.c	2018-05-30 01:49:18.000000000 -0400
@@ -633,11 +633,11 @@ static void do_bio_hook(struct search *s
 static void search_free(struct closure *cl)
 {
 	struct search *s = container_of(cl, struct search, cl);
-	bio_complete(s);
 
 	if (s->iop.bio)
 		bio_put(s->iop.bio);
 
+	bio_complete(s);
 	closure_debug_destroy(cl);
 	mempool_free(s, s->d->c->search);
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/super.c linux-libre-4.4.134-gnu/drivers/md/bcache/super.c
--- linux-libre-4.4.133-gnu/drivers/md/bcache/super.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/super.c	2018-05-30 01:49:18.000000000 -0400
@@ -936,7 +936,8 @@ void bch_cached_dev_detach(struct cached
 	cached_dev_put(dc);
 }
 
-int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
+int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
+			  uint8_t *set_uuid)
 {
 	uint32_t rtime = cpu_to_le32(get_seconds());
 	struct uuid_entry *u;
@@ -945,7 +946,8 @@ int bch_cached_dev_attach(struct cached_
 
 	bdevname(dc->bdev, buf);
 
-	if (memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16))
+	if ((set_uuid && memcmp(set_uuid, c->sb.set_uuid, 16)) ||
+	    (!set_uuid && memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16)))
 		return -ENOENT;
 
 	if (dc->disk.c) {
@@ -1189,7 +1191,7 @@ static void register_bdev(struct cache_s
 
 	list_add(&dc->list, &uncached_devices);
 	list_for_each_entry(c, &bch_cache_sets, list)
-		bch_cached_dev_attach(dc, c);
+		bch_cached_dev_attach(dc, c, NULL);
 
 	if (BDEV_STATE(&dc->sb) == BDEV_STATE_NONE ||
 	    BDEV_STATE(&dc->sb) == BDEV_STATE_STALE)
@@ -1711,7 +1713,7 @@ static void run_cache_set(struct cache_s
 	bcache_write_super(c);
 
 	list_for_each_entry_safe(dc, t, &uncached_devices, list)
-		bch_cached_dev_attach(dc, c);
+		bch_cached_dev_attach(dc, c, NULL);
 
 	flash_devs_run(c);
 
@@ -1828,6 +1830,7 @@ void bch_cache_release(struct kobject *k
 static int cache_alloc(struct cache_sb *sb, struct cache *ca)
 {
 	size_t free;
+	size_t btree_buckets;
 	struct bucket *b;
 
 	__module_get(THIS_MODULE);
@@ -1837,9 +1840,19 @@ static int cache_alloc(struct cache_sb *
 	ca->journal.bio.bi_max_vecs = 8;
 	ca->journal.bio.bi_io_vec = ca->journal.bio.bi_inline_vecs;
 
+	/*
+	 * when ca->sb.njournal_buckets is not zero, journal exists,
+	 * and in bch_journal_replay(), tree node may split,
+	 * so bucket of RESERVE_BTREE type is needed,
+	 * the worst situation is all journal buckets are valid journal,
+	 * and all the keys need to replay,
+	 * so the number of  RESERVE_BTREE type buckets should be as much
+	 * as journal buckets
+	 */
+	btree_buckets = ca->sb.njournal_buckets ?: 8;
 	free = roundup_pow_of_two(ca->sb.nbuckets) >> 10;
 
-	if (!init_fifo(&ca->free[RESERVE_BTREE], 8, GFP_KERNEL) ||
+	if (!init_fifo(&ca->free[RESERVE_BTREE], btree_buckets, GFP_KERNEL) ||
 	    !init_fifo_exact(&ca->free[RESERVE_PRIO], prio_buckets(ca), GFP_KERNEL) ||
 	    !init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL) ||
 	    !init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL) ||
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/sysfs.c linux-libre-4.4.134-gnu/drivers/md/bcache/sysfs.c
--- linux-libre-4.4.133-gnu/drivers/md/bcache/sysfs.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/sysfs.c	2018-05-30 01:49:18.000000000 -0400
@@ -191,7 +191,7 @@ STORE(__cached_dev)
 {
 	struct cached_dev *dc = container_of(kobj, struct cached_dev,
 					     disk.kobj);
-	ssize_t v = size;
+	ssize_t v;
 	struct cache_set *c;
 	struct kobj_uevent_env *env;
 
@@ -263,17 +263,20 @@ STORE(__cached_dev)
 	}
 
 	if (attr == &sysfs_attach) {
-		if (bch_parse_uuid(buf, dc->sb.set_uuid) < 16)
+		uint8_t		set_uuid[16];
+
+		if (bch_parse_uuid(buf, set_uuid) < 16)
 			return -EINVAL;
 
+		v = -ENOENT;
 		list_for_each_entry(c, &bch_cache_sets, list) {
-			v = bch_cached_dev_attach(dc, c);
+			v = bch_cached_dev_attach(dc, c, set_uuid);
 			if (!v)
 				return size;
 		}
 
 		pr_err("Can't attach %s: cache set not found", buf);
-		size = v;
+		return v;
 	}
 
 	if (attr == &sysfs_detach && dc->disk.c)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/bcache/writeback.c linux-libre-4.4.134-gnu/drivers/md/bcache/writeback.c
--- linux-libre-4.4.133-gnu/drivers/md/bcache/writeback.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/bcache/writeback.c	2018-05-30 01:49:18.000000000 -0400
@@ -425,19 +425,28 @@ static int bch_writeback_thread(void *ar
 
 	while (!kthread_should_stop()) {
 		down_write(&dc->writeback_lock);
-		if (!atomic_read(&dc->has_dirty) ||
-		    (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) &&
-		     !dc->writeback_running)) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		/*
+		 * If the bache device is detaching, skip here and continue
+		 * to perform writeback. Otherwise, if no dirty data on cache,
+		 * or there is dirty data on cache but writeback is disabled,
+		 * the writeback thread should sleep here and wait for others
+		 * to wake up it.
+		 */
+		if (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) &&
+		    (!atomic_read(&dc->has_dirty) || !dc->writeback_running)) {
 			up_write(&dc->writeback_lock);
-			set_current_state(TASK_INTERRUPTIBLE);
 
-			if (kthread_should_stop())
+			if (kthread_should_stop()) {
+				set_current_state(TASK_RUNNING);
 				return 0;
+			}
 
 			try_to_freeze();
 			schedule();
 			continue;
 		}
+		set_current_state(TASK_RUNNING);
 
 		searched_full_index = refill_dirty(dc);
 
@@ -447,6 +456,14 @@ static int bch_writeback_thread(void *ar
 			cached_dev_put(dc);
 			SET_BDEV_STATE(&dc->sb, BDEV_STATE_CLEAN);
 			bch_write_bdev_super(dc, NULL);
+			/*
+			 * If bcache device is detaching via sysfs interface,
+			 * writeback thread should stop after there is no dirty
+			 * data on cache. BCACHE_DEV_DETACHING flag is set in
+			 * bch_cached_dev_detach().
+			 */
+			if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags))
+				break;
 		}
 
 		up_write(&dc->writeback_lock);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/raid10.c linux-libre-4.4.134-gnu/drivers/md/raid10.c
--- linux-libre-4.4.133-gnu/drivers/md/raid10.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/raid10.c	2018-05-30 01:49:18.000000000 -0400
@@ -2630,7 +2630,8 @@ static void handle_write_completed(struc
 		for (m = 0; m < conf->copies; m++) {
 			int dev = r10_bio->devs[m].devnum;
 			rdev = conf->mirrors[dev].rdev;
-			if (r10_bio->devs[m].bio == NULL)
+			if (r10_bio->devs[m].bio == NULL ||
+				r10_bio->devs[m].bio->bi_end_io == NULL)
 				continue;
 			if (!r10_bio->devs[m].bio->bi_error) {
 				rdev_clear_badblocks(
@@ -2645,7 +2646,8 @@ static void handle_write_completed(struc
 					md_error(conf->mddev, rdev);
 			}
 			rdev = conf->mirrors[dev].replacement;
-			if (r10_bio->devs[m].repl_bio == NULL)
+			if (r10_bio->devs[m].repl_bio == NULL ||
+				r10_bio->devs[m].repl_bio->bi_end_io == NULL)
 				continue;
 
 			if (!r10_bio->devs[m].repl_bio->bi_error) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/raid1.c linux-libre-4.4.134-gnu/drivers/md/raid1.c
--- linux-libre-4.4.133-gnu/drivers/md/raid1.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/raid1.c	2018-05-30 01:49:18.000000000 -0400
@@ -1686,6 +1686,17 @@ static int raid1_remove_disk(struct mdde
 			struct md_rdev *repl =
 				conf->mirrors[conf->raid_disks + number].rdev;
 			freeze_array(conf, 0);
+			if (atomic_read(&repl->nr_pending)) {
+				/* It means that some queued IO of retry_list
+				 * hold repl. Thus, we cannot set replacement
+				 * as NULL, avoiding rdev NULL pointer
+				 * dereference in sync_request_write and
+				 * handle_write_finished.
+				 */
+				err = -EBUSY;
+				unfreeze_array(conf);
+				goto abort;
+			}
 			clear_bit(Replacement, &repl->flags);
 			p->rdev = repl;
 			conf->mirrors[conf->raid_disks + number].rdev = NULL;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/md/raid5.c linux-libre-4.4.134-gnu/drivers/md/raid5.c
--- linux-libre-4.4.133-gnu/drivers/md/raid5.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/md/raid5.c	2018-05-30 01:49:18.000000000 -0400
@@ -2028,15 +2028,16 @@ static int grow_one_stripe(struct r5conf
 static int grow_stripes(struct r5conf *conf, int num)
 {
 	struct kmem_cache *sc;
+	size_t namelen = sizeof(conf->cache_name[0]);
 	int devs = max(conf->raid_disks, conf->previous_raid_disks);
 
 	if (conf->mddev->gendisk)
-		sprintf(conf->cache_name[0],
+		snprintf(conf->cache_name[0], namelen,
 			"raid%d-%s", conf->level, mdname(conf->mddev));
 	else
-		sprintf(conf->cache_name[0],
+		snprintf(conf->cache_name[0], namelen,
 			"raid%d-%p", conf->level, conf->mddev);
-	sprintf(conf->cache_name[1], "%s-alt", conf->cache_name[0]);
+	snprintf(conf->cache_name[1], namelen, "%.27s-alt", conf->cache_name[0]);
 
 	conf->active_name = 0;
 	sc = kmem_cache_create(conf->cache_name[conf->active_name],
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/media/dvb-core/dmxdev.c linux-libre-4.4.134-gnu/drivers/media/dvb-core/dmxdev.c
--- linux-libre-4.4.133-gnu/drivers/media/dvb-core/dmxdev.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/media/dvb-core/dmxdev.c	2018-05-30 01:49:18.000000000 -0400
@@ -1071,7 +1071,7 @@ static int dvb_demux_do_ioctl(struct fil
 		break;
 
 	default:
-		ret = -EINVAL;
+		ret = -ENOTTY;
 		break;
 	}
 	mutex_unlock(&dmxdev->mutex);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/media/pci/cx23885/cx23885-cards.c linux-libre-4.4.134-gnu/drivers/media/pci/cx23885/cx23885-cards.c
--- linux-libre-4.4.133-gnu/drivers/media/pci/cx23885/cx23885-cards.c	2018-05-26 03:36:48.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/media/pci/cx23885/cx23885-cards.c	2018-05-30 02:52:24.000000000 -0400
@@ -2124,6 +2124,10 @@ void cx23885_card_setup(struct cx23885_d
 				&dev->i2c_bus[2].i2c_adap,
 				"cx25840", 0x88 >> 1, NULL);
 		if (dev->sd_cx25840) {
+			/* set host data for clk_freq configuration */
+			v4l2_set_subdev_hostdata(dev->sd_cx25840,
+						&dev->clk_freq);
+
 			dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE;
 			v4l2_subdev_call(dev->sd_cx25840, core, load_fw);
 		}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/media/pci/cx23885/cx23885-core.c linux-libre-4.4.134-gnu/drivers/media/pci/cx23885/cx23885-core.c
--- linux-libre-4.4.133-gnu/drivers/media/pci/cx23885/cx23885-core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/media/pci/cx23885/cx23885-core.c	2018-05-30 01:49:18.000000000 -0400
@@ -872,6 +872,16 @@ static int cx23885_dev_setup(struct cx23
 	if (cx23885_boards[dev->board].clk_freq > 0)
 		dev->clk_freq = cx23885_boards[dev->board].clk_freq;
 
+	if (dev->board == CX23885_BOARD_HAUPPAUGE_IMPACTVCBE &&
+		dev->pci->subsystem_device == 0x7137) {
+		/* Hauppauge ImpactVCBe device ID 0x7137 is populated
+		 * with an 888, and a 25Mhz crystal, instead of the
+		 * usual third overtone 50Mhz. The default clock rate must
+		 * be overridden so the cx25840 is properly configured
+		 */
+		dev->clk_freq = 25000000;
+	}
+
 	dev->pci_bus  = dev->pci->bus->number;
 	dev->pci_slot = PCI_SLOT(dev->pci->devfn);
 	cx23885_irq_add(dev, 0x001f00);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/media/pci/cx25821/cx25821-core.c linux-libre-4.4.134-gnu/drivers/media/pci/cx25821/cx25821-core.c
--- linux-libre-4.4.133-gnu/drivers/media/pci/cx25821/cx25821-core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/media/pci/cx25821/cx25821-core.c	2018-05-30 01:49:18.000000000 -0400
@@ -871,6 +871,10 @@ static int cx25821_dev_setup(struct cx25
 	dev->nr = ++cx25821_devcount;
 	sprintf(dev->name, "cx25821[%d]", dev->nr);
 
+	if (dev->nr >= ARRAY_SIZE(card)) {
+		CX25821_INFO("dev->nr >= %zd", ARRAY_SIZE(card));
+		return -ENODEV;
+	}
 	if (dev->pci->device != 0x8210) {
 		pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n",
 			__func__, dev->pci->device);
@@ -886,9 +890,6 @@ static int cx25821_dev_setup(struct cx25
 		dev->channels[i].sram_channels = &cx25821_sram_channels[i];
 	}
 
-	if (dev->nr > 1)
-		CX25821_INFO("dev->nr > 1!");
-
 	/* board config */
 	dev->board = 1;		/* card[dev->nr]; */
 	dev->_max_num_decoders = MAX_DECODERS;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/media/platform/s3c-camif/camif-capture.c linux-libre-4.4.134-gnu/drivers/media/platform/s3c-camif/camif-capture.c
--- linux-libre-4.4.133-gnu/drivers/media/platform/s3c-camif/camif-capture.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/media/platform/s3c-camif/camif-capture.c	2018-05-30 01:49:18.000000000 -0400
@@ -1268,16 +1268,17 @@ static void __camif_subdev_try_format(st
 {
 	const struct s3c_camif_variant *variant = camif->variant;
 	const struct vp_pix_limits *pix_lim;
-	int i = ARRAY_SIZE(camif_mbus_formats);
+	unsigned int i;
 
 	/* FIXME: constraints against codec or preview path ? */
 	pix_lim = &variant->vp_pix_limits[VP_CODEC];
 
-	while (i-- >= 0)
+	for (i = 0; i < ARRAY_SIZE(camif_mbus_formats); i++)
 		if (camif_mbus_formats[i] == mf->code)
 			break;
 
-	mf->code = camif_mbus_formats[i];
+	if (i == ARRAY_SIZE(camif_mbus_formats))
+		mf->code = camif_mbus_formats[0];
 
 	if (pad == CAMIF_SD_PAD_SINK) {
 		v4l_bound_align_image(&mf->width, 8, CAMIF_MAX_PIX_WIDTH,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/media/usb/em28xx/em28xx.h linux-libre-4.4.134-gnu/drivers/media/usb/em28xx/em28xx.h
--- linux-libre-4.4.133-gnu/drivers/media/usb/em28xx/em28xx.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/media/usb/em28xx/em28xx.h	2018-05-30 01:49:18.000000000 -0400
@@ -187,7 +187,7 @@
    USB 2.0 spec says bulk packet size is always 512 bytes
  */
 #define EM28XX_BULK_PACKET_MULTIPLIER 384
-#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 384
+#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 94
 
 #define EM28XX_INTERLACED_DEFAULT 1
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/message/fusion/mptctl.c linux-libre-4.4.134-gnu/drivers/message/fusion/mptctl.c
--- linux-libre-4.4.133-gnu/drivers/message/fusion/mptctl.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/message/fusion/mptctl.c	2018-05-30 01:49:18.000000000 -0400
@@ -2698,6 +2698,8 @@ mptctl_hp_targetinfo(unsigned long arg)
 				__FILE__, __LINE__, iocnum);
 		return -ENODEV;
 	}
+	if (karg.hdr.id >= MPT_MAX_FC_DEVICES)
+		return -EINVAL;
 	dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
 	    ioc->name));
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/mmc/host/sdhci-iproc.c linux-libre-4.4.134-gnu/drivers/mmc/host/sdhci-iproc.c
--- linux-libre-4.4.133-gnu/drivers/mmc/host/sdhci-iproc.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/mmc/host/sdhci-iproc.c	2018-05-30 01:49:18.000000000 -0400
@@ -32,6 +32,8 @@ struct sdhci_iproc_host {
 	const struct sdhci_iproc_data *data;
 	u32 shadow_cmd;
 	u32 shadow_blk;
+	bool is_cmd_shadowed;
+	bool is_blk_shadowed;
 };
 
 #define REG_OFFSET_IN_BITS(reg) ((reg) << 3 & 0x18)
@@ -47,8 +49,22 @@ static inline u32 sdhci_iproc_readl(stru
 
 static u16 sdhci_iproc_readw(struct sdhci_host *host, int reg)
 {
-	u32 val = sdhci_iproc_readl(host, (reg & ~3));
-	u16 word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff;
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_iproc_host *iproc_host = sdhci_pltfm_priv(pltfm_host);
+	u32 val;
+	u16 word;
+
+	if ((reg == SDHCI_TRANSFER_MODE) && iproc_host->is_cmd_shadowed) {
+		/* Get the saved transfer mode */
+		val = iproc_host->shadow_cmd;
+	} else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) &&
+		   iproc_host->is_blk_shadowed) {
+		/* Get the saved block info */
+		val = iproc_host->shadow_blk;
+	} else {
+		val = sdhci_iproc_readl(host, (reg & ~3));
+	}
+	word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff;
 	return word;
 }
 
@@ -104,13 +120,15 @@ static void sdhci_iproc_writew(struct sd
 
 	if (reg == SDHCI_COMMAND) {
 		/* Write the block now as we are issuing a command */
-		if (iproc_host->shadow_blk != 0) {
+		if (iproc_host->is_blk_shadowed) {
 			sdhci_iproc_writel(host, iproc_host->shadow_blk,
 				SDHCI_BLOCK_SIZE);
-			iproc_host->shadow_blk = 0;
+			iproc_host->is_blk_shadowed = false;
 		}
 		oldval = iproc_host->shadow_cmd;
-	} else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) {
+		iproc_host->is_cmd_shadowed = false;
+	} else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) &&
+		   iproc_host->is_blk_shadowed) {
 		/* Block size and count are stored in shadow reg */
 		oldval = iproc_host->shadow_blk;
 	} else {
@@ -122,9 +140,11 @@ static void sdhci_iproc_writew(struct sd
 	if (reg == SDHCI_TRANSFER_MODE) {
 		/* Save the transfer mode until the command is issued */
 		iproc_host->shadow_cmd = newval;
+		iproc_host->is_cmd_shadowed = true;
 	} else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) {
 		/* Save the block info until the command is issued */
 		iproc_host->shadow_blk = newval;
+		iproc_host->is_blk_shadowed = true;
 	} else {
 		/* Command or other regular 32-bit write */
 		sdhci_iproc_writel(host, newval, reg & ~3);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/broadcom/bgmac.c linux-libre-4.4.134-gnu/drivers/net/ethernet/broadcom/bgmac.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/broadcom/bgmac.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/broadcom/bgmac.c	2018-05-30 01:49:18.000000000 -0400
@@ -531,7 +531,8 @@ static void bgmac_dma_tx_ring_free(struc
 	int i;
 
 	for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) {
-		int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN;
+		u32 ctl1 = le32_to_cpu(dma_desc[i].ctl1);
+		unsigned int len = ctl1 & BGMAC_DESC_CTL1_LEN;
 
 		slot = &ring->slots[i];
 		dev_kfree_skb(slot->skb);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c linux-libre-4.4.134-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2018-05-30 01:49:18.000000000 -0400
@@ -2925,6 +2925,9 @@ static int bnxt_hwrm_vnic_set_tpa(struct
 	struct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id];
 	struct hwrm_vnic_tpa_cfg_input req = {0};
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+		return 0;
+
 	bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_VNIC_TPA_CFG, -1, -1);
 
 	if (tpa_flags) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/cisco/enic/enic_main.c linux-libre-4.4.134-gnu/drivers/net/ethernet/cisco/enic/enic_main.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/cisco/enic/enic_main.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/cisco/enic/enic_main.c	2018-05-30 01:49:18.000000000 -0400
@@ -1726,6 +1726,8 @@ static int enic_open(struct net_device *
 	}
 
 	for (i = 0; i < enic->rq_count; i++) {
+		/* enable rq before updating rq desc */
+		vnic_rq_enable(&enic->rq[i]);
 		vnic_rq_fill(&enic->rq[i], enic_rq_alloc_buf);
 		/* Need at least one buffer on ring to get going */
 		if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
@@ -1737,8 +1739,6 @@ static int enic_open(struct net_device *
 
 	for (i = 0; i < enic->wq_count; i++)
 		vnic_wq_enable(&enic->wq[i]);
-	for (i = 0; i < enic->rq_count; i++)
-		vnic_rq_enable(&enic->rq[i]);
 
 	if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
 		enic_dev_add_station_addr(enic);
@@ -1765,8 +1765,12 @@ static int enic_open(struct net_device *
 	return 0;
 
 err_out_free_rq:
-	for (i = 0; i < enic->rq_count; i++)
+	for (i = 0; i < enic->rq_count; i++) {
+		err = vnic_rq_disable(&enic->rq[i]);
+		if (err)
+			return err;
 		vnic_rq_clean(&enic->rq[i], enic_free_rq_buf);
+	}
 	enic_dev_notify_unset(enic);
 err_out_free_intr:
 	enic_unset_affinity_hint(enic);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/freescale/gianfar.c linux-libre-4.4.134-gnu/drivers/net/ethernet/freescale/gianfar.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/freescale/gianfar.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/freescale/gianfar.c	2018-05-30 01:49:18.000000000 -0400
@@ -3053,9 +3053,6 @@ static void gfar_process_frame(struct ne
 	if (ndev->features & NETIF_F_RXCSUM)
 		gfar_rx_checksum(skb, fcb);
 
-	/* Tell the skb what kind of packet this is */
-	skb->protocol = eth_type_trans(skb, ndev);
-
 	/* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here.
 	 * Even if vlan rx accel is disabled, on some chips
 	 * RXFCB_VLN is pseudo randomly set.
@@ -3126,13 +3123,15 @@ int gfar_clean_rx_ring(struct gfar_priv_
 			continue;
 		}
 
+		gfar_process_frame(ndev, skb);
+
 		/* Increment the number of packets */
 		total_pkts++;
 		total_bytes += skb->len;
 
 		skb_record_rx_queue(skb, rx_queue->qindex);
 
-		gfar_process_frame(ndev, skb);
+		skb->protocol = eth_type_trans(skb, ndev);
 
 		/* Send the packet up the stack */
 		napi_gro_receive(&rx_queue->grp->napi_rx, skb);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c linux-libre-4.4.134-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c	2018-05-30 01:49:18.000000000 -0400
@@ -1574,7 +1574,7 @@ static s32 e1000_check_for_copper_link_i
 	 * we have already determined whether we have link or not.
 	 */
 	if (!mac->autoneg)
-		return -E1000_ERR_CONFIG;
+		return 1;
 
 	/* Auto-Neg is enabled.  Auto Speed Detection takes care
 	 * of MAC speed/duplex configuration.  So we only need to
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/intel/e1000e/mac.c linux-libre-4.4.134-gnu/drivers/net/ethernet/intel/e1000e/mac.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/intel/e1000e/mac.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/intel/e1000e/mac.c	2018-05-30 01:49:18.000000000 -0400
@@ -450,7 +450,7 @@ s32 e1000e_check_for_copper_link(struct
 	 * we have already determined whether we have link or not.
 	 */
 	if (!mac->autoneg)
-		return -E1000_ERR_CONFIG;
+		return 1;
 
 	/* Auto-Neg is enabled.  Auto Speed Detection takes care
 	 * of MAC speed/duplex configuration.  So we only need to
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/intel/e1000e/netdev.c linux-libre-4.4.134-gnu/drivers/net/ethernet/intel/e1000e/netdev.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/intel/e1000e/netdev.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/intel/e1000e/netdev.c	2018-05-30 01:49:18.000000000 -0400
@@ -2330,8 +2330,8 @@ static int e1000_alloc_ring_dma(struct e
 {
 	struct pci_dev *pdev = adapter->pdev;
 
-	ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma,
-					GFP_KERNEL);
+	ring->desc = dma_zalloc_coherent(&pdev->dev, ring->size, &ring->dma,
+					 GFP_KERNEL);
 	if (!ring->desc)
 		return -ENOMEM;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/marvell/mvneta.c linux-libre-4.4.134-gnu/drivers/net/ethernet/marvell/mvneta.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/marvell/mvneta.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/marvell/mvneta.c	2018-05-30 01:49:18.000000000 -0400
@@ -818,6 +818,7 @@ static void mvneta_port_up(struct mvneta
 	}
 	mvreg_write(pp, MVNETA_TXQ_CMD, q_map);
 
+	q_map = 0;
 	/* Enable all initialized RXQs. */
 	mvreg_write(pp, MVNETA_RXQ_CMD, BIT(rxq_def));
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c linux-libre-4.4.134-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c	2018-05-30 01:49:18.000000000 -0400
@@ -1623,7 +1623,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *
 
 	cmd->checksum_disabled = 1;
 	cmd->max_reg_cmds = (1 << cmd->log_sz) - 1;
-	cmd->bitmask = (1 << cmd->max_reg_cmds) - 1;
+	cmd->bitmask = (1UL << cmd->max_reg_cmds) - 1;
 
 	cmd->cmdif_rev = ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
 	if (cmd->cmdif_rev > CMD_IF_REV) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/ethernet/sun/sunvnet.c linux-libre-4.4.134-gnu/drivers/net/ethernet/sun/sunvnet.c
--- linux-libre-4.4.133-gnu/drivers/net/ethernet/sun/sunvnet.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/ethernet/sun/sunvnet.c	2018-05-30 01:49:18.000000000 -0400
@@ -1787,7 +1787,7 @@ static struct vnet *vnet_new(const u64 *
 	dev->ethtool_ops = &vnet_ethtool_ops;
 	dev->watchdog_timeo = VNET_TX_TIMEOUT;
 
-	dev->hw_features = NETIF_F_TSO | NETIF_F_GSO | NETIF_F_GSO_SOFTWARE |
+	dev->hw_features = NETIF_F_TSO | NETIF_F_GSO | NETIF_F_ALL_TSO |
 			   NETIF_F_HW_CSUM | NETIF_F_SG;
 	dev->features = dev->hw_features;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/phy/dp83640.c linux-libre-4.4.134-gnu/drivers/net/phy/dp83640.c
--- linux-libre-4.4.133-gnu/drivers/net/phy/dp83640.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/phy/dp83640.c	2018-05-30 01:49:18.000000000 -0400
@@ -1203,6 +1203,23 @@ static void dp83640_remove(struct phy_de
 	kfree(dp83640);
 }
 
+static int dp83640_soft_reset(struct phy_device *phydev)
+{
+	int ret;
+
+	ret = genphy_soft_reset(phydev);
+	if (ret < 0)
+		return ret;
+
+	/* From DP83640 datasheet: "Software driver code must wait 3 us
+	 * following a software reset before allowing further serial MII
+	 * operations with the DP83640."
+	 */
+	udelay(10);		/* Taking udelay inaccuracy into account */
+
+	return 0;
+}
+
 static int dp83640_config_init(struct phy_device *phydev)
 {
 	struct dp83640_private *dp83640 = phydev->priv;
@@ -1496,6 +1513,7 @@ static struct phy_driver dp83640_driver
 	.flags		= PHY_HAS_INTERRUPT,
 	.probe		= dp83640_probe,
 	.remove		= dp83640_remove,
+	.soft_reset	= dp83640_soft_reset,
 	.config_init	= dp83640_config_init,
 	.config_aneg	= genphy_config_aneg,
 	.read_status	= genphy_read_status,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/usb/qmi_wwan.c linux-libre-4.4.134-gnu/drivers/net/usb/qmi_wwan.c
--- linux-libre-4.4.133-gnu/drivers/net/usb/qmi_wwan.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/usb/qmi_wwan.c	2018-05-30 01:49:18.000000000 -0400
@@ -637,6 +637,9 @@ static const struct usb_device_id produc
 	{QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
 	{QMI_FIXED_INTF(0x12d1, 0x140c, 1)},	/* Huawei E173 */
 	{QMI_FIXED_INTF(0x12d1, 0x14ac, 1)},	/* Huawei E1820 */
+	{QMI_FIXED_INTF(0x1435, 0xd181, 3)},	/* Wistron NeWeb D18Q1 */
+	{QMI_FIXED_INTF(0x1435, 0xd181, 4)},	/* Wistron NeWeb D18Q1 */
+	{QMI_FIXED_INTF(0x1435, 0xd181, 5)},	/* Wistron NeWeb D18Q1 */
 	{QMI_FIXED_INTF(0x16d8, 0x6003, 0)},	/* CMOTech 6003 */
 	{QMI_FIXED_INTF(0x16d8, 0x6007, 0)},	/* CMOTech CHE-628S */
 	{QMI_FIXED_INTF(0x16d8, 0x6008, 0)},	/* CMOTech CMU-301 */
@@ -713,6 +716,7 @@ static const struct usb_device_id produc
 	{QMI_FIXED_INTF(0x19d2, 0x2002, 4)},	/* ZTE (Vodafone) K3765-Z */
 	{QMI_FIXED_INTF(0x2001, 0x7e19, 4)},	/* D-Link DWM-221 B1 */
 	{QMI_FIXED_INTF(0x2001, 0x7e35, 4)},	/* D-Link DWM-222 */
+	{QMI_FIXED_INTF(0x2020, 0x2033, 4)},	/* BroadMobi BM806U */
 	{QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)},    /* Sierra Wireless MC7700 */
 	{QMI_FIXED_INTF(0x114f, 0x68a2, 8)},    /* Sierra Wireless MC7750 */
 	{QMI_FIXED_INTF(0x1199, 0x68a2, 8)},	/* Sierra Wireless MC7710 in QMI mode */
@@ -762,6 +766,7 @@ static const struct usb_device_id produc
 	{QMI_FIXED_INTF(0x413c, 0x81a9, 8)},	/* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x413c, 0x81b1, 8)},	/* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
 	{QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)},	/* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
+	{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)},	/* HP lt4120 Snapdragon X5 LTE */
 	{QMI_FIXED_INTF(0x22de, 0x9061, 3)},	/* WeTelecom WPD-600N */
 	{QMI_FIXED_INTF(0x1e0e, 0x9001, 5)},	/* SIMCom 7230E */
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/usb/r8152.c linux-libre-4.4.134-gnu/drivers/net/usb/r8152.c
--- linux-libre-4.4.133-gnu/drivers/net/usb/r8152.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/usb/r8152.c	2018-05-30 01:49:18.000000000 -0400
@@ -1610,7 +1610,7 @@ static int r8152_tx_agg_fill(struct r815
 
 		tx_data += len;
 		agg->skb_len += len;
-		agg->skb_num++;
+		agg->skb_num += skb_shinfo(skb)->gso_segs ?: 1;
 
 		dev_kfree_skb_any(skb);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/usb/smsc75xx.c linux-libre-4.4.134-gnu/drivers/net/usb/smsc75xx.c
--- linux-libre-4.4.133-gnu/drivers/net/usb/smsc75xx.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/usb/smsc75xx.c	2018-05-30 01:49:18.000000000 -0400
@@ -945,10 +945,11 @@ static int smsc75xx_set_features(struct
 	/* it's racing here! */
 
 	ret = smsc75xx_write_reg(dev, RFE_CTL, pdata->rfe_ctl);
-	if (ret < 0)
+	if (ret < 0) {
 		netdev_warn(dev->net, "Error writing RFE_CTL\n");
-
-	return ret;
+		return ret;
+	}
+	return 0;
 }
 
 static int smsc75xx_wait_ready(struct usbnet *dev, int in_pm)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/virtio_net.c linux-libre-4.4.134-gnu/drivers/net/virtio_net.c
--- linux-libre-4.4.133-gnu/drivers/net/virtio_net.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/virtio_net.c	2018-05-30 01:49:18.000000000 -0400
@@ -1912,8 +1912,8 @@ static int virtnet_probe(struct virtio_d
 
 	/* Assume link up if device can't report link status,
 	   otherwise get link status from config. */
+	netif_carrier_off(dev);
 	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
-		netif_carrier_off(dev);
 		schedule_work(&vi->config_work);
 	} else {
 		vi->status = VIRTIO_NET_S_LINK_UP;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/wireless/ath/ath10k/mac.c linux-libre-4.4.134-gnu/drivers/net/wireless/ath/ath10k/mac.c
--- linux-libre-4.4.133-gnu/drivers/net/wireless/ath/ath10k/mac.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/wireless/ath/ath10k/mac.c	2018-05-30 01:49:18.000000000 -0400
@@ -6311,10 +6311,20 @@ static void ath10k_sta_rc_update(struct
 {
 	struct ath10k *ar = hw->priv;
 	struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+	struct ath10k_vif *arvif = (void *)vif->drv_priv;
+	struct ath10k_peer *peer;
 	u32 bw, smps;
 
 	spin_lock_bh(&ar->data_lock);
 
+	peer = ath10k_peer_find(ar, arvif->vdev_id, sta->addr);
+	if (!peer) {
+		spin_unlock_bh(&ar->data_lock);
+		ath10k_warn(ar, "mac sta rc update failed to find peer %pM on vdev %i\n",
+			    sta->addr, arvif->vdev_id);
+		return;
+	}
+
 	ath10k_dbg(ar, ATH10K_DBG_MAC,
 		   "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n",
 		   sta->addr, changed, sta->bandwidth, sta->rx_nss,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/wireless/mac80211_hwsim.c linux-libre-4.4.134-gnu/drivers/net/wireless/mac80211_hwsim.c
--- linux-libre-4.4.133-gnu/drivers/net/wireless/mac80211_hwsim.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/wireless/mac80211_hwsim.c	2018-05-30 01:49:18.000000000 -0400
@@ -2925,8 +2925,10 @@ static int hwsim_new_radio_nl(struct sk_
 	if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
 		u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
 
-		if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
+		if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom)) {
+			kfree(hwname);
 			return -EINVAL;
+		}
 		param.regd = hwsim_world_regdom_custom[idx];
 	}
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/net/xen-netfront.c linux-libre-4.4.134-gnu/drivers/net/xen-netfront.c
--- linux-libre-4.4.133-gnu/drivers/net/xen-netfront.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/net/xen-netfront.c	2018-05-30 01:49:18.000000000 -0400
@@ -342,6 +342,9 @@ static int xennet_open(struct net_device
 	unsigned int i = 0;
 	struct netfront_queue *queue = NULL;
 
+	if (!np->queues)
+		return -ENODEV;
+
 	for (i = 0; i < num_queues; ++i) {
 		queue = &np->queues[i];
 		napi_enable(&queue->napi);
@@ -1363,18 +1366,8 @@ static int netfront_probe(struct xenbus_
 #ifdef CONFIG_SYSFS
 	info->netdev->sysfs_groups[0] = &xennet_dev_group;
 #endif
-	err = register_netdev(info->netdev);
-	if (err) {
-		pr_warn("%s: register_netdev err=%d\n", __func__, err);
-		goto fail;
-	}
 
 	return 0;
-
- fail:
-	xennet_free_netdev(netdev);
-	dev_set_drvdata(&dev->dev, NULL);
-	return err;
 }
 
 static void xennet_end_access(int ref, void *page)
@@ -1743,8 +1736,6 @@ static void xennet_destroy_queues(struct
 {
 	unsigned int i;
 
-	rtnl_lock();
-
 	for (i = 0; i < info->netdev->real_num_tx_queues; i++) {
 		struct netfront_queue *queue = &info->queues[i];
 
@@ -1753,8 +1744,6 @@ static void xennet_destroy_queues(struct
 		netif_napi_del(&queue->napi);
 	}
 
-	rtnl_unlock();
-
 	kfree(info->queues);
 	info->queues = NULL;
 }
@@ -1770,8 +1759,6 @@ static int xennet_create_queues(struct n
 	if (!info->queues)
 		return -ENOMEM;
 
-	rtnl_lock();
-
 	for (i = 0; i < *num_queues; i++) {
 		struct netfront_queue *queue = &info->queues[i];
 
@@ -1780,7 +1767,7 @@ static int xennet_create_queues(struct n
 
 		ret = xennet_init_queue(queue);
 		if (ret < 0) {
-			dev_warn(&info->netdev->dev,
+			dev_warn(&info->xbdev->dev,
 				 "only created %d queues\n", i);
 			*num_queues = i;
 			break;
@@ -1794,10 +1781,8 @@ static int xennet_create_queues(struct n
 
 	netif_set_real_num_tx_queues(info->netdev, *num_queues);
 
-	rtnl_unlock();
-
 	if (*num_queues == 0) {
-		dev_err(&info->netdev->dev, "no queues\n");
+		dev_err(&info->xbdev->dev, "no queues\n");
 		return -EINVAL;
 	}
 	return 0;
@@ -1839,6 +1824,7 @@ static int talk_to_netback(struct xenbus
 		goto out;
 	}
 
+	rtnl_lock();
 	if (info->queues)
 		xennet_destroy_queues(info);
 
@@ -1849,6 +1835,7 @@ static int talk_to_netback(struct xenbus
 		info->queues = NULL;
 		goto out;
 	}
+	rtnl_unlock();
 
 	/* Create shared ring, alloc event channel -- for each queue */
 	for (i = 0; i < num_queues; ++i) {
@@ -1945,8 +1932,10 @@ abort_transaction_no_dev_fatal:
 	xenbus_transaction_end(xbt, 1);
  destroy_ring:
 	xennet_disconnect_backend(info);
+	rtnl_lock();
 	xennet_destroy_queues(info);
  out:
+	rtnl_unlock();
 	device_unregister(&dev->dev);
 	return err;
 }
@@ -1982,6 +1971,15 @@ static int xennet_connect(struct net_dev
 	netdev_update_features(dev);
 	rtnl_unlock();
 
+	if (dev->reg_state == NETREG_UNINITIALIZED) {
+		err = register_netdev(dev);
+		if (err) {
+			pr_warn("%s: register_netdev err=%d\n", __func__, err);
+			device_unregister(&np->xbdev->dev);
+			return err;
+		}
+	}
+
 	/*
 	 * All public and private state should now be sane.  Get
 	 * ready to start sending and receiving packets and give the driver
@@ -2172,10 +2170,14 @@ static int xennet_remove(struct xenbus_d
 
 	xennet_disconnect_backend(info);
 
-	unregister_netdev(info->netdev);
+	if (info->netdev->reg_state == NETREG_REGISTERED)
+		unregister_netdev(info->netdev);
 
-	if (info->queues)
+	if (info->queues) {
+		rtnl_lock();
 		xennet_destroy_queues(info);
+		rtnl_unlock();
+	}
 	xennet_free_netdev(info->netdev);
 
 	return 0;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/ntb/ntb_transport.c linux-libre-4.4.134-gnu/drivers/ntb/ntb_transport.c
--- linux-libre-4.4.133-gnu/drivers/ntb/ntb_transport.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/ntb/ntb_transport.c	2018-05-30 01:49:18.000000000 -0400
@@ -955,6 +955,9 @@ static int ntb_transport_init_queue(stru
 	mw_base = nt->mw_vec[mw_num].phys_addr;
 	mw_size = nt->mw_vec[mw_num].phys_size;
 
+	if (max_mw_size && mw_size > max_mw_size)
+		mw_size = max_mw_size;
+
 	tx_size = (unsigned int)mw_size / num_qps_mw;
 	qp_offset = tx_size * (qp_num / mw_count);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/nvme/host/pci.c linux-libre-4.4.134-gnu/drivers/nvme/host/pci.c
--- linux-libre-4.4.133-gnu/drivers/nvme/host/pci.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/nvme/host/pci.c	2018-05-30 01:49:18.000000000 -0400
@@ -1583,7 +1583,7 @@ static int nvme_create_queue(struct nvme
 	nvmeq->cq_vector = qid - 1;
 	result = adapter_alloc_cq(dev, qid, nvmeq);
 	if (result < 0)
-		return result;
+		goto release_vector;
 
 	result = adapter_alloc_sq(dev, qid, nvmeq);
 	if (result < 0)
@@ -1597,9 +1597,12 @@ static int nvme_create_queue(struct nvme
 	return result;
 
  release_sq:
+	dev->online_queues--;
 	adapter_delete_sq(dev, qid);
  release_cq:
 	adapter_delete_cq(dev, qid);
+ release_vector:
+	nvmeq->cq_vector = -1;
 	return result;
 }
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/parisc/lba_pci.c linux-libre-4.4.134-gnu/drivers/parisc/lba_pci.c
--- linux-libre-4.4.133-gnu/drivers/parisc/lba_pci.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/parisc/lba_pci.c	2018-05-30 01:49:18.000000000 -0400
@@ -1365,9 +1365,27 @@ lba_hw_init(struct lba_device *d)
 		WRITE_REG32(stat, d->hba.base_addr + LBA_ERROR_CONFIG);
 	}
 
-	/* Set HF mode as the default (vs. -1 mode). */
+
+	/*
+	 * Hard Fail vs. Soft Fail on PCI "Master Abort".
+	 *
+	 * "Master Abort" means the MMIO transaction timed out - usually due to
+	 * the device not responding to an MMIO read. We would like HF to be
+	 * enabled to find driver problems, though it means the system will
+	 * crash with a HPMC.
+	 *
+	 * In SoftFail mode "~0L" is returned as a result of a timeout on the
+	 * pci bus. This is like how PCI busses on x86 and most other
+	 * architectures behave.  In order to increase compatibility with
+	 * existing (x86) PCI hardware and existing Linux drivers we enable
+	 * Soft Faul mode on PA-RISC now too.
+	 */
         stat = READ_REG32(d->hba.base_addr + LBA_STAT_CTL);
+#if defined(ENABLE_HARDFAIL)
 	WRITE_REG32(stat | HF_ENABLE, d->hba.base_addr + LBA_STAT_CTL);
+#else
+	WRITE_REG32(stat & ~HF_ENABLE, d->hba.base_addr + LBA_STAT_CTL);
+#endif
 
 	/*
 	** Writing a zero to STAT_CTL.rf (bit 0) will clear reset signal
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/pci/pci-driver.c linux-libre-4.4.134-gnu/drivers/pci/pci-driver.c
--- linux-libre-4.4.133-gnu/drivers/pci/pci-driver.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/pci/pci-driver.c	2018-05-30 01:49:18.000000000 -0400
@@ -1140,11 +1140,14 @@ static int pci_pm_runtime_suspend(struct
 	int error;
 
 	/*
-	 * If pci_dev->driver is not set (unbound), the device should
-	 * always remain in D0 regardless of the runtime PM status
+	 * If pci_dev->driver is not set (unbound), we leave the device in D0,
+	 * but it may go to D3cold when the bridge above it runtime suspends.
+	 * Save its config space in case that happens.
 	 */
-	if (!pci_dev->driver)
+	if (!pci_dev->driver) {
+		pci_save_state(pci_dev);
 		return 0;
+	}
 
 	if (!pm || !pm->runtime_suspend)
 		return -ENOSYS;
@@ -1195,16 +1198,18 @@ static int pci_pm_runtime_resume(struct
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
 	/*
-	 * If pci_dev->driver is not set (unbound), the device should
-	 * always remain in D0 regardless of the runtime PM status
+	 * Restoring config space is necessary even if the device is not bound
+	 * to a driver because although we left it in D0, it may have gone to
+	 * D3cold when the bridge above it runtime suspended.
 	 */
+	pci_restore_standard_config(pci_dev);
+
 	if (!pci_dev->driver)
 		return 0;
 
 	if (!pm || !pm->runtime_resume)
 		return -ENOSYS;
 
-	pci_restore_standard_config(pci_dev);
 	pci_fixup_device(pci_fixup_resume_early, pci_dev);
 	__pci_enable_wake(pci_dev, PCI_D0, true, false);
 	pci_fixup_device(pci_fixup_resume, pci_dev);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/pci/quirks.c linux-libre-4.4.134-gnu/drivers/pci/quirks.c
--- linux-libre-4.4.133-gnu/drivers/pci/quirks.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/pci/quirks.c	2018-05-30 01:49:18.000000000 -0400
@@ -3614,6 +3614,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M
 			 quirk_dma_func1_alias);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123,
 			 quirk_dma_func1_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128,
+			 quirk_dma_func1_alias);
 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130,
 			 quirk_dma_func1_alias);
@@ -3626,6 +3628,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M
 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0,
 			 quirk_dma_func1_alias);
+/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9220,
+			 quirk_dma_func1_alias);
 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230,
 			 quirk_dma_func1_alias);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/regulator/of_regulator.c linux-libre-4.4.134-gnu/drivers/regulator/of_regulator.c
--- linux-libre-4.4.133-gnu/drivers/regulator/of_regulator.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/regulator/of_regulator.c	2018-05-30 01:49:18.000000000 -0400
@@ -274,6 +274,7 @@ int of_regulator_match(struct device *de
 				dev_err(dev,
 					"failed to parse DT for regulator %s\n",
 					child->name);
+				of_node_put(child);
 				return -EINVAL;
 			}
 			match->of_node = of_node_get(child);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/rtc/hctosys.c linux-libre-4.4.134-gnu/drivers/rtc/hctosys.c
--- linux-libre-4.4.133-gnu/drivers/rtc/hctosys.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/rtc/hctosys.c	2018-05-30 01:49:18.000000000 -0400
@@ -49,6 +49,11 @@ static int __init rtc_hctosys(void)
 
 	tv64.tv_sec = rtc_tm_to_time64(&tm);
 
+#if BITS_PER_LONG == 32
+	if (tv64.tv_sec > INT_MAX)
+		goto err_read;
+#endif
+
 	err = do_settimeofday64(&tv64);
 
 	dev_info(rtc->dev.parent,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/rtc/rtc-snvs.c linux-libre-4.4.134-gnu/drivers/rtc/rtc-snvs.c
--- linux-libre-4.4.133-gnu/drivers/rtc/rtc-snvs.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/rtc/rtc-snvs.c	2018-05-30 01:49:18.000000000 -0400
@@ -132,20 +132,23 @@ static int snvs_rtc_set_time(struct devi
 {
 	struct snvs_rtc_data *data = dev_get_drvdata(dev);
 	unsigned long time;
+	int ret;
 
 	rtc_tm_to_time(tm, &time);
 
 	/* Disable RTC first */
-	snvs_rtc_enable(data, false);
+	ret = snvs_rtc_enable(data, false);
+	if (ret)
+		return ret;
 
 	/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */
 	regmap_write(data->regmap, data->offset + SNVS_LPSRTCLR, time << CNTR_TO_SECS_SH);
 	regmap_write(data->regmap, data->offset + SNVS_LPSRTCMR, time >> (32 - CNTR_TO_SECS_SH));
 
 	/* Enable RTC again */
-	snvs_rtc_enable(data, true);
+	ret = snvs_rtc_enable(data, true);
 
-	return 0;
+	return ret;
 }
 
 static int snvs_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
@@ -287,7 +290,11 @@ static int snvs_rtc_probe(struct platfor
 	regmap_write(data->regmap, data->offset + SNVS_LPSR, 0xffffffff);
 
 	/* Enable RTC */
-	snvs_rtc_enable(data, true);
+	ret = snvs_rtc_enable(data, true);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable rtc %d\n", ret);
+		goto error_rtc_device_register;
+	}
 
 	device_init_wakeup(&pdev->dev, true);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/rtc/rtc-tx4939.c linux-libre-4.4.134-gnu/drivers/rtc/rtc-tx4939.c
--- linux-libre-4.4.133-gnu/drivers/rtc/rtc-tx4939.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/rtc/rtc-tx4939.c	2018-05-30 01:49:18.000000000 -0400
@@ -86,7 +86,8 @@ static int tx4939_rtc_read_time(struct d
 	for (i = 2; i < 6; i++)
 		buf[i] = __raw_readl(&rtcreg->dat);
 	spin_unlock_irq(&pdata->lock);
-	sec = (buf[5] << 24) | (buf[4] << 16) | (buf[3] << 8) | buf[2];
+	sec = ((unsigned long)buf[5] << 24) | (buf[4] << 16) |
+		(buf[3] << 8) | buf[2];
 	rtc_time_to_tm(sec, tm);
 	return rtc_valid_tm(tm);
 }
@@ -147,7 +148,8 @@ static int tx4939_rtc_read_alarm(struct
 	alrm->enabled = (ctl & TX4939_RTCCTL_ALME) ? 1 : 0;
 	alrm->pending = (ctl & TX4939_RTCCTL_ALMD) ? 1 : 0;
 	spin_unlock_irq(&pdata->lock);
-	sec = (buf[5] << 24) | (buf[4] << 16) | (buf[3] << 8) | buf[2];
+	sec = ((unsigned long)buf[5] << 24) | (buf[4] << 16) |
+		(buf[3] << 8) | buf[2];
 	rtc_time_to_tm(sec, &alrm->time);
 	return rtc_valid_tm(&alrm->time);
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/s390/cio/device_fsm.c linux-libre-4.4.134-gnu/drivers/s390/cio/device_fsm.c
--- linux-libre-4.4.133-gnu/drivers/s390/cio/device_fsm.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/s390/cio/device_fsm.c	2018-05-30 01:49:18.000000000 -0400
@@ -822,6 +822,7 @@ ccw_device_online_timeout(struct ccw_dev
 
 	ccw_device_set_timeout(cdev, 0);
 	cdev->private->iretry = 255;
+	cdev->private->async_kill_io_rc = -ETIMEDOUT;
 	ret = ccw_device_cancel_halt_clear(cdev);
 	if (ret == -EBUSY) {
 		ccw_device_set_timeout(cdev, 3*HZ);
@@ -898,7 +899,7 @@ ccw_device_killing_irq(struct ccw_device
 	/* OK, i/o is dead now. Call interrupt handler. */
 	if (cdev->handler)
 		cdev->handler(cdev, cdev->private->intparm,
-			      ERR_PTR(-EIO));
+			      ERR_PTR(cdev->private->async_kill_io_rc));
 }
 
 static void
@@ -915,14 +916,16 @@ ccw_device_killing_timeout(struct ccw_de
 	ccw_device_online_verify(cdev, 0);
 	if (cdev->handler)
 		cdev->handler(cdev, cdev->private->intparm,
-			      ERR_PTR(-EIO));
+			      ERR_PTR(cdev->private->async_kill_io_rc));
 }
 
 void ccw_device_kill_io(struct ccw_device *cdev)
 {
 	int ret;
 
+	ccw_device_set_timeout(cdev, 0);
 	cdev->private->iretry = 255;
+	cdev->private->async_kill_io_rc = -EIO;
 	ret = ccw_device_cancel_halt_clear(cdev);
 	if (ret == -EBUSY) {
 		ccw_device_set_timeout(cdev, 3*HZ);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/s390/cio/io_sch.h linux-libre-4.4.134-gnu/drivers/s390/cio/io_sch.h
--- linux-libre-4.4.133-gnu/drivers/s390/cio/io_sch.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/s390/cio/io_sch.h	2018-05-30 01:49:18.000000000 -0400
@@ -155,6 +155,7 @@ struct ccw_device_private {
 	unsigned long intparm;	/* user interruption parameter */
 	struct qdio_irq *qdio_data;
 	struct irb irb;		/* device status */
+	int async_kill_io_rc;
 	struct senseid senseid;	/* SenseID info */
 	struct pgid pgid[8];	/* path group IDs per chpid*/
 	struct ccw1 iccws[2];	/* ccws for SNID/SID/SPGID commands */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/aacraid/commsup.c linux-libre-4.4.134-gnu/drivers/scsi/aacraid/commsup.c
--- linux-libre-4.4.133-gnu/drivers/scsi/aacraid/commsup.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/aacraid/commsup.c	2018-05-30 01:49:18.000000000 -0400
@@ -1321,9 +1321,10 @@ static int _aac_reset_adapter(struct aac
 	host = aac->scsi_host_ptr;
 	scsi_block_requests(host);
 	aac_adapter_disable_int(aac);
-	if (aac->thread->pid != current->pid) {
+	if (aac->thread && aac->thread->pid != current->pid) {
 		spin_unlock_irq(host->host_lock);
 		kthread_stop(aac->thread);
+		aac->thread = NULL;
 		jafo = 1;
 	}
 
@@ -1392,6 +1393,7 @@ static int _aac_reset_adapter(struct aac
 					  aac->name);
 		if (IS_ERR(aac->thread)) {
 			retval = PTR_ERR(aac->thread);
+			aac->thread = NULL;
 			goto out;
 		}
 	}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/aacraid/linit.c linux-libre-4.4.134-gnu/drivers/scsi/aacraid/linit.c
--- linux-libre-4.4.133-gnu/drivers/scsi/aacraid/linit.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/aacraid/linit.c	2018-05-30 01:49:18.000000000 -0400
@@ -1085,6 +1085,7 @@ static void __aac_shutdown(struct aac_de
 				up(&fib->event_wait);
 		}
 		kthread_stop(aac->thread);
+		aac->thread = NULL;
 	}
 	aac_send_shutdown(aac);
 	aac_adapter_disable_int(aac);
@@ -1189,8 +1190,10 @@ static int aac_probe_one(struct pci_dev
 	 *	Map in the registers from the adapter.
 	 */
 	aac->base_size = AAC_MIN_FOOTPRINT_SIZE;
-	if ((*aac_drivers[index].init)(aac))
+	if ((*aac_drivers[index].init)(aac)) {
+		error = -ENODEV;
 		goto out_unmap;
+	}
 
 	if (aac->sync_mode) {
 		if (aac_sync_mode)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/arm/fas216.c linux-libre-4.4.134-gnu/drivers/scsi/arm/fas216.c
--- linux-libre-4.4.133-gnu/drivers/scsi/arm/fas216.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/arm/fas216.c	2018-05-30 01:49:18.000000000 -0400
@@ -2009,7 +2009,7 @@ static void fas216_rq_sns_done(FAS216_In
 		 * have valid data in the sense buffer that could
 		 * confuse the higher levels.
 		 */
-		memset(SCpnt->sense_buffer, 0, sizeof(SCpnt->sense_buffer));
+		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 //printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id);
 //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); }
 	/*
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/bnx2fc/bnx2fc_io.c linux-libre-4.4.134-gnu/drivers/scsi/bnx2fc/bnx2fc_io.c
--- linux-libre-4.4.133-gnu/drivers/scsi/bnx2fc/bnx2fc_io.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/bnx2fc/bnx2fc_io.c	2018-05-30 01:49:18.000000000 -0400
@@ -1858,6 +1858,7 @@ void bnx2fc_process_scsi_cmd_compl(struc
 		/* we will not receive ABTS response for this IO */
 		BNX2FC_IO_DBG(io_req, "Timer context finished processing "
 			   "this scsi cmd\n");
+		return;
 	}
 
 	/* Cancel the timeout_work, as we received IO completion */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/lpfc/lpfc_attr.c linux-libre-4.4.134-gnu/drivers/scsi/lpfc/lpfc_attr.c
--- linux-libre-4.4.133-gnu/drivers/scsi/lpfc/lpfc_attr.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/lpfc/lpfc_attr.c	2018-05-30 01:49:18.000000000 -0400
@@ -634,7 +634,12 @@ lpfc_issue_lip(struct Scsi_Host *shost)
 	LPFC_MBOXQ_t *pmboxq;
 	int mbxstatus = MBXERR_ERROR;
 
+	/*
+	 * If the link is offline, disabled or BLOCK_MGMT_IO
+	 * it doesn't make any sense to allow issue_lip
+	 */
 	if ((vport->fc_flag & FC_OFFLINE_MODE) ||
+	    (phba->hba_flag & LINK_DISABLED) ||
 	    (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO))
 		return -EPERM;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/lpfc/lpfc_hbadisc.c linux-libre-4.4.134-gnu/drivers/scsi/lpfc/lpfc_hbadisc.c
--- linux-libre-4.4.133-gnu/drivers/scsi/lpfc/lpfc_hbadisc.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/lpfc/lpfc_hbadisc.c	2018-05-30 01:49:18.000000000 -0400
@@ -691,8 +691,9 @@ lpfc_work_done(struct lpfc_hba *phba)
 	    (phba->hba_flag & HBA_SP_QUEUE_EVT)) {
 		if (pring->flag & LPFC_STOP_IOCB_EVENT) {
 			pring->flag |= LPFC_DEFERRED_RING_EVENT;
-			/* Set the lpfc data pending flag */
-			set_bit(LPFC_DATA_READY, &phba->data_flags);
+			/* Preserve legacy behavior. */
+			if (!(phba->hba_flag & HBA_SP_QUEUE_EVT))
+				set_bit(LPFC_DATA_READY, &phba->data_flags);
 		} else {
 			if (phba->link_state >= LPFC_LINK_UP) {
 				pring->flag &= ~LPFC_DEFERRED_RING_EVENT;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/lpfc/lpfc_sli.c linux-libre-4.4.134-gnu/drivers/scsi/lpfc/lpfc_sli.c
--- linux-libre-4.4.133-gnu/drivers/scsi/lpfc/lpfc_sli.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/lpfc/lpfc_sli.c	2018-05-30 01:49:18.000000000 -0400
@@ -115,6 +115,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, u
 	/* set consumption flag every once in a while */
 	if (!((q->host_index + 1) % q->entry_repost))
 		bf_set(wqe_wqec, &wqe->generic.wqe_com, 1);
+	else
+		bf_set(wqe_wqec, &wqe->generic.wqe_com, 0);
 	if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED)
 		bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id);
 	lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c linux-libre-4.4.134-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c
--- linux-libre-4.4.133-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c	2018-05-30 01:49:18.000000000 -0400
@@ -8637,7 +8637,7 @@ _scsih_probe(struct pci_dev *pdev, const
 	snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name),
 	    "fw_event_%s%d", ioc->driver_name, ioc->id);
 	ioc->firmware_event_thread = alloc_ordered_workqueue(
-	    ioc->firmware_event_name, WQ_MEM_RECLAIM);
+	    ioc->firmware_event_name, 0);
 	if (!ioc->firmware_event_thread) {
 		pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
 		    ioc->name, __FILE__, __LINE__, __func__);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/qla2xxx/qla_isr.c linux-libre-4.4.134-gnu/drivers/scsi/qla2xxx/qla_isr.c
--- linux-libre-4.4.133-gnu/drivers/scsi/qla2xxx/qla_isr.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/qla2xxx/qla_isr.c	2018-05-30 01:49:18.000000000 -0400
@@ -268,7 +268,8 @@ qla2x00_mbx_completion(scsi_qla_host_t *
 	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
 
 	/* Read all mbox registers? */
-	mboxes = (1 << ha->mbx_count) - 1;
+	WARN_ON_ONCE(ha->mbx_count > 32);
+	mboxes = (1ULL << ha->mbx_count) - 1;
 	if (!ha->mcp)
 		ql_dbg(ql_dbg_async, vha, 0x5001, "MBX pointer ERROR.\n");
 	else
@@ -2495,7 +2496,8 @@ qla24xx_mbx_completion(scsi_qla_host_t *
 	struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
 
 	/* Read all mbox registers? */
-	mboxes = (1 << ha->mbx_count) - 1;
+	WARN_ON_ONCE(ha->mbx_count > 32);
+	mboxes = (1ULL << ha->mbx_count) - 1;
 	if (!ha->mcp)
 		ql_dbg(ql_dbg_async, vha, 0x504e, "MBX pointer ERROR.\n");
 	else
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/qla4xxx/ql4_def.h linux-libre-4.4.134-gnu/drivers/scsi/qla4xxx/ql4_def.h
--- linux-libre-4.4.133-gnu/drivers/scsi/qla4xxx/ql4_def.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/qla4xxx/ql4_def.h	2018-05-30 01:49:18.000000000 -0400
@@ -168,6 +168,8 @@
 #define DEV_DB_NON_PERSISTENT	0
 #define DEV_DB_PERSISTENT	1
 
+#define QL4_ISP_REG_DISCONNECT 0xffffffffU
+
 #define COPY_ISID(dst_isid, src_isid) {			\
 	int i, j;					\
 	for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;)	\
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/qla4xxx/ql4_os.c linux-libre-4.4.134-gnu/drivers/scsi/qla4xxx/ql4_os.c
--- linux-libre-4.4.133-gnu/drivers/scsi/qla4xxx/ql4_os.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/qla4xxx/ql4_os.c	2018-05-30 01:49:18.000000000 -0400
@@ -262,6 +262,24 @@ static struct iscsi_transport qla4xxx_is
 
 static struct scsi_transport_template *qla4xxx_scsi_transport;
 
+static int qla4xxx_isp_check_reg(struct scsi_qla_host *ha)
+{
+	u32 reg_val = 0;
+	int rval = QLA_SUCCESS;
+
+	if (is_qla8022(ha))
+		reg_val = readl(&ha->qla4_82xx_reg->host_status);
+	else if (is_qla8032(ha) || is_qla8042(ha))
+		reg_val = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_ALIVE_COUNTER);
+	else
+		reg_val = readw(&ha->reg->ctrl_status);
+
+	if (reg_val == QL4_ISP_REG_DISCONNECT)
+		rval = QLA_ERROR;
+
+	return rval;
+}
+
 static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num,
 			     uint32_t iface_type, uint32_t payload_size,
 			     uint32_t pid, struct sockaddr *dst_addr)
@@ -9196,10 +9214,17 @@ static int qla4xxx_eh_abort(struct scsi_
 	struct srb *srb = NULL;
 	int ret = SUCCESS;
 	int wait = 0;
+	int rval;
 
 	ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n",
 		   ha->host_no, id, lun, cmd, cmd->cmnd[0]);
 
+	rval = qla4xxx_isp_check_reg(ha);
+	if (rval != QLA_SUCCESS) {
+		ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
+		return FAILED;
+	}
+
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 	srb = (struct srb *) CMD_SP(cmd);
 	if (!srb) {
@@ -9251,6 +9276,7 @@ static int qla4xxx_eh_device_reset(struc
 	struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
 	struct ddb_entry *ddb_entry = cmd->device->hostdata;
 	int ret = FAILED, stat;
+	int rval;
 
 	if (!ddb_entry)
 		return ret;
@@ -9270,6 +9296,12 @@ static int qla4xxx_eh_device_reset(struc
 		      cmd, jiffies, cmd->request->timeout / HZ,
 		      ha->dpc_flags, cmd->result, cmd->allowed));
 
+	rval = qla4xxx_isp_check_reg(ha);
+	if (rval != QLA_SUCCESS) {
+		ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
+		return FAILED;
+	}
+
 	/* FIXME: wait for hba to go online */
 	stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun);
 	if (stat != QLA_SUCCESS) {
@@ -9313,6 +9345,7 @@ static int qla4xxx_eh_target_reset(struc
 	struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
 	struct ddb_entry *ddb_entry = cmd->device->hostdata;
 	int stat, ret;
+	int rval;
 
 	if (!ddb_entry)
 		return FAILED;
@@ -9330,6 +9363,12 @@ static int qla4xxx_eh_target_reset(struc
 		      ha->host_no, cmd, jiffies, cmd->request->timeout / HZ,
 		      ha->dpc_flags, cmd->result, cmd->allowed));
 
+	rval = qla4xxx_isp_check_reg(ha);
+	if (rval != QLA_SUCCESS) {
+		ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
+		return FAILED;
+	}
+
 	stat = qla4xxx_reset_target(ha, ddb_entry);
 	if (stat != QLA_SUCCESS) {
 		starget_printk(KERN_INFO, scsi_target(cmd->device),
@@ -9384,9 +9423,16 @@ static int qla4xxx_eh_host_reset(struct
 {
 	int return_status = FAILED;
 	struct scsi_qla_host *ha;
+	int rval;
 
 	ha = to_qla_host(cmd->device->host);
 
+	rval = qla4xxx_isp_check_reg(ha);
+	if (rval != QLA_SUCCESS) {
+		ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
+		return FAILED;
+	}
+
 	if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba)
 		qla4_83xx_set_idc_dontreset(ha);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/sd.c linux-libre-4.4.134-gnu/drivers/scsi/sd.c
--- linux-libre-4.4.133-gnu/drivers/scsi/sd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/sd.c	2018-05-30 01:49:18.000000000 -0400
@@ -2395,6 +2395,7 @@ sd_read_write_protect_flag(struct scsi_d
 	int res;
 	struct scsi_device *sdp = sdkp->device;
 	struct scsi_mode_data data;
+	int disk_ro = get_disk_ro(sdkp->disk);
 	int old_wp = sdkp->write_prot;
 
 	set_disk_ro(sdkp->disk, 0);
@@ -2435,7 +2436,7 @@ sd_read_write_protect_flag(struct scsi_d
 			  "Test WP failed, assume Write Enabled\n");
 	} else {
 		sdkp->write_prot = ((data.device_specific & 0x80) != 0);
-		set_disk_ro(sdkp->disk, sdkp->write_prot);
+		set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro);
 		if (sdkp->first_scan || old_wp != sdkp->write_prot) {
 			sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n",
 				  sdkp->write_prot ? "on" : "off");
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/sr.c linux-libre-4.4.134-gnu/drivers/scsi/sr.c
--- linux-libre-4.4.133-gnu/drivers/scsi/sr.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/sr.c	2018-05-30 01:49:18.000000000 -0400
@@ -522,6 +522,8 @@ static int sr_block_open(struct block_de
 	struct scsi_cd *cd;
 	int ret = -ENXIO;
 
+	check_disk_change(bdev);
+
 	mutex_lock(&sr_mutex);
 	cd = scsi_cd_get(bdev->bd_disk);
 	if (cd) {
@@ -582,18 +584,28 @@ out:
 static unsigned int sr_block_check_events(struct gendisk *disk,
 					  unsigned int clearing)
 {
-	struct scsi_cd *cd = scsi_cd(disk);
+	unsigned int ret = 0;
+	struct scsi_cd *cd;
 
-	if (atomic_read(&cd->device->disk_events_disable_depth))
+	cd = scsi_cd_get(disk);
+	if (!cd)
 		return 0;
 
-	return cdrom_check_events(&cd->cdi, clearing);
+	if (!atomic_read(&cd->device->disk_events_disable_depth))
+		ret = cdrom_check_events(&cd->cdi, clearing);
+
+	scsi_cd_put(cd);
+	return ret;
 }
 
 static int sr_block_revalidate_disk(struct gendisk *disk)
 {
-	struct scsi_cd *cd = scsi_cd(disk);
 	struct scsi_sense_hdr sshdr;
+	struct scsi_cd *cd;
+
+	cd = scsi_cd_get(disk);
+	if (!cd)
+		return -ENXIO;
 
 	/* if the unit is not ready, nothing more to do */
 	if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
@@ -602,6 +614,7 @@ static int sr_block_revalidate_disk(stru
 	sr_cd_check(&cd->cdi);
 	get_sectorsize(cd);
 out:
+	scsi_cd_put(cd);
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/storvsc_drv.c linux-libre-4.4.134-gnu/drivers/scsi/storvsc_drv.c
--- linux-libre-4.4.133-gnu/drivers/scsi/storvsc_drv.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/storvsc_drv.c	2018-05-30 01:49:18.000000000 -0400
@@ -1538,7 +1538,7 @@ static struct scsi_host_template scsi_dr
 	.eh_timed_out =		storvsc_eh_timed_out,
 	.slave_alloc =		storvsc_device_alloc,
 	.slave_configure =	storvsc_device_configure,
-	.cmd_per_lun =		255,
+	.cmd_per_lun =		2048,
 	.this_id =		-1,
 	.use_clustering =	ENABLE_CLUSTERING,
 	/* Make sure we dont get a sg segment crosses a page boundary */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/sym53c8xx_2/sym_hipd.c linux-libre-4.4.134-gnu/drivers/scsi/sym53c8xx_2/sym_hipd.c
--- linux-libre-4.4.133-gnu/drivers/scsi/sym53c8xx_2/sym_hipd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/sym53c8xx_2/sym_hipd.c	2018-05-30 01:49:18.000000000 -0400
@@ -536,7 +536,7 @@ sym_getsync(struct sym_hcb *np, u_char d
 	 *  Look for the greatest clock divisor that allows an 
 	 *  input speed faster than the period.
 	 */
-	while (div-- > 0)
+	while (--div > 0)
 		if (kpc >= (div_10M[div] << 2)) break;
 
 	/*
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/scsi/ufs/ufshcd.c linux-libre-4.4.134-gnu/drivers/scsi/ufs/ufshcd.c
--- linux-libre-4.4.133-gnu/drivers/scsi/ufs/ufshcd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/scsi/ufs/ufshcd.c	2018-05-30 01:49:18.000000000 -0400
@@ -2923,6 +2923,8 @@ static int ufshcd_slave_alloc(struct scs
 	/* REPORT SUPPORTED OPERATION CODES is not supported */
 	sdev->no_report_opcodes = 1;
 
+	/* WRITE_SAME command is not supported */
+	sdev->no_write_same = 1;
 
 	ufshcd_set_queue_depth(sdev);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/staging/rtl8192u/r8192U_core.c linux-libre-4.4.134-gnu/drivers/staging/rtl8192u/r8192U_core.c
--- linux-libre-4.4.133-gnu/drivers/staging/rtl8192u/r8192U_core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/staging/rtl8192u/r8192U_core.c	2018-05-30 01:49:18.000000000 -0400
@@ -1749,6 +1749,8 @@ static short rtl8192_usb_initendpoints(s
 
 		priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);
 		priv->oldaddr = kmalloc(16, GFP_KERNEL);
+		if (!priv->oldaddr)
+			return -ENOMEM;
 		oldaddr = priv->oldaddr;
 		align = ((long)oldaddr) & 3;
 		if (align) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/tty/serial/arc_uart.c linux-libre-4.4.134-gnu/drivers/tty/serial/arc_uart.c
--- linux-libre-4.4.133-gnu/drivers/tty/serial/arc_uart.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/tty/serial/arc_uart.c	2018-05-30 01:49:18.000000000 -0400
@@ -597,6 +597,11 @@ static int arc_serial_probe(struct platf
 	if (dev_id < 0)
 		dev_id = 0;
 
+	if (dev_id >= ARRAY_SIZE(arc_uart_ports)) {
+		dev_err(&pdev->dev, "serial%d out of range\n", dev_id);
+		return -EINVAL;
+	}
+
 	uart = &arc_uart_ports[dev_id];
 	port = &uart->port;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/tty/serial/fsl_lpuart.c linux-libre-4.4.134-gnu/drivers/tty/serial/fsl_lpuart.c
--- linux-libre-4.4.133-gnu/drivers/tty/serial/fsl_lpuart.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/tty/serial/fsl_lpuart.c	2018-05-30 01:49:18.000000000 -0400
@@ -1818,6 +1818,10 @@ static int lpuart_probe(struct platform_
 		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
 		return ret;
 	}
+	if (ret >= ARRAY_SIZE(lpuart_ports)) {
+		dev_err(&pdev->dev, "serial%d out of range\n", ret);
+		return -EINVAL;
+	}
 	sport->port.line = ret;
 	sport->lpuart32 = of_device_is_compatible(np, "fsl,ls1021a-lpuart");
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/tty/serial/imx.c linux-libre-4.4.134-gnu/drivers/tty/serial/imx.c
--- linux-libre-4.4.133-gnu/drivers/tty/serial/imx.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/tty/serial/imx.c	2018-05-30 01:49:18.000000000 -0400
@@ -1923,6 +1923,12 @@ static int serial_imx_probe(struct platf
 	else if (ret < 0)
 		return ret;
 
+	if (sport->port.line >= ARRAY_SIZE(imx_ports)) {
+		dev_err(&pdev->dev, "serial%d out of range\n",
+			sport->port.line);
+		return -EINVAL;
+	}
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(base))
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/tty/serial/mxs-auart.c linux-libre-4.4.134-gnu/drivers/tty/serial/mxs-auart.c
--- linux-libre-4.4.133-gnu/drivers/tty/serial/mxs-auart.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/tty/serial/mxs-auart.c	2018-05-30 01:49:18.000000000 -0400
@@ -1274,6 +1274,10 @@ static int mxs_auart_probe(struct platfo
 		s->port.line = pdev->id < 0 ? 0 : pdev->id;
 	else if (ret < 0)
 		return ret;
+	if (s->port.line >= ARRAY_SIZE(auart_port)) {
+		dev_err(&pdev->dev, "serial%d out of range\n", s->port.line);
+		return -EINVAL;
+	}
 
 	if (of_id) {
 		pdev->id_entry = of_id->data;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/tty/serial/samsung.c linux-libre-4.4.134-gnu/drivers/tty/serial/samsung.c
--- linux-libre-4.4.133-gnu/drivers/tty/serial/samsung.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/tty/serial/samsung.c	2018-05-30 01:49:18.000000000 -0400
@@ -1807,6 +1807,10 @@ static int s3c24xx_serial_probe(struct p
 
 	dbg("s3c24xx_serial_probe(%p) %d\n", pdev, index);
 
+	if (index >= ARRAY_SIZE(s3c24xx_serial_ports)) {
+		dev_err(&pdev->dev, "serial%d out of range\n", index);
+		return -EINVAL;
+	}
 	ourport = &s3c24xx_serial_ports[index];
 
 	ourport->drv_data = s3c24xx_get_driver_data(pdev);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/tty/serial/xilinx_uartps.c linux-libre-4.4.134-gnu/drivers/tty/serial/xilinx_uartps.c
--- linux-libre-4.4.133-gnu/drivers/tty/serial/xilinx_uartps.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/tty/serial/xilinx_uartps.c	2018-05-30 01:49:18.000000000 -0400
@@ -1026,7 +1026,7 @@ static struct uart_port *cdns_uart_get_p
 	struct uart_port *port;
 
 	/* Try the given port id if failed use default method */
-	if (cdns_uart_port[id].mapbase != 0) {
+	if (id < CDNS_UART_NR_PORTS && cdns_uart_port[id].mapbase != 0) {
 		/* Find the next unused port */
 		for (id = 0; id < CDNS_UART_NR_PORTS; id++)
 			if (cdns_uart_port[id].mapbase == 0)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/dwc2/core.h linux-libre-4.4.134-gnu/drivers/usb/dwc2/core.h
--- linux-libre-4.4.133-gnu/drivers/usb/dwc2/core.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/dwc2/core.h	2018-05-30 01:49:18.000000000 -0400
@@ -187,7 +187,7 @@ struct dwc2_hsotg_ep {
 	unsigned char           dir_in;
 	unsigned char           index;
 	unsigned char           mc;
-	unsigned char           interval;
+	u16                     interval;
 
 	unsigned int            halted:1;
 	unsigned int            periodic:1;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/dwc2/gadget.c linux-libre-4.4.134-gnu/drivers/usb/dwc2/gadget.c
--- linux-libre-4.4.133-gnu/drivers/usb/dwc2/gadget.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/dwc2/gadget.c	2018-05-30 01:49:18.000000000 -0400
@@ -2424,12 +2424,6 @@ void dwc2_hsotg_core_init_disconnected(s
 	dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) |
 	       DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0);
 
-	dwc2_hsotg_enqueue_setup(hsotg);
-
-	dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
-		dwc2_readl(hsotg->regs + DIEPCTL0),
-		dwc2_readl(hsotg->regs + DOEPCTL0));
-
 	/* clear global NAKs */
 	val = DCTL_CGOUTNAK | DCTL_CGNPINNAK;
 	if (!is_usb_reset)
@@ -2440,6 +2434,12 @@ void dwc2_hsotg_core_init_disconnected(s
 	mdelay(3);
 
 	hsotg->lx_state = DWC2_L0;
+
+	dwc2_hsotg_enqueue_setup(hsotg);
+
+	dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",
+		dwc2_readl(hsotg->regs + DIEPCTL0),
+		dwc2_readl(hsotg->regs + DOEPCTL0));
 }
 
 static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/dwc3/core.h linux-libre-4.4.134-gnu/drivers/usb/dwc3/core.h
--- linux-libre-4.4.133-gnu/drivers/usb/dwc3/core.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/dwc3/core.h	2018-05-30 01:49:18.000000000 -0400
@@ -202,6 +202,8 @@
 #define DWC3_GUSB3PIPECTL_TX_DEEPH(n)	((n) << 1)
 
 /* Global TX Fifo Size Register */
+#define DWC31_GTXFIFOSIZ_TXFRAMNUM	BIT(15)		/* DWC_usb31 only */
+#define DWC31_GTXFIFOSIZ_TXFDEF(n)	((n) & 0x7fff)	/* DWC_usb31 only */
 #define DWC3_GTXFIFOSIZ_TXFDEF(n)	((n) & 0xffff)
 #define DWC3_GTXFIFOSIZ_TXFSTADDR(n)	((n) & 0xffff0000)
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/gadget/composite.c linux-libre-4.4.134-gnu/drivers/usb/gadget/composite.c
--- linux-libre-4.4.133-gnu/drivers/usb/gadget/composite.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/gadget/composite.c	2018-05-30 01:49:18.000000000 -0400
@@ -1328,7 +1328,7 @@ static int count_ext_compat(struct usb_c
 	return res;
 }
 
-static void fill_ext_compat(struct usb_configuration *c, u8 *buf)
+static int fill_ext_compat(struct usb_configuration *c, u8 *buf)
 {
 	int i, count;
 
@@ -1355,10 +1355,12 @@ static void fill_ext_compat(struct usb_c
 				buf += 23;
 			}
 			count += 24;
-			if (count >= 4096)
-				return;
+			if (count + 24 >= USB_COMP_EP0_OS_DESC_BUFSIZ)
+				return count;
 		}
 	}
+
+	return count;
 }
 
 static int count_ext_prop(struct usb_configuration *c, int interface)
@@ -1403,25 +1405,20 @@ static int fill_ext_prop(struct usb_conf
 	struct usb_os_desc *d;
 	struct usb_os_desc_ext_prop *ext_prop;
 	int j, count, n, ret;
-	u8 *start = buf;
 
 	f = c->interface[interface];
+	count = 10; /* header length */
 	for (j = 0; j < f->os_desc_n; ++j) {
 		if (interface != f->os_desc_table[j].if_id)
 			continue;
 		d = f->os_desc_table[j].os_desc;
 		if (d)
 			list_for_each_entry(ext_prop, &d->ext_prop, entry) {
-				/* 4kB minus header length */
-				n = buf - start;
-				if (n >= 4086)
-					return 0;
-
-				count = ext_prop->data_len +
+				n = ext_prop->data_len +
 					ext_prop->name_len + 14;
-				if (count > 4086 - n)
-					return -EINVAL;
-				usb_ext_prop_put_size(buf, count);
+				if (count + n >= USB_COMP_EP0_OS_DESC_BUFSIZ)
+					return count;
+				usb_ext_prop_put_size(buf, n);
 				usb_ext_prop_put_type(buf, ext_prop->type);
 				ret = usb_ext_prop_put_name(buf, ext_prop->name,
 							    ext_prop->name_len);
@@ -1447,11 +1444,12 @@ static int fill_ext_prop(struct usb_conf
 				default:
 					return -EINVAL;
 				}
-				buf += count;
+				buf += n;
+				count += n;
 			}
 	}
 
-	return 0;
+	return count;
 }
 
 /*
@@ -1720,6 +1718,7 @@ unknown:
 			req->complete = composite_setup_complete;
 			buf = req->buf;
 			os_desc_cfg = cdev->os_desc_config;
+			w_length = min_t(u16, w_length, USB_COMP_EP0_OS_DESC_BUFSIZ);
 			memset(buf, 0, w_length);
 			buf[5] = 0x01;
 			switch (ctrl->bRequestType & USB_RECIP_MASK) {
@@ -1743,8 +1742,8 @@ unknown:
 					count += 16; /* header */
 					put_unaligned_le32(count, buf);
 					buf += 16;
-					fill_ext_compat(os_desc_cfg, buf);
-					value = w_length;
+					value = fill_ext_compat(os_desc_cfg, buf);
+					value = min_t(u16, w_length, value);
 				}
 				break;
 			case USB_RECIP_INTERFACE:
@@ -1773,8 +1772,7 @@ unknown:
 							      interface, buf);
 					if (value < 0)
 						return value;
-
-					value = w_length;
+					value = min_t(u16, w_length, value);
 				}
 				break;
 			}
@@ -2038,8 +2036,8 @@ int composite_os_desc_req_prepare(struct
 		goto end;
 	}
 
-	/* OS feature descriptor length <= 4kB */
-	cdev->os_desc_req->buf = kmalloc(4096, GFP_KERNEL);
+	cdev->os_desc_req->buf = kmalloc(USB_COMP_EP0_OS_DESC_BUFSIZ,
+					 GFP_KERNEL);
 	if (!cdev->os_desc_req->buf) {
 		ret = PTR_ERR(cdev->os_desc_req->buf);
 		kfree(cdev->os_desc_req);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/gadget/function/f_fs.c linux-libre-4.4.134-gnu/drivers/usb/gadget/function/f_fs.c
--- linux-libre-4.4.133-gnu/drivers/usb/gadget/function/f_fs.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/gadget/function/f_fs.c	2018-05-30 01:49:18.000000000 -0400
@@ -649,11 +649,15 @@ static void ffs_user_copy_worker(struct
 	bool kiocb_has_eventfd = io_data->kiocb->ki_flags & IOCB_EVENTFD;
 
 	if (io_data->read && ret > 0) {
+		mm_segment_t oldfs = get_fs();
+
+		set_fs(USER_DS);
 		use_mm(io_data->mm);
 		ret = copy_to_iter(io_data->buf, ret, &io_data->data);
 		if (ret != io_data->req->actual && iov_iter_count(&io_data->data))
 			ret = -EFAULT;
 		unuse_mm(io_data->mm);
+		set_fs(oldfs);
 	}
 
 	io_data->kiocb->ki_complete(io_data->kiocb, ret, ret);
@@ -3033,7 +3037,7 @@ static int ffs_func_setup(struct usb_fun
 	__ffs_event_add(ffs, FUNCTIONFS_SETUP);
 	spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags);
 
-	return 0;
+	return USB_GADGET_DELAYED_STATUS;
 }
 
 static void ffs_func_suspend(struct usb_function *f)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/gadget/function/f_uac2.c linux-libre-4.4.134-gnu/drivers/usb/gadget/function/f_uac2.c
--- linux-libre-4.4.133-gnu/drivers/usb/gadget/function/f_uac2.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/gadget/function/f_uac2.c	2018-05-30 01:49:18.000000000 -0400
@@ -1052,6 +1052,8 @@ afunc_bind(struct usb_configuration *cfg
 		dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
 		return ret;
 	}
+	iad_desc.bFirstInterface = ret;
+
 	std_ac_if_desc.bInterfaceNumber = ret;
 	agdev->ac_intf = ret;
 	agdev->ac_alt = 0;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/gadget/udc/fsl_udc_core.c linux-libre-4.4.134-gnu/drivers/usb/gadget/udc/fsl_udc_core.c
--- linux-libre-4.4.133-gnu/drivers/usb/gadget/udc/fsl_udc_core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/gadget/udc/fsl_udc_core.c	2018-05-30 01:49:18.000000000 -0400
@@ -1310,7 +1310,7 @@ static void udc_reset_ep_queue(struct fs
 {
 	struct fsl_ep *ep = get_ep_by_pipe(udc, pipe);
 
-	if (ep->name)
+	if (ep->ep.name)
 		nuke(ep, -ESHUTDOWN);
 }
 
@@ -1698,7 +1698,7 @@ static void dtd_complete_irq(struct fsl_
 		curr_ep = get_ep_by_pipe(udc, i);
 
 		/* If the ep is configured */
-		if (curr_ep->name == NULL) {
+		if (!curr_ep->ep.name) {
 			WARNING("Invalid EP?");
 			continue;
 		}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/gadget/udc/goku_udc.h linux-libre-4.4.134-gnu/drivers/usb/gadget/udc/goku_udc.h
--- linux-libre-4.4.133-gnu/drivers/usb/gadget/udc/goku_udc.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/gadget/udc/goku_udc.h	2018-05-30 01:49:18.000000000 -0400
@@ -28,7 +28,7 @@ struct goku_udc_regs {
 #	define INT_EP1DATASET		0x00040
 #	define INT_EP2DATASET		0x00080
 #	define INT_EP3DATASET		0x00100
-#define INT_EPnNAK(n)		(0x00100 < (n))		/* 0 < n < 4 */
+#define INT_EPnNAK(n)		(0x00100 << (n))	/* 0 < n < 4 */
 #	define INT_EP1NAK		0x00200
 #	define INT_EP2NAK		0x00400
 #	define INT_EP3NAK		0x00800
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/host/ohci-hcd.c linux-libre-4.4.134-gnu/drivers/usb/host/ohci-hcd.c
--- linux-libre-4.4.133-gnu/drivers/usb/host/ohci-hcd.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/host/ohci-hcd.c	2018-05-30 01:49:18.000000000 -0400
@@ -444,7 +444,8 @@ static int ohci_init (struct ohci_hcd *o
 	struct usb_hcd *hcd = ohci_to_hcd(ohci);
 
 	/* Accept arbitrarily long scatter-gather lists */
-	hcd->self.sg_tablesize = ~0;
+	if (!(hcd->driver->flags & HCD_LOCAL_MEM))
+		hcd->self.sg_tablesize = ~0;
 
 	if (distrust_firmware)
 		ohci->flags |= OHCI_QUIRK_HUB_POWER;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/host/xhci-mem.c linux-libre-4.4.134-gnu/drivers/usb/host/xhci-mem.c
--- linux-libre-4.4.133-gnu/drivers/usb/host/xhci-mem.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/host/xhci-mem.c	2018-05-30 01:49:18.000000000 -0400
@@ -960,6 +960,8 @@ void xhci_free_virt_device(struct xhci_h
 	if (dev->out_ctx)
 		xhci_free_container_ctx(xhci, dev->out_ctx);
 
+	if (dev->udev && dev->udev->slot_id)
+		dev->udev->slot_id = 0;
 	kfree(xhci->devs[slot_id]);
 	xhci->devs[slot_id] = NULL;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/usb/musb/musb_core.c linux-libre-4.4.134-gnu/drivers/usb/musb/musb_core.c
--- linux-libre-4.4.133-gnu/drivers/usb/musb/musb_core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/usb/musb/musb_core.c	2018-05-30 01:49:18.000000000 -0400
@@ -1775,6 +1775,7 @@ musb_vbus_show(struct device *dev, struc
 	int		vbus;
 	u8		devctl;
 
+	pm_runtime_get_sync(dev);
 	spin_lock_irqsave(&musb->lock, flags);
 	val = musb->a_wait_bcon;
 	vbus = musb_platform_get_vbus_status(musb);
@@ -1788,6 +1789,7 @@ musb_vbus_show(struct device *dev, struc
 			vbus = 0;
 	}
 	spin_unlock_irqrestore(&musb->lock, flags);
+	pm_runtime_put_sync(dev);
 
 	return sprintf(buf, "Vbus %s, timeout %lu msec\n",
 			vbus ? "on" : "off", val);
@@ -2522,7 +2524,8 @@ static int musb_resume(struct device *de
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
 
-	musb_start(musb);
+	musb_enable_interrupts(musb);
+	musb_platform_enable(musb);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/video/fbdev/sbuslib.c linux-libre-4.4.134-gnu/drivers/video/fbdev/sbuslib.c
--- linux-libre-4.4.133-gnu/drivers/video/fbdev/sbuslib.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/video/fbdev/sbuslib.c	2018-05-30 01:49:18.000000000 -0400
@@ -121,7 +121,7 @@ int sbusfb_ioctl_helper(unsigned long cm
 		unsigned char __user *ured;
 		unsigned char __user *ugreen;
 		unsigned char __user *ublue;
-		int index, count, i;
+		unsigned int index, count, i;
 
 		if (get_user(index, &c->index) ||
 		    __get_user(count, &c->count) ||
@@ -160,7 +160,7 @@ int sbusfb_ioctl_helper(unsigned long cm
 		unsigned char __user *ugreen;
 		unsigned char __user *ublue;
 		struct fb_cmap *cmap = &info->cmap;
-		int index, count, i;
+		unsigned int index, count, i;
 		u8 red, green, blue;
 
 		if (get_user(index, &c->index) ||
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/watchdog/f71808e_wdt.c linux-libre-4.4.134-gnu/drivers/watchdog/f71808e_wdt.c
--- linux-libre-4.4.133-gnu/drivers/watchdog/f71808e_wdt.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/watchdog/f71808e_wdt.c	2018-05-30 01:49:18.000000000 -0400
@@ -520,7 +520,8 @@ static ssize_t watchdog_write(struct fil
 				char c;
 				if (get_user(c, buf + i))
 					return -EFAULT;
-				expect_close = (c == 'V');
+				if (c == 'V')
+					expect_close = true;
 			}
 
 			/* Properly order writes across fork()ed processes */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/watchdog/sp5100_tco.h linux-libre-4.4.134-gnu/drivers/watchdog/sp5100_tco.h
--- linux-libre-4.4.133-gnu/drivers/watchdog/sp5100_tco.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/watchdog/sp5100_tco.h	2018-05-30 01:49:18.000000000 -0400
@@ -54,7 +54,7 @@
 #define SB800_PM_WATCHDOG_CONFIG	0x4C
 
 #define SB800_PCI_WATCHDOG_DECODE_EN	(1 << 0)
-#define SB800_PM_WATCHDOG_DISABLE	(1 << 2)
+#define SB800_PM_WATCHDOG_DISABLE	(1 << 1)
 #define SB800_PM_WATCHDOG_SECOND_RES	(3 << 0)
 #define SB800_ACPI_MMIO_DECODE_EN	(1 << 0)
 #define SB800_ACPI_MMIO_SEL		(1 << 1)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/xen/events/events_base.c linux-libre-4.4.134-gnu/drivers/xen/events/events_base.c
--- linux-libre-4.4.133-gnu/drivers/xen/events/events_base.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/xen/events/events_base.c	2018-05-30 01:49:18.000000000 -0400
@@ -764,8 +764,8 @@ out:
 	mutex_unlock(&irq_mapping_update_lock);
 	return irq;
 error_irq:
-	for (; i >= 0; i--)
-		__unbind_from_irq(irq + i);
+	while (nvec--)
+		__unbind_from_irq(irq + nvec);
 	mutex_unlock(&irq_mapping_update_lock);
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/xen/grant-table.c linux-libre-4.4.134-gnu/drivers/xen/grant-table.c
--- linux-libre-4.4.133-gnu/drivers/xen/grant-table.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/xen/grant-table.c	2018-05-30 01:49:18.000000000 -0400
@@ -328,7 +328,7 @@ static void gnttab_handle_deferred(unsig
 			if (entry->page) {
 				pr_debug("freeing g.e. %#x (pfn %#lx)\n",
 					 entry->ref, page_to_pfn(entry->page));
-				__free_page(entry->page);
+				put_page(entry->page);
 			} else
 				pr_info("freeing g.e. %#x\n", entry->ref);
 			kfree(entry);
@@ -384,7 +384,7 @@ void gnttab_end_foreign_access(grant_ref
 	if (gnttab_end_foreign_access_ref(ref, readonly)) {
 		put_free_entry(ref);
 		if (page != 0)
-			free_page(page);
+			put_page(virt_to_page(page));
 	} else
 		gnttab_add_deferred(ref, readonly,
 				    page ? virt_to_page(page) : NULL);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/xen/swiotlb-xen.c linux-libre-4.4.134-gnu/drivers/xen/swiotlb-xen.c
--- linux-libre-4.4.133-gnu/drivers/xen/swiotlb-xen.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/xen/swiotlb-xen.c	2018-05-30 01:49:18.000000000 -0400
@@ -359,7 +359,7 @@ xen_swiotlb_free_coherent(struct device
 	 * physical address */
 	phys = xen_bus_to_phys(dev_addr);
 
-	if (((dev_addr + size - 1 > dma_mask)) ||
+	if (((dev_addr + size - 1 <= dma_mask)) ||
 	    range_straddles_page_boundary(phys, size))
 		xen_destroy_contiguous_region(phys, order);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/xen/xen-acpi-processor.c linux-libre-4.4.134-gnu/drivers/xen/xen-acpi-processor.c
--- linux-libre-4.4.133-gnu/drivers/xen/xen-acpi-processor.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/xen/xen-acpi-processor.c	2018-05-30 01:49:18.000000000 -0400
@@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl
 	}
 	/* There are more ACPI Processor objects than in x2APIC or MADT.
 	 * This can happen with incorrect ACPI SSDT declerations. */
-	if (acpi_id > nr_acpi_bits) {
-		pr_debug("We only have %u, trying to set %u\n",
-			 nr_acpi_bits, acpi_id);
+	if (acpi_id >= nr_acpi_bits) {
+		pr_debug("max acpi id %u, trying to set %u\n",
+			 nr_acpi_bits - 1, acpi_id);
 		return AE_OK;
 	}
 	/* OK, There is a ACPI Processor object */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/xen/xenbus/xenbus_probe.c linux-libre-4.4.134-gnu/drivers/xen/xenbus/xenbus_probe.c
--- linux-libre-4.4.133-gnu/drivers/xen/xenbus/xenbus_probe.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/xen/xenbus/xenbus_probe.c	2018-05-30 01:49:18.000000000 -0400
@@ -470,8 +470,11 @@ int xenbus_probe_node(struct xen_bus_typ
 
 	/* Register with generic device framework. */
 	err = device_register(&xendev->dev);
-	if (err)
+	if (err) {
+		put_device(&xendev->dev);
+		xendev = NULL;
 		goto fail;
+	}
 
 	return 0;
 fail:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/drivers/zorro/zorro.c linux-libre-4.4.134-gnu/drivers/zorro/zorro.c
--- linux-libre-4.4.133-gnu/drivers/zorro/zorro.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/drivers/zorro/zorro.c	2018-05-30 01:49:18.000000000 -0400
@@ -16,6 +16,7 @@
 #include <linux/bitops.h>
 #include <linux/string.h>
 #include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 #include <linux/slab.h>
 
 #include <asm/byteorder.h>
@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(stru
 		z->dev.parent = &bus->dev;
 		z->dev.bus = &zorro_bus_type;
 		z->dev.id = i;
+		switch (z->rom.er_Type & ERT_TYPEMASK) {
+		case ERT_ZORROIII:
+			z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+			break;
+
+		case ERT_ZORROII:
+		default:
+			z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
+			break;
+		}
+		z->dev.dma_mask = &z->dev.coherent_dma_mask;
 	}
 
 	/* ... then register them */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/affs/namei.c linux-libre-4.4.134-gnu/fs/affs/namei.c
--- linux-libre-4.4.133-gnu/fs/affs/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/affs/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -224,9 +224,10 @@ affs_lookup(struct inode *dir, struct de
 
 	affs_lock_dir(dir);
 	bh = affs_find_entry(dir, dentry);
-	affs_unlock_dir(dir);
-	if (IS_ERR(bh))
+	if (IS_ERR(bh)) {
+		affs_unlock_dir(dir);
 		return ERR_CAST(bh);
+	}
 	if (bh) {
 		u32 ino = bh->b_blocknr;
 
@@ -240,10 +241,13 @@ affs_lookup(struct inode *dir, struct de
 		}
 		affs_brelse(bh);
 		inode = affs_iget(sb, ino);
-		if (IS_ERR(inode))
+		if (IS_ERR(inode)) {
+			affs_unlock_dir(dir);
 			return ERR_CAST(inode);
+		}
 	}
 	d_add(dentry, inode);
+	affs_unlock_dir(dir);
 	return NULL;
 }
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/aio.c linux-libre-4.4.134-gnu/fs/aio.c
--- linux-libre-4.4.133-gnu/fs/aio.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/aio.c	2018-05-30 01:49:18.000000000 -0400
@@ -1066,8 +1066,8 @@ static struct kioctx *lookup_ioctx(unsig
 
 	ctx = rcu_dereference(table->table[id]);
 	if (ctx && ctx->user_id == ctx_id) {
-		percpu_ref_get(&ctx->users);
-		ret = ctx;
+		if (percpu_ref_tryget_live(&ctx->users))
+			ret = ctx;
 	}
 out:
 	rcu_read_unlock();
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/ctree.c linux-libre-4.4.134-gnu/fs/btrfs/ctree.c
--- linux-libre-4.4.133-gnu/fs/btrfs/ctree.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/ctree.c	2018-05-30 01:49:18.000000000 -0400
@@ -2769,6 +2769,8 @@ again:
 		 * contention with the cow code
 		 */
 		if (cow) {
+			bool last_level = (level == (BTRFS_MAX_LEVEL - 1));
+
 			/*
 			 * if we don't really need to cow this block
 			 * then we don't want to set the path blocking,
@@ -2793,9 +2795,13 @@ again:
 			}
 
 			btrfs_set_path_blocking(p);
-			err = btrfs_cow_block(trans, root, b,
-					      p->nodes[level + 1],
-					      p->slots[level + 1], &b);
+			if (last_level)
+				err = btrfs_cow_block(trans, root, b, NULL, 0,
+						      &b);
+			else
+				err = btrfs_cow_block(trans, root, b,
+						      p->nodes[level + 1],
+						      p->slots[level + 1], &b);
 			if (err) {
 				ret = err;
 				goto done;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/disk-io.c linux-libre-4.4.134-gnu/fs/btrfs/disk-io.c
--- linux-libre-4.4.133-gnu/fs/btrfs/disk-io.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/disk-io.c	2018-05-30 01:49:18.000000000 -0400
@@ -1196,7 +1196,7 @@ static struct btrfs_subvolume_writers *b
 	if (!writers)
 		return ERR_PTR(-ENOMEM);
 
-	ret = percpu_counter_init(&writers->counter, 0, GFP_KERNEL);
+	ret = percpu_counter_init(&writers->counter, 0, GFP_NOFS);
 	if (ret < 0) {
 		kfree(writers);
 		return ERR_PTR(ret);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/extent-tree.c linux-libre-4.4.134-gnu/fs/btrfs/extent-tree.c
--- linux-libre-4.4.133-gnu/fs/btrfs/extent-tree.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/extent-tree.c	2018-05-30 01:49:18.000000000 -0400
@@ -4392,6 +4392,7 @@ again:
 	if (wait_for_alloc) {
 		mutex_unlock(&fs_info->chunk_mutex);
 		wait_for_alloc = 0;
+		cond_resched();
 		goto again;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/file.c linux-libre-4.4.134-gnu/fs/btrfs/file.c
--- linux-libre-4.4.133-gnu/fs/btrfs/file.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/file.c	2018-05-30 01:49:18.000000000 -0400
@@ -1861,10 +1861,19 @@ int btrfs_release_file(struct inode *ino
 static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end)
 {
 	int ret;
+	struct blk_plug plug;
 
+	/*
+	 * This is only called in fsync, which would do synchronous writes, so
+	 * a plug can merge adjacent IOs as much as possible.  Esp. in case of
+	 * multiple disks using raid profile, a large IO can be split to
+	 * several segments of stripe length (currently 64K).
+	 */
+	blk_start_plug(&plug);
 	atomic_inc(&BTRFS_I(inode)->sync_writers);
 	ret = btrfs_fdatawrite_range(inode, start, end);
 	atomic_dec(&BTRFS_I(inode)->sync_writers);
+	blk_finish_plug(&plug);
 
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/inode.c linux-libre-4.4.134-gnu/fs/btrfs/inode.c
--- linux-libre-4.4.133-gnu/fs/btrfs/inode.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/inode.c	2018-05-30 01:49:18.000000000 -0400
@@ -6413,8 +6413,7 @@ static int btrfs_mknod(struct inode *dir
 		goto out_unlock_inode;
 	} else {
 		btrfs_update_inode(trans, root, inode);
-		unlock_new_inode(inode);
-		d_instantiate(dentry, inode);
+		d_instantiate_new(dentry, inode);
 	}
 
 out_unlock:
@@ -6489,8 +6488,7 @@ static int btrfs_create(struct inode *di
 		goto out_unlock_inode;
 
 	BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 
 out_unlock:
 	btrfs_end_transaction(trans, root);
@@ -6633,12 +6631,7 @@ static int btrfs_mkdir(struct inode *dir
 	if (err)
 		goto out_fail_inode;
 
-	d_instantiate(dentry, inode);
-	/*
-	 * mkdir is special.  We're unlocking after we call d_instantiate
-	 * to avoid a race with nfsd calling d_instantiate.
-	 */
-	unlock_new_inode(inode);
+	d_instantiate_new(dentry, inode);
 	drop_on_err = 0;
 
 out_fail:
@@ -9789,8 +9782,7 @@ static int btrfs_symlink(struct inode *d
 		goto out_unlock_inode;
 	}
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 
 out_unlock:
 	btrfs_end_transaction(trans, root);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/raid56.c linux-libre-4.4.134-gnu/fs/btrfs/raid56.c
--- linux-libre-4.4.133-gnu/fs/btrfs/raid56.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/raid56.c	2018-05-30 01:49:18.000000000 -0400
@@ -2160,11 +2160,21 @@ int raid56_parity_recover(struct btrfs_r
 	}
 
 	/*
-	 * reconstruct from the q stripe if they are
-	 * asking for mirror 3
+	 * Loop retry:
+	 * for 'mirror == 2', reconstruct from all other stripes.
+	 * for 'mirror_num > 2', select a stripe to fail on every retry.
 	 */
-	if (mirror_num == 3)
-		rbio->failb = rbio->real_stripes - 2;
+	if (mirror_num > 2) {
+		/*
+		 * 'mirror == 3' is to fail the p stripe and
+		 * reconstruct from the q stripe.  'mirror > 3' is to
+		 * fail a data stripe and reconstruct from p+q stripe.
+		 */
+		rbio->failb = rbio->real_stripes - (mirror_num - 1);
+		ASSERT(rbio->failb > 0);
+		if (rbio->failb <= rbio->faila)
+			rbio->failb--;
+	}
 
 	ret = lock_stripe_add(rbio);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/send.c linux-libre-4.4.134-gnu/fs/btrfs/send.c
--- linux-libre-4.4.133-gnu/fs/btrfs/send.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/send.c	2018-05-30 01:49:18.000000000 -0400
@@ -4674,6 +4674,9 @@ static int send_hole(struct send_ctx *sc
 	u64 len;
 	int ret = 0;
 
+	if (sctx->flags & BTRFS_SEND_FLAG_NO_FILE_DATA)
+		return send_update_extent(sctx, offset, end - offset);
+
 	p = fs_path_alloc();
 	if (!p)
 		return -ENOMEM;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/tests/qgroup-tests.c linux-libre-4.4.134-gnu/fs/btrfs/tests/qgroup-tests.c
--- linux-libre-4.4.133-gnu/fs/btrfs/tests/qgroup-tests.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/tests/qgroup-tests.c	2018-05-30 01:49:18.000000000 -0400
@@ -70,7 +70,7 @@ static int insert_normal_tree_ref(struct
 	btrfs_set_extent_generation(leaf, item, 1);
 	btrfs_set_extent_flags(leaf, item, BTRFS_EXTENT_FLAG_TREE_BLOCK);
 	block_info = (struct btrfs_tree_block_info *)(item + 1);
-	btrfs_set_tree_block_level(leaf, block_info, 1);
+	btrfs_set_tree_block_level(leaf, block_info, 0);
 	iref = (struct btrfs_extent_inline_ref *)(block_info + 1);
 	if (parent > 0) {
 		btrfs_set_extent_inline_ref_type(leaf, iref,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/tree-log.c linux-libre-4.4.134-gnu/fs/btrfs/tree-log.c
--- linux-libre-4.4.133-gnu/fs/btrfs/tree-log.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/tree-log.c	2018-05-30 01:49:18.000000000 -0400
@@ -2223,8 +2223,10 @@ again:
 			nritems = btrfs_header_nritems(path->nodes[0]);
 			if (path->slots[0] >= nritems) {
 				ret = btrfs_next_leaf(root, path);
-				if (ret)
+				if (ret == 1)
 					break;
+				else if (ret < 0)
+					goto out;
 			}
 			btrfs_item_key_to_cpu(path->nodes[0], &found_key,
 					      path->slots[0]);
@@ -3378,8 +3380,11 @@ static noinline int log_dir_items(struct
 		 * from this directory and from this transaction
 		 */
 		ret = btrfs_next_leaf(root, path);
-		if (ret == 1) {
-			last_offset = (u64)-1;
+		if (ret) {
+			if (ret == 1)
+				last_offset = (u64)-1;
+			else
+				err = ret;
 			goto done;
 		}
 		btrfs_item_key_to_cpu(path->nodes[0], &tmp, path->slots[0]);
@@ -3830,6 +3835,7 @@ fill_holes:
 			ASSERT(ret == 0);
 			src = src_path->nodes[0];
 			i = 0;
+			need_find_last_extent = true;
 		}
 
 		btrfs_item_key_to_cpu(src, &key, i);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/btrfs/volumes.c linux-libre-4.4.134-gnu/fs/btrfs/volumes.c
--- linux-libre-4.4.133-gnu/fs/btrfs/volumes.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/btrfs/volumes.c	2018-05-30 01:49:18.000000000 -0400
@@ -5056,7 +5056,14 @@ int btrfs_num_copies(struct btrfs_fs_inf
 	else if (map->type & BTRFS_BLOCK_GROUP_RAID5)
 		ret = 2;
 	else if (map->type & BTRFS_BLOCK_GROUP_RAID6)
-		ret = 3;
+		/*
+		 * There could be two corrupted data stripes, we need
+		 * to loop retry in order to rebuild the correct data.
+		 *
+		 * Fail a stripe at a time on every retry except the
+		 * stripe under reconstruction.
+		 */
+		ret = map->num_stripes;
 	else
 		ret = 1;
 	free_extent_map(em);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/cifs/cifssmb.c linux-libre-4.4.134-gnu/fs/cifs/cifssmb.c
--- linux-libre-4.4.133-gnu/fs/cifs/cifssmb.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/cifs/cifssmb.c	2018-05-30 01:49:18.000000000 -0400
@@ -6421,9 +6421,7 @@ SetEARetry:
 	pSMB->InformationLevel =
 		cpu_to_le16(SMB_SET_FILE_EA);
 
-	parm_data =
-		(struct fealist *) (((char *) &pSMB->hdr.Protocol) +
-				       offset);
+	parm_data = (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset;
 	pSMB->ParameterOffset = cpu_to_le16(param_offset);
 	pSMB->DataOffset = cpu_to_le16(offset);
 	pSMB->SetupCount = 1;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/dcache.c linux-libre-4.4.134-gnu/fs/dcache.c
--- linux-libre-4.4.133-gnu/fs/dcache.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/dcache.c	2018-05-30 01:49:18.000000000 -0400
@@ -1897,6 +1897,28 @@ struct dentry *d_instantiate_unique(stru
 
 EXPORT_SYMBOL(d_instantiate_unique);
 
+/*
+ * This should be equivalent to d_instantiate() + unlock_new_inode(),
+ * with lockdep-related part of unlock_new_inode() done before
+ * anything else.  Use that instead of open-coding d_instantiate()/
+ * unlock_new_inode() combinations.
+ */
+void d_instantiate_new(struct dentry *entry, struct inode *inode)
+{
+	BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
+	BUG_ON(!inode);
+	lockdep_annotate_inode_mutex_key(inode);
+	security_d_instantiate(entry, inode);
+	spin_lock(&inode->i_lock);
+	__d_instantiate(entry, inode);
+	WARN_ON(!(inode->i_state & I_NEW));
+	inode->i_state &= ~I_NEW;
+	smp_mb();
+	wake_up_bit(&inode->i_state, __I_NEW);
+	spin_unlock(&inode->i_lock);
+}
+EXPORT_SYMBOL(d_instantiate_new);
+
 /**
  * d_instantiate_no_diralias - instantiate a non-aliased dentry
  * @entry: dentry to complete
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ecryptfs/inode.c linux-libre-4.4.134-gnu/fs/ecryptfs/inode.c
--- linux-libre-4.4.133-gnu/fs/ecryptfs/inode.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ecryptfs/inode.c	2018-05-30 01:49:18.000000000 -0400
@@ -287,8 +287,7 @@ ecryptfs_create(struct inode *directory_
 		iput(ecryptfs_inode);
 		goto out;
 	}
-	unlock_new_inode(ecryptfs_inode);
-	d_instantiate(ecryptfs_dentry, ecryptfs_inode);
+	d_instantiate_new(ecryptfs_dentry, ecryptfs_inode);
 out:
 	return rc;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ext2/namei.c linux-libre-4.4.134-gnu/fs/ext2/namei.c
--- linux-libre-4.4.133-gnu/fs/ext2/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ext2/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -40,8 +40,7 @@ static inline int ext2_add_nondir(struct
 {
 	int err = ext2_add_link(dentry, inode);
 	if (!err) {
-		unlock_new_inode(inode);
-		d_instantiate(dentry, inode);
+		d_instantiate_new(dentry, inode);
 		return 0;
 	}
 	inode_dec_link_count(inode);
@@ -267,8 +266,7 @@ static int ext2_mkdir(struct inode * dir
 	if (err)
 		goto out_fail;
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 out:
 	return err;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ext4/namei.c linux-libre-4.4.134-gnu/fs/ext4/namei.c
--- linux-libre-4.4.133-gnu/fs/ext4/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ext4/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -2429,8 +2429,7 @@ static int ext4_add_nondir(handle_t *han
 	int err = ext4_add_entry(handle, dentry, inode);
 	if (!err) {
 		ext4_mark_inode_dirty(handle, inode);
-		unlock_new_inode(inode);
-		d_instantiate(dentry, inode);
+		d_instantiate_new(dentry, inode);
 		return 0;
 	}
 	drop_nlink(inode);
@@ -2669,8 +2668,7 @@ out_clear_inode:
 	err = ext4_mark_inode_dirty(handle, dir);
 	if (err)
 		goto out_clear_inode;
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	if (IS_DIRSYNC(dir))
 		ext4_handle_sync(handle);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/f2fs/namei.c linux-libre-4.4.134-gnu/fs/f2fs/namei.c
--- linux-libre-4.4.133-gnu/fs/f2fs/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/f2fs/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -150,8 +150,7 @@ static int f2fs_create(struct inode *dir
 
 	alloc_nid_done(sbi, ino);
 
-	d_instantiate(dentry, inode);
-	unlock_new_inode(inode);
+	d_instantiate_new(dentry, inode);
 
 	if (IS_DIRSYNC(dir))
 		f2fs_sync_fs(sbi->sb, 1);
@@ -399,8 +398,7 @@ static int f2fs_symlink(struct inode *di
 	err = page_symlink(inode, p_str, p_len);
 
 err_out:
-	d_instantiate(dentry, inode);
-	unlock_new_inode(inode);
+	d_instantiate_new(dentry, inode);
 
 	/*
 	 * Let's flush symlink data in order to avoid broken symlink as much as
@@ -454,8 +452,7 @@ static int f2fs_mkdir(struct inode *dir,
 
 	alloc_nid_done(sbi, inode->i_ino);
 
-	d_instantiate(dentry, inode);
-	unlock_new_inode(inode);
+	d_instantiate_new(dentry, inode);
 
 	if (IS_DIRSYNC(dir))
 		f2fs_sync_fs(sbi->sb, 1);
@@ -499,8 +496,7 @@ static int f2fs_mknod(struct inode *dir,
 
 	alloc_nid_done(sbi, inode->i_ino);
 
-	d_instantiate(dentry, inode);
-	unlock_new_inode(inode);
+	d_instantiate_new(dentry, inode);
 
 	if (IS_DIRSYNC(dir))
 		f2fs_sync_fs(sbi->sb, 1);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/fscache/page.c linux-libre-4.4.134-gnu/fs/fscache/page.c
--- linux-libre-4.4.133-gnu/fs/fscache/page.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/fscache/page.c	2018-05-30 01:49:18.000000000 -0400
@@ -776,6 +776,7 @@ static void fscache_write_op(struct fsca
 
 	_enter("{OP%x,%d}", op->op.debug_id, atomic_read(&op->op.usage));
 
+again:
 	spin_lock(&object->lock);
 	cookie = object->cookie;
 
@@ -816,10 +817,6 @@ static void fscache_write_op(struct fsca
 		goto superseded;
 	page = results[0];
 	_debug("gang %d [%lx]", n, page->index);
-	if (page->index >= op->store_limit) {
-		fscache_stat(&fscache_n_store_pages_over_limit);
-		goto superseded;
-	}
 
 	radix_tree_tag_set(&cookie->stores, page->index,
 			   FSCACHE_COOKIE_STORING_TAG);
@@ -829,6 +826,9 @@ static void fscache_write_op(struct fsca
 	spin_unlock(&cookie->stores_lock);
 	spin_unlock(&object->lock);
 
+	if (page->index >= op->store_limit)
+		goto discard_page;
+
 	fscache_stat(&fscache_n_store_pages);
 	fscache_stat(&fscache_n_cop_write_page);
 	ret = object->cache->ops->write_page(op, page);
@@ -844,6 +844,11 @@ static void fscache_write_op(struct fsca
 	_leave("");
 	return;
 
+discard_page:
+	fscache_stat(&fscache_n_store_pages_over_limit);
+	fscache_end_page_write(object, page);
+	goto again;
+
 superseded:
 	/* this writer is going away and there aren't any more things to
 	 * write */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/gfs2/file.c linux-libre-4.4.134-gnu/fs/gfs2/file.c
--- linux-libre-4.4.133-gnu/fs/gfs2/file.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/gfs2/file.c	2018-05-30 01:49:18.000000000 -0400
@@ -806,7 +806,7 @@ static long __gfs2_fallocate(struct file
 	struct gfs2_inode *ip = GFS2_I(inode);
 	struct gfs2_alloc_parms ap = { .aflags = 0, };
 	unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
-	loff_t bytes, max_bytes, max_blks = UINT_MAX;
+	loff_t bytes, max_bytes, max_blks;
 	int error;
 	const loff_t pos = offset;
 	const loff_t count = len;
@@ -858,7 +858,8 @@ static long __gfs2_fallocate(struct file
 			return error;
 		/* ap.allowed tells us how many blocks quota will allow
 		 * us to write. Check if this reduces max_blks */
-		if (ap.allowed && ap.allowed < max_blks)
+		max_blks = UINT_MAX;
+		if (ap.allowed)
 			max_blks = ap.allowed;
 
 		error = gfs2_inplace_reserve(ip, &ap);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/gfs2/quota.h linux-libre-4.4.134-gnu/fs/gfs2/quota.h
--- linux-libre-4.4.133-gnu/fs/gfs2/quota.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/gfs2/quota.h	2018-05-30 01:49:18.000000000 -0400
@@ -43,6 +43,8 @@ static inline int gfs2_quota_lock_check(
 {
 	struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
 	int ret;
+
+	ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
 	if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
 		return 0;
 	ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/jffs2/dir.c linux-libre-4.4.134-gnu/fs/jffs2/dir.c
--- linux-libre-4.4.133-gnu/fs/jffs2/dir.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/jffs2/dir.c	2018-05-30 01:49:18.000000000 -0400
@@ -207,8 +207,7 @@ static int jffs2_create(struct inode *di
 		  __func__, inode->i_ino, inode->i_mode, inode->i_nlink,
 		  f->inocache->pino_nlink, inode->i_mapping->nrpages);
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	return 0;
 
  fail:
@@ -428,8 +427,7 @@ static int jffs2_symlink (struct inode *
 	mutex_unlock(&dir_f->sem);
 	jffs2_complete_reservation(c);
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	return 0;
 
  fail:
@@ -573,8 +571,7 @@ static int jffs2_mkdir (struct inode *di
 	mutex_unlock(&dir_f->sem);
 	jffs2_complete_reservation(c);
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	return 0;
 
  fail:
@@ -745,8 +742,7 @@ static int jffs2_mknod (struct inode *di
 	mutex_unlock(&dir_f->sem);
 	jffs2_complete_reservation(c);
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	return 0;
 
  fail:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/jffs2/fs.c linux-libre-4.4.134-gnu/fs/jffs2/fs.c
--- linux-libre-4.4.133-gnu/fs/jffs2/fs.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/jffs2/fs.c	2018-05-30 01:49:18.000000000 -0400
@@ -361,7 +361,6 @@ error_io:
 	ret = -EIO;
 error:
 	mutex_unlock(&f->sem);
-	jffs2_do_clear_inode(c, f);
 	iget_failed(inode);
 	return ERR_PTR(ret);
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/jfs/namei.c linux-libre-4.4.134-gnu/fs/jfs/namei.c
--- linux-libre-4.4.133-gnu/fs/jfs/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/jfs/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -178,8 +178,7 @@ static int jfs_create(struct inode *dip,
 		unlock_new_inode(ip);
 		iput(ip);
 	} else {
-		unlock_new_inode(ip);
-		d_instantiate(dentry, ip);
+		d_instantiate_new(dentry, ip);
 	}
 
       out2:
@@ -313,8 +312,7 @@ static int jfs_mkdir(struct inode *dip,
 		unlock_new_inode(ip);
 		iput(ip);
 	} else {
-		unlock_new_inode(ip);
-		d_instantiate(dentry, ip);
+		d_instantiate_new(dentry, ip);
 	}
 
       out2:
@@ -1058,8 +1056,7 @@ static int jfs_symlink(struct inode *dip
 		unlock_new_inode(ip);
 		iput(ip);
 	} else {
-		unlock_new_inode(ip);
-		d_instantiate(dentry, ip);
+		d_instantiate_new(dentry, ip);
 	}
 
       out2:
@@ -1443,8 +1440,7 @@ static int jfs_mknod(struct inode *dir,
 		unlock_new_inode(ip);
 		iput(ip);
 	} else {
-		unlock_new_inode(ip);
-		d_instantiate(dentry, ip);
+		d_instantiate_new(dentry, ip);
 	}
 
       out1:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/nfs/nfs4proc.c linux-libre-4.4.134-gnu/fs/nfs/nfs4proc.c
--- linux-libre-4.4.133-gnu/fs/nfs/nfs4proc.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/nfs/nfs4proc.c	2018-05-30 01:49:18.000000000 -0400
@@ -1780,7 +1780,7 @@ static int nfs4_open_reclaim(struct nfs4
 	return ret;
 }
 
-static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs4_state *state, const nfs4_stateid *stateid, int err)
+static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct nfs4_state *state, const nfs4_stateid *stateid, struct file_lock *fl, int err)
 {
 	switch (err) {
 		default:
@@ -1827,7 +1827,11 @@ static int nfs4_handle_delegation_recall
 			return -EAGAIN;
 		case -ENOMEM:
 		case -NFS4ERR_DENIED:
-			/* kill_proc(fl->fl_pid, SIGLOST, 1); */
+			if (fl) {
+				struct nfs4_lock_state *lsp = fl->fl_u.nfs4_fl.owner;
+				if (lsp)
+					set_bit(NFS_LOCK_LOST, &lsp->ls_flags);
+			}
 			return 0;
 	}
 	return err;
@@ -1863,7 +1867,7 @@ int nfs4_open_delegation_recall(struct n
 		err = nfs4_open_recover_helper(opendata, FMODE_READ);
 	}
 	nfs4_opendata_put(opendata);
-	return nfs4_handle_delegation_recall_error(server, state, stateid, err);
+	return nfs4_handle_delegation_recall_error(server, state, stateid, NULL, err);
 }
 
 static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata)
@@ -6157,7 +6161,7 @@ int nfs4_lock_delegation_recall(struct f
 	if (err != 0)
 		return err;
 	err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW);
-	return nfs4_handle_delegation_recall_error(server, state, stateid, err);
+	return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err);
 }
 
 struct nfs_release_lockowner_data {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/nfs/nfs4state.c linux-libre-4.4.134-gnu/fs/nfs/nfs4state.c
--- linux-libre-4.4.133-gnu/fs/nfs/nfs4state.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/nfs/nfs4state.c	2018-05-30 01:49:18.000000000 -0400
@@ -1386,6 +1386,7 @@ static int nfs4_reclaim_locks(struct nfs
 	struct inode *inode = state->inode;
 	struct nfs_inode *nfsi = NFS_I(inode);
 	struct file_lock *fl;
+	struct nfs4_lock_state *lsp;
 	int status = 0;
 	struct file_lock_context *flctx = inode->i_flctx;
 	struct list_head *list;
@@ -1426,7 +1427,9 @@ restart:
 		case -NFS4ERR_DENIED:
 		case -NFS4ERR_RECLAIM_BAD:
 		case -NFS4ERR_RECLAIM_CONFLICT:
-			/* kill_proc(fl->fl_pid, SIGLOST, 1); */
+			lsp = fl->fl_u.nfs4_fl.owner;
+			if (lsp)
+				set_bit(NFS_LOCK_LOST, &lsp->ls_flags);
 			status = 0;
 		}
 		spin_lock(&flctx->flc_lock);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/nfs/nfs4sysctl.c linux-libre-4.4.134-gnu/fs/nfs/nfs4sysctl.c
--- linux-libre-4.4.133-gnu/fs/nfs/nfs4sysctl.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/nfs/nfs4sysctl.c	2018-05-30 01:49:18.000000000 -0400
@@ -31,7 +31,7 @@ static struct ctl_table nfs4_cb_sysctls[
 		.data = &nfs_idmap_cache_timeout,
 		.maxlen = sizeof(int),
 		.mode = 0644,
-		.proc_handler = proc_dointvec_jiffies,
+		.proc_handler = proc_dointvec,
 	},
 	{ }
 };
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/nilfs2/namei.c linux-libre-4.4.134-gnu/fs/nilfs2/namei.c
--- linux-libre-4.4.133-gnu/fs/nilfs2/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/nilfs2/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -50,8 +50,7 @@ static inline int nilfs_add_nondir(struc
 {
 	int err = nilfs_add_link(dentry, inode);
 	if (!err) {
-		d_instantiate(dentry, inode);
-		unlock_new_inode(inode);
+		d_instantiate_new(dentry, inode);
 		return 0;
 	}
 	inode_dec_link_count(inode);
@@ -246,8 +245,7 @@ static int nilfs_mkdir(struct inode *dir
 		goto out_fail;
 
 	nilfs_mark_inode_dirty(inode);
-	d_instantiate(dentry, inode);
-	unlock_new_inode(inode);
+	d_instantiate_new(dentry, inode);
 out:
 	if (!err)
 		err = nilfs_transaction_commit(dir->i_sb);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/acl.c linux-libre-4.4.134-gnu/fs/ocfs2/acl.c
--- linux-libre-4.4.133-gnu/fs/ocfs2/acl.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/acl.c	2018-05-30 01:49:18.000000000 -0400
@@ -314,7 +314,9 @@ struct posix_acl *ocfs2_iop_get_acl(stru
 		return ERR_PTR(ret);
 	}
 
+	down_read(&OCFS2_I(inode)->ip_xattr_sem);
 	acl = ocfs2_get_acl_nolock(inode, type, di_bh);
+	up_read(&OCFS2_I(inode)->ip_xattr_sem);
 
 	ocfs2_inode_unlock(inode, 0);
 	brelse(di_bh);
@@ -333,7 +335,9 @@ int ocfs2_acl_chmod(struct inode *inode,
 	if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
 		return 0;
 
+	down_read(&OCFS2_I(inode)->ip_xattr_sem);
 	acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, bh);
+	up_read(&OCFS2_I(inode)->ip_xattr_sem);
 	if (IS_ERR(acl) || !acl)
 		return PTR_ERR(acl);
 	ret = __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
@@ -364,8 +368,10 @@ int ocfs2_init_acl(handle_t *handle,
 
 	if (!S_ISLNK(inode->i_mode)) {
 		if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) {
+			down_read(&OCFS2_I(dir)->ip_xattr_sem);
 			acl = ocfs2_get_acl_nolock(dir, ACL_TYPE_DEFAULT,
 						   dir_bh);
+			up_read(&OCFS2_I(dir)->ip_xattr_sem);
 			if (IS_ERR(acl))
 				return PTR_ERR(acl);
 		}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/dlm/dlmdomain.c linux-libre-4.4.134-gnu/fs/ocfs2/dlm/dlmdomain.c
--- linux-libre-4.4.133-gnu/fs/ocfs2/dlm/dlmdomain.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/dlm/dlmdomain.c	2018-05-30 01:49:18.000000000 -0400
@@ -674,20 +674,6 @@ static void dlm_leave_domain(struct dlm_
 	spin_unlock(&dlm->spinlock);
 }
 
-int dlm_shutting_down(struct dlm_ctxt *dlm)
-{
-	int ret = 0;
-
-	spin_lock(&dlm_domain_lock);
-
-	if (dlm->dlm_state == DLM_CTXT_IN_SHUTDOWN)
-		ret = 1;
-
-	spin_unlock(&dlm_domain_lock);
-
-	return ret;
-}
-
 void dlm_unregister_domain(struct dlm_ctxt *dlm)
 {
 	int leave = 0;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/dlm/dlmdomain.h linux-libre-4.4.134-gnu/fs/ocfs2/dlm/dlmdomain.h
--- linux-libre-4.4.133-gnu/fs/ocfs2/dlm/dlmdomain.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/dlm/dlmdomain.h	2018-05-30 01:49:18.000000000 -0400
@@ -28,7 +28,30 @@
 extern spinlock_t dlm_domain_lock;
 extern struct list_head dlm_domains;
 
-int dlm_shutting_down(struct dlm_ctxt *dlm);
+static inline int dlm_joined(struct dlm_ctxt *dlm)
+{
+	int ret = 0;
+
+	spin_lock(&dlm_domain_lock);
+	if (dlm->dlm_state == DLM_CTXT_JOINED)
+		ret = 1;
+	spin_unlock(&dlm_domain_lock);
+
+	return ret;
+}
+
+static inline int dlm_shutting_down(struct dlm_ctxt *dlm)
+{
+	int ret = 0;
+
+	spin_lock(&dlm_domain_lock);
+	if (dlm->dlm_state == DLM_CTXT_IN_SHUTDOWN)
+		ret = 1;
+	spin_unlock(&dlm_domain_lock);
+
+	return ret;
+}
+
 void dlm_fire_domain_eviction_callbacks(struct dlm_ctxt *dlm,
 					int node_num);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/dlm/dlmrecovery.c linux-libre-4.4.134-gnu/fs/ocfs2/dlm/dlmrecovery.c
--- linux-libre-4.4.133-gnu/fs/ocfs2/dlm/dlmrecovery.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/dlm/dlmrecovery.c	2018-05-30 01:49:18.000000000 -0400
@@ -1377,6 +1377,15 @@ int dlm_mig_lockres_handler(struct o2net
 	if (!dlm_grab(dlm))
 		return -EINVAL;
 
+	if (!dlm_joined(dlm)) {
+		mlog(ML_ERROR, "Domain %s not joined! "
+			  "lockres %.*s, master %u\n",
+			  dlm->name, mres->lockname_len,
+			  mres->lockname, mres->master);
+		dlm_put(dlm);
+		return -EINVAL;
+	}
+
 	BUG_ON(!(mres->flags & (DLM_MRES_RECOVERY|DLM_MRES_MIGRATION)));
 
 	real_master = mres->master;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/journal.c linux-libre-4.4.134-gnu/fs/ocfs2/journal.c
--- linux-libre-4.4.133-gnu/fs/ocfs2/journal.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/journal.c	2018-05-30 01:49:18.000000000 -0400
@@ -666,23 +666,24 @@ static int __ocfs2_journal_access(handle
 	/* we can safely remove this assertion after testing. */
 	if (!buffer_uptodate(bh)) {
 		mlog(ML_ERROR, "giving me a buffer that's not uptodate!\n");
-		mlog(ML_ERROR, "b_blocknr=%llu\n",
-		     (unsigned long long)bh->b_blocknr);
+		mlog(ML_ERROR, "b_blocknr=%llu, b_state=0x%lx\n",
+		     (unsigned long long)bh->b_blocknr, bh->b_state);
 
 		lock_buffer(bh);
 		/*
-		 * A previous attempt to write this buffer head failed.
-		 * Nothing we can do but to retry the write and hope for
-		 * the best.
+		 * A previous transaction with a couple of buffer heads fail
+		 * to checkpoint, so all the bhs are marked as BH_Write_EIO.
+		 * For current transaction, the bh is just among those error
+		 * bhs which previous transaction handle. We can't just clear
+		 * its BH_Write_EIO and reuse directly, since other bhs are
+		 * not written to disk yet and that will cause metadata
+		 * inconsistency. So we should set fs read-only to avoid
+		 * further damage.
 		 */
 		if (buffer_write_io_error(bh) && !buffer_uptodate(bh)) {
-			clear_buffer_write_io_error(bh);
-			set_buffer_uptodate(bh);
-		}
-
-		if (!buffer_uptodate(bh)) {
 			unlock_buffer(bh);
-			return -EIO;
+			return ocfs2_error(osb->sb, "A previous attempt to "
+					"write this buffer head failed\n");
 		}
 		unlock_buffer(bh);
 	}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/super.c linux-libre-4.4.134-gnu/fs/ocfs2/super.c
--- linux-libre-4.4.133-gnu/fs/ocfs2/super.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/super.c	2018-05-30 01:49:18.000000000 -0400
@@ -477,9 +477,8 @@ static int ocfs2_init_global_system_inod
 		new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
 		if (!new) {
 			ocfs2_release_system_inodes(osb);
-			status = -EINVAL;
+			status = ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL;
 			mlog_errno(status);
-			/* FIXME: Should ERROR_RO_FS */
 			mlog(ML_ERROR, "Unable to load system inode %d, "
 			     "possibly corrupt fs?", i);
 			goto bail;
@@ -508,7 +507,7 @@ static int ocfs2_init_local_system_inode
 		new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
 		if (!new) {
 			ocfs2_release_system_inodes(osb);
-			status = -EINVAL;
+			status = ocfs2_is_soft_readonly(osb) ? -EROFS : -EINVAL;
 			mlog(ML_ERROR, "status=%d, sysfile=%d, slot=%d\n",
 			     status, i, osb->slot_num);
 			goto bail;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ocfs2/xattr.c linux-libre-4.4.134-gnu/fs/ocfs2/xattr.c
--- linux-libre-4.4.133-gnu/fs/ocfs2/xattr.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ocfs2/xattr.c	2018-05-30 01:49:18.000000000 -0400
@@ -639,9 +639,11 @@ int ocfs2_calc_xattr_init(struct inode *
 						     si->value_len);
 
 	if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) {
+		down_read(&OCFS2_I(dir)->ip_xattr_sem);
 		acl_len = ocfs2_xattr_get_nolock(dir, dir_bh,
 					OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT,
 					"", NULL, 0);
+		up_read(&OCFS2_I(dir)->ip_xattr_sem);
 		if (acl_len > 0) {
 			a_size = ocfs2_xattr_entry_real_size(0, acl_len);
 			if (S_ISDIR(mode))
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/proc/base.c linux-libre-4.4.134-gnu/fs/proc/base.c
--- linux-libre-4.4.133-gnu/fs/proc/base.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/proc/base.c	2018-05-30 01:49:18.000000000 -0400
@@ -94,6 +94,8 @@
 #include "internal.h"
 #include "fd.h"
 
+#include "../../lib/kstrtox.h"
+
 /* NOTE:
  *	Implementing inode permission operations in /proc is almost
  *	certainly an error.  Permission checks need to happen during
@@ -1836,8 +1838,33 @@ end_instantiate:
 static int dname_to_vma_addr(struct dentry *dentry,
 			     unsigned long *start, unsigned long *end)
 {
-	if (sscanf(dentry->d_name.name, "%lx-%lx", start, end) != 2)
+	const char *str = dentry->d_name.name;
+	unsigned long long sval, eval;
+	unsigned int len;
+
+	len = _parse_integer(str, 16, &sval);
+	if (len & KSTRTOX_OVERFLOW)
+		return -EINVAL;
+	if (sval != (unsigned long)sval)
+		return -EINVAL;
+	str += len;
+
+	if (*str != '-')
 		return -EINVAL;
+	str++;
+
+	len = _parse_integer(str, 16, &eval);
+	if (len & KSTRTOX_OVERFLOW)
+		return -EINVAL;
+	if (eval != (unsigned long)eval)
+		return -EINVAL;
+	str += len;
+
+	if (*str != '\0')
+		return -EINVAL;
+
+	*start = sval;
+	*end = eval;
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/proc/proc_sysctl.c linux-libre-4.4.134-gnu/fs/proc/proc_sysctl.c
--- linux-libre-4.4.133-gnu/fs/proc/proc_sysctl.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/proc/proc_sysctl.c	2018-05-30 01:49:18.000000000 -0400
@@ -654,7 +654,10 @@ static bool proc_sys_link_fill_cache(str
 				    struct ctl_table *table)
 {
 	bool ret = true;
+
 	head = sysctl_head_grab(head);
+	if (IS_ERR(head))
+		return false;
 
 	if (S_ISLNK(table->mode)) {
 		/* It is not an error if we can not follow the link ignore it */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/reiserfs/namei.c linux-libre-4.4.134-gnu/fs/reiserfs/namei.c
--- linux-libre-4.4.133-gnu/fs/reiserfs/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/reiserfs/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -687,8 +687,7 @@ static int reiserfs_create(struct inode
 	reiserfs_update_inode_transaction(inode);
 	reiserfs_update_inode_transaction(dir);
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	retval = journal_end(&th);
 
 out_failed:
@@ -771,8 +770,7 @@ static int reiserfs_mknod(struct inode *
 		goto out_failed;
 	}
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	retval = journal_end(&th);
 
 out_failed:
@@ -871,8 +869,7 @@ static int reiserfs_mkdir(struct inode *
 	/* the above add_entry did not update dir's stat data */
 	reiserfs_update_sd(&th, dir);
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	retval = journal_end(&th);
 out_failed:
 	reiserfs_write_unlock(dir->i_sb);
@@ -1186,8 +1183,7 @@ static int reiserfs_symlink(struct inode
 		goto out_failed;
 	}
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	retval = journal_end(&th);
 out_failed:
 	reiserfs_write_unlock(parent_dir->i_sb);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/udf/namei.c linux-libre-4.4.134-gnu/fs/udf/namei.c
--- linux-libre-4.4.133-gnu/fs/udf/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/udf/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -611,8 +611,7 @@ static int udf_add_nondir(struct dentry
 	if (fibh.sbh != fibh.ebh)
 		brelse(fibh.ebh);
 	brelse(fibh.sbh);
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 
 	return 0;
 }
@@ -722,8 +721,7 @@ static int udf_mkdir(struct inode *dir,
 	inc_nlink(dir);
 	dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
 	mark_inode_dirty(dir);
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	if (fibh.sbh != fibh.ebh)
 		brelse(fibh.ebh);
 	brelse(fibh.sbh);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/udf/super.c linux-libre-4.4.134-gnu/fs/udf/super.c
--- linux-libre-4.4.133-gnu/fs/udf/super.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/udf/super.c	2018-05-30 01:49:18.000000000 -0400
@@ -2073,8 +2073,9 @@ static int udf_fill_super(struct super_b
 	bool lvid_open = false;
 
 	uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
-	uopt.uid = INVALID_UID;
-	uopt.gid = INVALID_GID;
+	/* By default we'll use overflow[ug]id when UDF inode [ug]id == -1 */
+	uopt.uid = make_kuid(current_user_ns(), overflowuid);
+	uopt.gid = make_kgid(current_user_ns(), overflowgid);
 	uopt.umask = 0;
 	uopt.fmode = UDF_INVALID_MODE;
 	uopt.dmode = UDF_INVALID_MODE;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/ufs/namei.c linux-libre-4.4.134-gnu/fs/ufs/namei.c
--- linux-libre-4.4.133-gnu/fs/ufs/namei.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/ufs/namei.c	2018-05-30 01:49:18.000000000 -0400
@@ -38,8 +38,7 @@ static inline int ufs_add_nondir(struct
 {
 	int err = ufs_add_link(dentry, inode);
 	if (!err) {
-		unlock_new_inode(inode);
-		d_instantiate(dentry, inode);
+		d_instantiate_new(dentry, inode);
 		return 0;
 	}
 	inode_dec_link_count(inode);
@@ -191,8 +190,7 @@ static int ufs_mkdir(struct inode * dir,
 	if (err)
 		goto out_fail;
 
-	unlock_new_inode(inode);
-	d_instantiate(dentry, inode);
+	d_instantiate_new(dentry, inode);
 	return 0;
 
 out_fail:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/xfs/libxfs/xfs_attr.c linux-libre-4.4.134-gnu/fs/xfs/libxfs/xfs_attr.c
--- linux-libre-4.4.133-gnu/fs/xfs/libxfs/xfs_attr.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/xfs/libxfs/xfs_attr.c	2018-05-30 01:49:18.000000000 -0400
@@ -130,9 +130,6 @@ xfs_attr_get(
 	if (XFS_FORCED_SHUTDOWN(ip->i_mount))
 		return -EIO;
 
-	if (!xfs_inode_hasattr(ip))
-		return -ENOATTR;
-
 	error = xfs_attr_args_init(&args, ip, name, flags);
 	if (error)
 		return error;
@@ -417,9 +414,6 @@ xfs_attr_remove(
 	if (XFS_FORCED_SHUTDOWN(dp->i_mount))
 		return -EIO;
 
-	if (!xfs_inode_hasattr(dp))
-		return -ENOATTR;
-
 	error = xfs_attr_args_init(&args, dp, name, flags);
 	if (error)
 		return error;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/fs/xfs/xfs_discard.c linux-libre-4.4.134-gnu/fs/xfs/xfs_discard.c
--- linux-libre-4.4.133-gnu/fs/xfs/xfs_discard.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/fs/xfs/xfs_discard.c	2018-05-30 01:49:18.000000000 -0400
@@ -50,19 +50,19 @@ xfs_trim_extents(
 
 	pag = xfs_perag_get(mp, agno);
 
-	error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
-	if (error || !agbp)
-		goto out_put_perag;
-
-	cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
-
 	/*
 	 * Force out the log.  This means any transactions that might have freed
-	 * space before we took the AGF buffer lock are now on disk, and the
+	 * space before we take the AGF buffer lock are now on disk, and the
 	 * volatile disk cache is flushed.
 	 */
 	xfs_log_force(mp, XFS_LOG_SYNC);
 
+	error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
+	if (error || !agbp)
+		goto out_put_perag;
+
+	cur = xfs_allocbt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_CNT);
+
 	/*
 	 * Look up the longest btree in the AGF and start with it.
 	 */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/asm-generic/pgtable.h linux-libre-4.4.134-gnu/include/asm-generic/pgtable.h
--- linux-libre-4.4.133-gnu/include/asm-generic/pgtable.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/asm-generic/pgtable.h	2018-05-30 01:49:18.000000000 -0400
@@ -237,6 +237,21 @@ extern void pgtable_trans_huge_deposit(s
 extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
 #endif
 
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+/*
+ * This is an implementation of pmdp_establish() that is only suitable for an
+ * architecture that doesn't have hardware dirty/accessed bits. In this case we
+ * can't race with CPU which sets these bits and non-atomic aproach is fine.
+ */
+static inline pmd_t generic_pmdp_establish(struct vm_area_struct *vma,
+		unsigned long address, pmd_t *pmdp, pmd_t pmd)
+{
+	pmd_t old_pmd = *pmdp;
+	set_pmd_at(vma->vm_mm, address, pmdp, pmd);
+	return old_pmd;
+}
+#endif
+
 #ifndef __HAVE_ARCH_PMDP_INVALIDATE
 extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
 			    pmd_t *pmdp);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/linux/dcache.h linux-libre-4.4.134-gnu/include/linux/dcache.h
--- linux-libre-4.4.133-gnu/include/linux/dcache.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/linux/dcache.h	2018-05-30 01:49:18.000000000 -0400
@@ -236,6 +236,7 @@ extern seqlock_t rename_lock;
  * These are the low-level FS interfaces to the dcache..
  */
 extern void d_instantiate(struct dentry *, struct inode *);
+extern void d_instantiate_new(struct dentry *, struct inode *);
 extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
 extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
 extern void __d_drop(struct dentry *dentry);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/linux/suspend.h linux-libre-4.4.134-gnu/include/linux/suspend.h
--- linux-libre-4.4.133-gnu/include/linux/suspend.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/linux/suspend.h	2018-05-30 01:49:18.000000000 -0400
@@ -377,6 +377,8 @@ extern int swsusp_page_is_forbidden(stru
 extern void swsusp_set_page_free(struct page *);
 extern void swsusp_unset_page_free(struct page *);
 extern unsigned long get_safe_page(gfp_t gfp_mask);
+extern asmlinkage int swsusp_arch_suspend(void);
+extern asmlinkage int swsusp_arch_resume(void);
 
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
 extern int hibernate(void);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/linux/usb/composite.h linux-libre-4.4.134-gnu/include/linux/usb/composite.h
--- linux-libre-4.4.133-gnu/include/linux/usb/composite.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/linux/usb/composite.h	2018-05-30 01:49:18.000000000 -0400
@@ -53,6 +53,9 @@
 /* big enough to hold our biggest descriptor */
 #define USB_COMP_EP0_BUFSIZ	1024
 
+/* OS feature descriptor length <= 4kB */
+#define USB_COMP_EP0_OS_DESC_BUFSIZ	4096
+
 #define USB_MS_TO_HS_INTERVAL(x)	(ilog2((x * 1000 / 125)) + 1)
 struct usb_configuration;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/net/ip_fib.h linux-libre-4.4.134-gnu/include/net/ip_fib.h
--- linux-libre-4.4.133-gnu/include/net/ip_fib.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/net/ip_fib.h	2018-05-30 01:49:18.000000000 -0400
@@ -56,6 +56,7 @@ struct fib_nh_exception {
 	int				fnhe_genid;
 	__be32				fnhe_daddr;
 	u32				fnhe_pmtu;
+	bool				fnhe_mtu_locked;
 	__be32				fnhe_gw;
 	unsigned long			fnhe_expires;
 	struct rtable __rcu		*fnhe_rth_input;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/net/ip.h linux-libre-4.4.134-gnu/include/net/ip.h
--- linux-libre-4.4.133-gnu/include/net/ip.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/net/ip.h	2018-05-30 01:49:18.000000000 -0400
@@ -279,6 +279,13 @@ int ip_decrease_ttl(struct iphdr *iph)
 	return --iph->ttl;
 }
 
+static inline int ip_mtu_locked(const struct dst_entry *dst)
+{
+	const struct rtable *rt = (const struct rtable *)dst;
+
+	return rt->rt_mtu_locked || dst_metric_locked(dst, RTAX_MTU);
+}
+
 static inline
 int ip_dont_fragment(const struct sock *sk, const struct dst_entry *dst)
 {
@@ -286,7 +293,7 @@ int ip_dont_fragment(const struct sock *
 
 	return  pmtudisc == IP_PMTUDISC_DO ||
 		(pmtudisc == IP_PMTUDISC_WANT &&
-		 !(dst_metric_locked(dst, RTAX_MTU)));
+		 !ip_mtu_locked(dst));
 }
 
 static inline bool ip_sk_accept_pmtu(const struct sock *sk)
@@ -312,7 +319,7 @@ static inline unsigned int ip_dst_mtu_ma
 	struct net *net = dev_net(dst->dev);
 
 	if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
-	    dst_metric_locked(dst, RTAX_MTU) ||
+	    ip_mtu_locked(dst) ||
 	    !forwarding)
 		return dst_mtu(dst);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/net/llc_conn.h linux-libre-4.4.134-gnu/include/net/llc_conn.h
--- linux-libre-4.4.133-gnu/include/net/llc_conn.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/net/llc_conn.h	2018-05-30 01:49:18.000000000 -0400
@@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk);
 
 /* Access to a connection */
 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
-void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
+int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
 void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
 void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit);
 void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/net/mac80211.h linux-libre-4.4.134-gnu/include/net/mac80211.h
--- linux-libre-4.4.133-gnu/include/net/mac80211.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/net/mac80211.h	2018-05-30 01:49:18.000000000 -0400
@@ -3898,7 +3898,7 @@ static inline int ieee80211_sta_ps_trans
  * The TX headroom reserved by mac80211 for its own tx_status functions.
  * This is enough for the radiotap header.
  */
-#define IEEE80211_TX_STATUS_HEADROOM	14
+#define IEEE80211_TX_STATUS_HEADROOM	ALIGN(14, 4)
 
 /**
  * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/net/regulatory.h linux-libre-4.4.134-gnu/include/net/regulatory.h
--- linux-libre-4.4.133-gnu/include/net/regulatory.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/net/regulatory.h	2018-05-30 01:49:18.000000000 -0400
@@ -78,7 +78,7 @@ struct regulatory_request {
 	int wiphy_idx;
 	enum nl80211_reg_initiator initiator;
 	enum nl80211_user_reg_hint_type user_reg_hint_type;
-	char alpha2[2];
+	char alpha2[3];
 	enum nl80211_dfs_regions dfs_region;
 	bool intersect;
 	bool processed;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/net/route.h linux-libre-4.4.134-gnu/include/net/route.h
--- linux-libre-4.4.133-gnu/include/net/route.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/net/route.h	2018-05-30 01:49:18.000000000 -0400
@@ -64,7 +64,8 @@ struct rtable {
 	__be32			rt_gateway;
 
 	/* Miscellaneous cached information */
-	u32			rt_pmtu;
+	u32			rt_mtu_locked:1,
+				rt_pmtu:31;
 
 	u32			rt_table_id;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/trace/events/timer.h linux-libre-4.4.134-gnu/include/trace/events/timer.h
--- linux-libre-4.4.133-gnu/include/trace/events/timer.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/trace/events/timer.h	2018-05-30 01:49:18.000000000 -0400
@@ -125,6 +125,20 @@ DEFINE_EVENT(timer_class, timer_cancel,
 	TP_ARGS(timer)
 );
 
+#define decode_clockid(type)						\
+	__print_symbolic(type,						\
+		{ CLOCK_REALTIME,	"CLOCK_REALTIME"	},	\
+		{ CLOCK_MONOTONIC,	"CLOCK_MONOTONIC"	},	\
+		{ CLOCK_BOOTTIME,	"CLOCK_BOOTTIME"	},	\
+		{ CLOCK_TAI,		"CLOCK_TAI"		})
+
+#define decode_hrtimer_mode(mode)					\
+	__print_symbolic(mode,						\
+		{ HRTIMER_MODE_ABS,		"ABS"		},	\
+		{ HRTIMER_MODE_REL,		"REL"		},	\
+		{ HRTIMER_MODE_ABS_PINNED,	"ABS|PINNED"	},	\
+		{ HRTIMER_MODE_REL_PINNED,	"REL|PINNED"	})
+
 /**
  * hrtimer_init - called when the hrtimer is initialized
  * @hrtimer:	pointer to struct hrtimer
@@ -151,10 +165,8 @@ TRACE_EVENT(hrtimer_init,
 	),
 
 	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
-		  __entry->clockid == CLOCK_REALTIME ?
-			"CLOCK_REALTIME" : "CLOCK_MONOTONIC",
-		  __entry->mode == HRTIMER_MODE_ABS ?
-			"HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
+		  decode_clockid(__entry->clockid),
+		  decode_hrtimer_mode(__entry->mode))
 );
 
 /**
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/uapi/drm/virtgpu_drm.h linux-libre-4.4.134-gnu/include/uapi/drm/virtgpu_drm.h
--- linux-libre-4.4.133-gnu/include/uapi/drm/virtgpu_drm.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/uapi/drm/virtgpu_drm.h	2018-05-30 01:49:18.000000000 -0400
@@ -60,6 +60,7 @@ struct drm_virtgpu_execbuffer {
 };
 
 #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
+#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
 
 struct drm_virtgpu_getparam {
 	uint64_t param;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/include/uapi/linux/if_ether.h linux-libre-4.4.134-gnu/include/uapi/linux/if_ether.h
--- linux-libre-4.4.133-gnu/include/uapi/linux/if_ether.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/include/uapi/linux/if_ether.h	2018-05-30 01:49:18.000000000 -0400
@@ -29,6 +29,7 @@
  */
 
 #define ETH_ALEN	6		/* Octets in one ethernet addr	 */
+#define ETH_TLEN	2		/* Octets in ethernet type field */
 #define ETH_HLEN	14		/* Total octets in header.	 */
 #define ETH_ZLEN	60		/* Min. octets in frame sans FCS */
 #define ETH_DATA_LEN	1500		/* Max. octets in payload	 */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/ipc/shm.c linux-libre-4.4.134-gnu/ipc/shm.c
--- linux-libre-4.4.133-gnu/ipc/shm.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/ipc/shm.c	2018-05-30 01:49:18.000000000 -0400
@@ -1113,14 +1113,17 @@ long do_shmat(int shmid, char __user *sh
 		goto out;
 	else if ((addr = (ulong)shmaddr)) {
 		if (addr & (shmlba - 1)) {
-			/*
-			 * Round down to the nearest multiple of shmlba.
-			 * For sane do_mmap_pgoff() parameters, avoid
-			 * round downs that trigger nil-page and MAP_FIXED.
-			 */
-			if ((shmflg & SHM_RND) && addr >= shmlba)
-				addr &= ~(shmlba - 1);
-			else
+			if (shmflg & SHM_RND) {
+				addr &= ~(shmlba - 1);  /* round down */
+
+				/*
+				 * Ensure that the round-down is non-nil
+				 * when remapping. This can happen for
+				 * cases when addr < shmlba.
+				 */
+				if (!addr && (shmflg & SHM_REMAP))
+					goto out;
+			} else
 #ifndef __ARCH_FORCE_SHMLBA
 				if (addr & ~PAGE_MASK)
 #endif
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/audit.c linux-libre-4.4.134-gnu/kernel/audit.c
--- linux-libre-4.4.133-gnu/kernel/audit.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/audit.c	2018-05-30 01:49:18.000000000 -0400
@@ -744,6 +744,8 @@ static void audit_log_feature_change(int
 		return;
 
 	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE);
+	if (!ab)
+		return;
 	audit_log_task_info(ab, current);
 	audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d",
 			 audit_feature_names[which], !!old_feature, !!new_feature,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/debug/kdb/kdb_main.c linux-libre-4.4.134-gnu/kernel/debug/kdb/kdb_main.c
--- linux-libre-4.4.133-gnu/kernel/debug/kdb/kdb_main.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/debug/kdb/kdb_main.c	2018-05-30 01:49:18.000000000 -0400
@@ -1564,6 +1564,7 @@ static int kdb_md(int argc, const char *
 	int symbolic = 0;
 	int valid = 0;
 	int phys = 0;
+	int raw = 0;
 
 	kdbgetintenv("MDCOUNT", &mdcount);
 	kdbgetintenv("RADIX", &radix);
@@ -1573,9 +1574,10 @@ static int kdb_md(int argc, const char *
 	repeat = mdcount * 16 / bytesperword;
 
 	if (strcmp(argv[0], "mdr") == 0) {
-		if (argc != 2)
+		if (argc == 2 || (argc == 0 && last_addr != 0))
+			valid = raw = 1;
+		else
 			return KDB_ARGCOUNT;
-		valid = 1;
 	} else if (isdigit(argv[0][2])) {
 		bytesperword = (int)(argv[0][2] - '0');
 		if (bytesperword == 0) {
@@ -1611,7 +1613,10 @@ static int kdb_md(int argc, const char *
 		radix = last_radix;
 		bytesperword = last_bytesperword;
 		repeat = last_repeat;
-		mdcount = ((repeat * bytesperword) + 15) / 16;
+		if (raw)
+			mdcount = repeat;
+		else
+			mdcount = ((repeat * bytesperword) + 15) / 16;
 	}
 
 	if (argc) {
@@ -1628,7 +1633,10 @@ static int kdb_md(int argc, const char *
 			diag = kdbgetularg(argv[nextarg], &val);
 			if (!diag) {
 				mdcount = (int) val;
-				repeat = mdcount * 16 / bytesperword;
+				if (raw)
+					repeat = mdcount;
+				else
+					repeat = mdcount * 16 / bytesperword;
 			}
 		}
 		if (argc >= nextarg+1) {
@@ -1638,8 +1646,15 @@ static int kdb_md(int argc, const char *
 		}
 	}
 
-	if (strcmp(argv[0], "mdr") == 0)
-		return kdb_mdr(addr, mdcount);
+	if (strcmp(argv[0], "mdr") == 0) {
+		int ret;
+		last_addr = addr;
+		ret = kdb_mdr(addr, mdcount);
+		last_addr += mdcount;
+		last_repeat = mdcount;
+		last_bytesperword = bytesperword; // to make REPEAT happy
+		return ret;
+	}
 
 	switch (radix) {
 	case 10:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/events/core.c linux-libre-4.4.134-gnu/kernel/events/core.c
--- linux-libre-4.4.133-gnu/kernel/events/core.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/events/core.c	2018-05-30 01:49:18.000000000 -0400
@@ -419,9 +419,15 @@ static inline void __update_cgrp_time(st
 
 static inline void update_cgrp_time_from_cpuctx(struct perf_cpu_context *cpuctx)
 {
-	struct perf_cgroup *cgrp_out = cpuctx->cgrp;
-	if (cgrp_out)
-		__update_cgrp_time(cgrp_out);
+	struct perf_cgroup *cgrp = cpuctx->cgrp;
+	struct cgroup_subsys_state *css;
+
+	if (cgrp) {
+		for (css = &cgrp->css; css; css = css->parent) {
+			cgrp = container_of(css, struct perf_cgroup, css);
+			__update_cgrp_time(cgrp);
+		}
+	}
 }
 
 static inline void update_cgrp_time_from_event(struct perf_event *event)
@@ -449,6 +455,7 @@ perf_cgroup_set_timestamp(struct task_st
 {
 	struct perf_cgroup *cgrp;
 	struct perf_cgroup_info *info;
+	struct cgroup_subsys_state *css;
 
 	/*
 	 * ctx->lock held by caller
@@ -459,8 +466,12 @@ perf_cgroup_set_timestamp(struct task_st
 		return;
 
 	cgrp = perf_cgroup_from_task(task, ctx);
-	info = this_cpu_ptr(cgrp->info);
-	info->timestamp = ctx->timestamp;
+
+	for (css = &cgrp->css; css; css = css->parent) {
+		cgrp = container_of(css, struct perf_cgroup, css);
+		info = this_cpu_ptr(cgrp->info);
+		info->timestamp = ctx->timestamp;
+	}
 }
 
 #define PERF_CGROUP_SWOUT	0x1 /* cgroup switch out every event */
@@ -5288,7 +5299,8 @@ static void perf_output_read_group(struc
 	if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
 		values[n++] = running;
 
-	if (leader != event)
+	if ((leader != event) &&
+	    (leader->state == PERF_EVENT_STATE_ACTIVE))
 		leader->pmu->read(leader);
 
 	values[n++] = perf_event_count(leader);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/locking/qspinlock.c linux-libre-4.4.134-gnu/kernel/locking/qspinlock.c
--- linux-libre-4.4.133-gnu/kernel/locking/qspinlock.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/locking/qspinlock.c	2018-05-30 01:49:18.000000000 -0400
@@ -423,6 +423,14 @@ queue:
 	tail = encode_tail(smp_processor_id(), idx);
 
 	node += idx;
+
+	/*
+	 * Ensure that we increment the head node->count before initialising
+	 * the actual node. If the compiler is kind enough to reorder these
+	 * stores, then an IRQ could overwrite our assignments.
+	 */
+	barrier();
+
 	node->locked = 0;
 	node->next = NULL;
 	pv_init_node(node);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/power/power.h linux-libre-4.4.134-gnu/kernel/power/power.h
--- linux-libre-4.4.133-gnu/kernel/power/power.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/power/power.h	2018-05-30 01:49:18.000000000 -0400
@@ -85,9 +85,6 @@ extern int in_suspend;
 extern dev_t swsusp_resume_device;
 extern sector_t swsusp_resume_block;
 
-extern asmlinkage int swsusp_arch_suspend(void);
-extern asmlinkage int swsusp_arch_resume(void);
-
 extern int create_basic_memory_bitmaps(void);
 extern void free_basic_memory_bitmaps(void);
 extern int hibernate_preallocate_memory(void);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/relay.c linux-libre-4.4.134-gnu/kernel/relay.c
--- linux-libre-4.4.133-gnu/kernel/relay.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/relay.c	2018-05-30 01:49:18.000000000 -0400
@@ -163,7 +163,7 @@ static struct rchan_buf *relay_create_bu
 {
 	struct rchan_buf *buf;
 
-	if (chan->n_subbufs > UINT_MAX / sizeof(size_t *))
+	if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t *))
 		return NULL;
 
 	buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/sched/rt.c linux-libre-4.4.134-gnu/kernel/sched/rt.c
--- linux-libre-4.4.133-gnu/kernel/sched/rt.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/sched/rt.c	2018-05-30 01:49:18.000000000 -0400
@@ -822,6 +822,8 @@ static int do_sched_rt_period_timer(stru
 		struct rq *rq = rq_of_rt_rq(rt_rq);
 
 		raw_spin_lock(&rq->lock);
+		update_rq_clock(rq);
+
 		if (rt_rq->rt_time) {
 			u64 runtime;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/signal.c linux-libre-4.4.134-gnu/kernel/signal.c
--- linux-libre-4.4.133-gnu/kernel/signal.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/signal.c	2018-05-30 01:49:18.000000000 -0400
@@ -1392,6 +1392,10 @@ static int kill_something_info(int sig,
 		return ret;
 	}
 
+	/* -INT_MIN is undefined.  Exclude this case to avoid a UBSAN warning */
+	if (pid == INT_MIN)
+		return -ESRCH;
+
 	read_lock(&tasklist_lock);
 	if (pid != -1) {
 		ret = __kill_pgrp_info(sig, info,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/sys.c linux-libre-4.4.134-gnu/kernel/sys.c
--- linux-libre-4.4.133-gnu/kernel/sys.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/sys.c	2018-05-30 01:49:18.000000000 -0400
@@ -53,6 +53,8 @@
 #include <linux/uidgid.h>
 #include <linux/cred.h>
 
+#include <linux/nospec.h>
+
 #include <linux/kmsg_dump.h>
 /* Move somewhere else to avoid recompiling? */
 #include <generated/utsrelease.h>
@@ -1311,6 +1313,7 @@ SYSCALL_DEFINE2(old_getrlimit, unsigned
 	if (resource >= RLIM_NLIMITS)
 		return -EINVAL;
 
+	resource = array_index_nospec(resource, RLIM_NLIMITS);
 	task_lock(current->group_leader);
 	x = current->signal->rlim[resource];
 	task_unlock(current->group_leader);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/kernel/workqueue.c linux-libre-4.4.134-gnu/kernel/workqueue.c
--- linux-libre-4.4.133-gnu/kernel/workqueue.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/kernel/workqueue.c	2018-05-30 01:49:18.000000000 -0400
@@ -5199,7 +5199,7 @@ int workqueue_sysfs_register(struct work
 
 	ret = device_register(&wq_dev->dev);
 	if (ret) {
-		kfree(wq_dev);
+		put_device(&wq_dev->dev);
 		wq->wq_dev = NULL;
 		return ret;
 	}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/lib/test_bpf.c linux-libre-4.4.134-gnu/lib/test_bpf.c
--- linux-libre-4.4.133-gnu/lib/test_bpf.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/lib/test_bpf.c	2018-05-30 01:49:18.000000000 -0400
@@ -83,6 +83,7 @@ struct bpf_test {
 		__u32 result;
 	} test[MAX_SUBTESTS];
 	int (*fill_helper)(struct bpf_test *self);
+	int expected_errcode; /* used when FLAG_EXPECTED_FAIL is set in the aux */
 	__u8 frag_data[MAX_DATA];
 };
 
@@ -1780,7 +1781,9 @@ static struct bpf_test tests[] = {
 		},
 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
 		{ },
-		{ }
+		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{
 		"check: div_k_0",
@@ -1790,7 +1793,9 @@ static struct bpf_test tests[] = {
 		},
 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
 		{ },
-		{ }
+		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{
 		"check: unknown insn",
@@ -1801,7 +1806,9 @@ static struct bpf_test tests[] = {
 		},
 		CLASSIC | FLAG_EXPECTED_FAIL,
 		{ },
-		{ }
+		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{
 		"check: out of range spill/fill",
@@ -1811,7 +1818,9 @@ static struct bpf_test tests[] = {
 		},
 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
 		{ },
-		{ }
+		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{
 		"JUMPS + HOLES",
@@ -1903,6 +1912,8 @@ static struct bpf_test tests[] = {
 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
 		{ },
 		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{
 		"check: LDX + RET X",
@@ -1913,6 +1924,8 @@ static struct bpf_test tests[] = {
 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
 		{ },
 		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{	/* Mainly checking JIT here. */
 		"M[]: alt STX + LDX",
@@ -2087,6 +2100,8 @@ static struct bpf_test tests[] = {
 		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
 		{ },
 		{ },
+		.fill_helper = NULL,
+		.expected_errcode = -EINVAL,
 	},
 	{	/* Passes checker but fails during runtime. */
 		"LD [SKF_AD_OFF-1]",
@@ -4462,6 +4477,7 @@ static struct bpf_test tests[] = {
 		{ },
 		{ },
 		.fill_helper = bpf_fill_maxinsns4,
+		.expected_errcode = -EINVAL,
 	},
 	{	/* Mainly checking JIT here. */
 		"BPF_MAXINSNS: Very long jump",
@@ -4517,10 +4533,15 @@ static struct bpf_test tests[] = {
 	{
 		"BPF_MAXINSNS: Jump, gap, jump, ...",
 		{ },
+#ifdef CONFIG_BPF_JIT_ALWAYS_ON
+		CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL,
+#else
 		CLASSIC | FLAG_NO_DATA,
+#endif
 		{ },
 		{ { 0, 0xababcbac } },
 		.fill_helper = bpf_fill_maxinsns11,
+		.expected_errcode = -ENOTSUPP,
 	},
 	{
 		"BPF_MAXINSNS: ld_abs+get_processor_id",
@@ -5290,7 +5311,7 @@ static struct bpf_prog *generate_filter(
 
 		*err = bpf_prog_create(&fp, &fprog);
 		if (tests[which].aux & FLAG_EXPECTED_FAIL) {
-			if (*err == -EINVAL) {
+			if (*err == tests[which].expected_errcode) {
 				pr_cont("PASS\n");
 				/* Verifier rejected filter as expected. */
 				*err = 0;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/Makefile linux-libre-4.4.134-gnu/Makefile
--- linux-libre-4.4.133-gnu/Makefile	2018-05-26 03:28:24.000000000 -0400
+++ linux-libre-4.4.134-gnu/Makefile	2018-05-30 02:45:26.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 133
+SUBLEVEL = 134
 EXTRAVERSION = -gnu
 NAME = Blurry Fish Butt
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/mm/kasan/kasan.c linux-libre-4.4.134-gnu/mm/kasan/kasan.c
--- linux-libre-4.4.133-gnu/mm/kasan/kasan.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/mm/kasan/kasan.c	2018-05-30 01:49:18.000000000 -0400
@@ -548,5 +548,5 @@ static int __init kasan_memhotplug_init(
 	return 0;
 }
 
-module_init(kasan_memhotplug_init);
+core_initcall(kasan_memhotplug_init);
 #endif
diff -druNp --no-dereference linux-libre-4.4.133-gnu/mm/kmemleak.c linux-libre-4.4.134-gnu/mm/kmemleak.c
--- linux-libre-4.4.133-gnu/mm/kmemleak.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/mm/kmemleak.c	2018-05-30 01:49:18.000000000 -0400
@@ -1524,8 +1524,7 @@ static void start_scan_thread(void)
 }
 
 /*
- * Stop the automatic memory scanning thread. This function must be called
- * with the scan_mutex held.
+ * Stop the automatic memory scanning thread.
  */
 static void stop_scan_thread(void)
 {
@@ -1788,12 +1787,15 @@ static void kmemleak_do_cleanup(struct w
 {
 	stop_scan_thread();
 
+	mutex_lock(&scan_mutex);
 	/*
-	 * Once the scan thread has stopped, it is safe to no longer track
-	 * object freeing. Ordering of the scan thread stopping and the memory
-	 * accesses below is guaranteed by the kthread_stop() function.
+	 * Once it is made sure that kmemleak_scan has stopped, it is safe to no
+	 * longer track object freeing. Ordering of the scan thread stopping and
+	 * the memory accesses below is guaranteed by the kthread_stop()
+	 * function.
 	 */
 	kmemleak_free_enabled = 0;
+	mutex_unlock(&scan_mutex);
 
 	if (!kmemleak_found_leaks)
 		__kmemleak_do_cleanup();
diff -druNp --no-dereference linux-libre-4.4.133-gnu/mm/ksm.c linux-libre-4.4.134-gnu/mm/ksm.c
--- linux-libre-4.4.133-gnu/mm/ksm.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/mm/ksm.c	2018-05-30 01:49:18.000000000 -0400
@@ -1494,8 +1494,22 @@ static void cmp_and_merge_page(struct pa
 	tree_rmap_item =
 		unstable_tree_search_insert(rmap_item, page, &tree_page);
 	if (tree_rmap_item) {
+		bool split;
+
 		kpage = try_to_merge_two_pages(rmap_item, page,
 						tree_rmap_item, tree_page);
+		/*
+		 * If both pages we tried to merge belong to the same compound
+		 * page, then we actually ended up increasing the reference
+		 * count of the same compound page twice, and split_huge_page
+		 * failed.
+		 * Here we set a flag if that happened, and we use it later to
+		 * try split_huge_page again. Since we call put_page right
+		 * afterwards, the reference count will be correct and
+		 * split_huge_page should succeed.
+		 */
+		split = PageTransCompound(page)
+			&& compound_head(page) == compound_head(tree_page);
 		put_page(tree_page);
 		if (kpage) {
 			/*
@@ -1520,6 +1534,20 @@ static void cmp_and_merge_page(struct pa
 				break_cow(tree_rmap_item);
 				break_cow(rmap_item);
 			}
+		} else if (split) {
+			/*
+			 * We are here if we tried to merge two pages and
+			 * failed because they both belonged to the same
+			 * compound page. We will split the page now, but no
+			 * merging will take place.
+			 * We do not want to add the cost of a full lock; if
+			 * the page is locked, it is better to skip it and
+			 * perhaps try again later.
+			 */
+			if (!trylock_page(page))
+				return;
+			split_huge_page(page);
+			unlock_page(page);
 		}
 	}
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/mm/mempolicy.c linux-libre-4.4.134-gnu/mm/mempolicy.c
--- linux-libre-4.4.133-gnu/mm/mempolicy.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/mm/mempolicy.c	2018-05-30 01:49:18.000000000 -0400
@@ -1232,6 +1232,7 @@ static int get_nodes(nodemask_t *nodes,
 		     unsigned long maxnode)
 {
 	unsigned long k;
+	unsigned long t;
 	unsigned long nlongs;
 	unsigned long endmask;
 
@@ -1248,13 +1249,19 @@ static int get_nodes(nodemask_t *nodes,
 	else
 		endmask = (1UL << (maxnode % BITS_PER_LONG)) - 1;
 
-	/* When the user specified more nodes than supported just check
-	   if the non supported part is all zero. */
+	/*
+	 * When the user specified more nodes than supported just check
+	 * if the non supported part is all zero.
+	 *
+	 * If maxnode have more longs than MAX_NUMNODES, check
+	 * the bits in that area first. And then go through to
+	 * check the rest bits which equal or bigger than MAX_NUMNODES.
+	 * Otherwise, just check bits [MAX_NUMNODES, maxnode).
+	 */
 	if (nlongs > BITS_TO_LONGS(MAX_NUMNODES)) {
 		if (nlongs > PAGE_SIZE/sizeof(long))
 			return -EINVAL;
 		for (k = BITS_TO_LONGS(MAX_NUMNODES); k < nlongs; k++) {
-			unsigned long t;
 			if (get_user(t, nmask + k))
 				return -EFAULT;
 			if (k == nlongs - 1) {
@@ -1267,6 +1274,16 @@ static int get_nodes(nodemask_t *nodes,
 		endmask = ~0UL;
 	}
 
+	if (maxnode > MAX_NUMNODES && MAX_NUMNODES % BITS_PER_LONG != 0) {
+		unsigned long valid_mask = endmask;
+
+		valid_mask &= ~((1UL << (MAX_NUMNODES % BITS_PER_LONG)) - 1);
+		if (get_user(t, nmask + nlongs - 1))
+			return -EFAULT;
+		if (t & valid_mask)
+			return -EINVAL;
+	}
+
 	if (copy_from_user(nodes_addr(*nodes), nmask, nlongs*sizeof(unsigned long)))
 		return -EFAULT;
 	nodes_addr(*nodes)[nlongs-1] &= endmask;
@@ -1393,10 +1410,14 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pi
 		goto out_put;
 	}
 
-	if (!nodes_subset(*new, node_states[N_MEMORY])) {
-		err = -EINVAL;
+	task_nodes = cpuset_mems_allowed(current);
+	nodes_and(*new, *new, task_nodes);
+	if (nodes_empty(*new))
+		goto out_put;
+
+	nodes_and(*new, *new, node_states[N_MEMORY]);
+	if (nodes_empty(*new))
 		goto out_put;
-	}
 
 	err = security_task_movememory(task);
 	if (err)
@@ -2121,6 +2142,9 @@ bool __mpol_equal(struct mempolicy *a, s
 	case MPOL_INTERLEAVE:
 		return !!nodes_equal(a->v.nodes, b->v.nodes);
 	case MPOL_PREFERRED:
+		/* a's ->flags is the same as b's */
+		if (a->flags & MPOL_F_LOCAL)
+			return true;
 		return a->v.preferred_node == b->v.preferred_node;
 	default:
 		BUG();
diff -druNp --no-dereference linux-libre-4.4.133-gnu/mm/swapfile.c linux-libre-4.4.134-gnu/mm/swapfile.c
--- linux-libre-4.4.133-gnu/mm/swapfile.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/mm/swapfile.c	2018-05-30 01:49:18.000000000 -0400
@@ -2258,6 +2258,10 @@ static unsigned long read_swap_header(st
 	maxpages = swp_offset(pte_to_swp_entry(
 			swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1;
 	last_page = swap_header->info.last_page;
+	if (!last_page) {
+		pr_warn("Empty swap-file\n");
+		return 0;
+	}
 	if (last_page > maxpages) {
 		pr_warn("Truncating oversized swap area, only using %luk out of %luk\n",
 			maxpages << (PAGE_SHIFT - 10),
diff -druNp --no-dereference linux-libre-4.4.133-gnu/mm/vmscan.c linux-libre-4.4.134-gnu/mm/vmscan.c
--- linux-libre-4.4.133-gnu/mm/vmscan.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/mm/vmscan.c	2018-05-30 01:49:18.000000000 -0400
@@ -1312,6 +1312,7 @@ int __isolate_lru_page(struct page *page
 
 		if (PageDirty(page)) {
 			struct address_space *mapping;
+			bool migrate_dirty;
 
 			/* ISOLATE_CLEAN means only clean pages */
 			if (mode & ISOLATE_CLEAN)
@@ -1320,10 +1321,19 @@ int __isolate_lru_page(struct page *page
 			/*
 			 * Only pages without mappings or that have a
 			 * ->migratepage callback are possible to migrate
-			 * without blocking
+			 * without blocking. However, we can be racing with
+			 * truncation so it's necessary to lock the page
+			 * to stabilise the mapping as truncation holds
+			 * the page lock until after the page is removed
+			 * from the page cache.
 			 */
+			if (!trylock_page(page))
+				return ret;
+
 			mapping = page_mapping(page);
-			if (mapping && !mapping->a_ops->migratepage)
+			migrate_dirty = mapping && mapping->a_ops->migratepage;
+			unlock_page(page);
+			if (!migrate_dirty)
 				return ret;
 		}
 	}
@@ -3831,7 +3841,13 @@ int zone_reclaim(struct zone *zone, gfp_
  */
 int page_evictable(struct page *page)
 {
-	return !mapping_unevictable(page_mapping(page)) && !PageMlocked(page);
+	int ret;
+
+	/* Prevent address_space of inode and swap cache from being freed */
+	rcu_read_lock();
+	ret = !mapping_unevictable(page_mapping(page)) && !PageMlocked(page);
+	rcu_read_unlock();
+	return ret;
 }
 
 #ifdef CONFIG_SHMEM
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/batman-adv/distributed-arp-table.c linux-libre-4.4.134-gnu/net/batman-adv/distributed-arp-table.c
--- linux-libre-4.4.133-gnu/net/batman-adv/distributed-arp-table.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/batman-adv/distributed-arp-table.c	2018-05-30 01:49:18.000000000 -0400
@@ -374,7 +374,7 @@ static void batadv_dbg_arp(struct batadv
 		   batadv_arp_hw_src(skb, hdr_size), &ip_src,
 		   batadv_arp_hw_dst(skb, hdr_size), &ip_dst);
 
-	if (hdr_size == 0)
+	if (hdr_size < sizeof(struct batadv_unicast_packet))
 		return;
 
 	unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/batman-adv/fragmentation.c linux-libre-4.4.134-gnu/net/batman-adv/fragmentation.c
--- linux-libre-4.4.133-gnu/net/batman-adv/fragmentation.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/batman-adv/fragmentation.c	2018-05-30 01:49:18.000000000 -0400
@@ -278,7 +278,8 @@ batadv_frag_merge_packets(struct hlist_h
 	/* Move the existing MAC header to just before the payload. (Override
 	 * the fragment header.)
 	 */
-	skb_pull_rcsum(skb_out, hdr_size);
+	skb_pull(skb_out, hdr_size);
+	skb_out->ip_summed = CHECKSUM_NONE;
 	memmove(skb_out->data - ETH_HLEN, skb_mac_header(skb_out), ETH_HLEN);
 	skb_set_mac_header(skb_out, -ETH_HLEN);
 	skb_reset_network_header(skb_out);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/batman-adv/gateway_client.c linux-libre-4.4.134-gnu/net/batman-adv/gateway_client.c
--- linux-libre-4.4.133-gnu/net/batman-adv/gateway_client.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/batman-adv/gateway_client.c	2018-05-30 01:49:18.000000000 -0400
@@ -798,6 +798,9 @@ bool batadv_gw_out_of_range(struct batad
 
 	vid = batadv_get_vid(skb, 0);
 
+	if (is_multicast_ether_addr(ethhdr->h_dest))
+		goto out;
+
 	orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source,
 						 ethhdr->h_dest, vid);
 	if (!orig_dst_node)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/batman-adv/multicast.c linux-libre-4.4.134-gnu/net/batman-adv/multicast.c
--- linux-libre-4.4.133-gnu/net/batman-adv/multicast.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/batman-adv/multicast.c	2018-05-30 01:49:18.000000000 -0400
@@ -428,8 +428,8 @@ static struct batadv_orig_node *
 batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv,
 			      struct ethhdr *ethhdr)
 {
-	return batadv_transtable_search(bat_priv, ethhdr->h_source,
-					ethhdr->h_dest, BATADV_NO_FLAGS);
+	return batadv_transtable_search(bat_priv, NULL, ethhdr->h_dest,
+					BATADV_NO_FLAGS);
 }
 
 /**
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/batman-adv/soft-interface.c linux-libre-4.4.134-gnu/net/batman-adv/soft-interface.c
--- linux-libre-4.4.133-gnu/net/batman-adv/soft-interface.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/batman-adv/soft-interface.c	2018-05-30 01:49:18.000000000 -0400
@@ -430,13 +430,7 @@ void batadv_interface_rx(struct net_devi
 
 	/* skb->dev & skb->pkt_type are set here */
 	skb->protocol = eth_type_trans(skb, soft_iface);
-
-	/* should not be necessary anymore as we use skb_pull_rcsum()
-	 * TODO: please verify this and remove this TODO
-	 * -- Dec 21st 2009, Simon Wunderlich
-	 */
-
-	/* skb->ip_summed = CHECKSUM_UNNECESSARY; */
+	skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
 
 	batadv_inc_counter(bat_priv, BATADV_CNT_RX);
 	batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/bridge/netfilter/ebtables.c linux-libre-4.4.134-gnu/net/bridge/netfilter/ebtables.c
--- linux-libre-4.4.133-gnu/net/bridge/netfilter/ebtables.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/bridge/netfilter/ebtables.c	2018-05-30 01:49:18.000000000 -0400
@@ -1614,7 +1614,8 @@ static int compat_match_to_user(struct e
 	int off = ebt_compat_match_offset(match, m->match_size);
 	compat_uint_t msize = m->match_size - off;
 
-	BUG_ON(off >= m->match_size);
+	if (WARN_ON(off >= m->match_size))
+		return -EINVAL;
 
 	if (copy_to_user(cm->u.name, match->name,
 	    strlen(match->name) + 1) || put_user(msize, &cm->match_size))
@@ -1641,7 +1642,8 @@ static int compat_target_to_user(struct
 	int off = xt_compat_target_offset(target);
 	compat_uint_t tsize = t->target_size - off;
 
-	BUG_ON(off >= t->target_size);
+	if (WARN_ON(off >= t->target_size))
+		return -EINVAL;
 
 	if (copy_to_user(cm->u.name, target->name,
 	    strlen(target->name) + 1) || put_user(tsize, &cm->match_size))
@@ -1869,7 +1871,8 @@ static int ebt_buf_add(struct ebt_entrie
 	if (state->buf_kern_start == NULL)
 		goto count_only;
 
-	BUG_ON(state->buf_kern_offset + sz > state->buf_kern_len);
+	if (WARN_ON(state->buf_kern_offset + sz > state->buf_kern_len))
+		return -EINVAL;
 
 	memcpy(state->buf_kern_start + state->buf_kern_offset, data, sz);
 
@@ -1882,7 +1885,8 @@ static int ebt_buf_add_pad(struct ebt_en
 {
 	char *b = state->buf_kern_start;
 
-	BUG_ON(b && state->buf_kern_offset > state->buf_kern_len);
+	if (WARN_ON(b && state->buf_kern_offset > state->buf_kern_len))
+		return -EINVAL;
 
 	if (b != NULL && sz > 0)
 		memset(b + state->buf_kern_offset, 0, sz);
@@ -1959,8 +1963,10 @@ static int compat_mtw_from_user(struct c
 	pad = XT_ALIGN(size_kern) - size_kern;
 
 	if (pad > 0 && dst) {
-		BUG_ON(state->buf_kern_len <= pad);
-		BUG_ON(state->buf_kern_offset - (match_size + off) + size_kern > state->buf_kern_len - pad);
+		if (WARN_ON(state->buf_kern_len <= pad))
+			return -EINVAL;
+		if (WARN_ON(state->buf_kern_offset - (match_size + off) + size_kern > state->buf_kern_len - pad))
+			return -EINVAL;
 		memset(dst + size_kern, 0, pad);
 	}
 	return off + match_size;
@@ -2011,7 +2017,8 @@ static int ebt_size_mwt(struct compat_eb
 		if (ret < 0)
 			return ret;
 
-		BUG_ON(ret < match32->match_size);
+		if (WARN_ON(ret < match32->match_size))
+			return -EINVAL;
 		growth += ret - match32->match_size;
 		growth += ebt_compat_entry_padsize();
 
@@ -2081,8 +2088,12 @@ static int size_entry_mwt(struct ebt_ent
 	 * offsets are relative to beginning of struct ebt_entry (i.e., 0).
 	 */
 	for (i = 0; i < 4 ; ++i) {
-		if (offsets[i] >= *total)
+		if (offsets[i] > *total)
+			return -EINVAL;
+
+		if (i < 3 && offsets[i] == *total)
 			return -EINVAL;
+
 		if (i == 0)
 			continue;
 		if (offsets[i-1] > offsets[i])
@@ -2121,7 +2132,8 @@ static int size_entry_mwt(struct ebt_ent
 
 	startoff = state->buf_user_offset - startoff;
 
-	BUG_ON(*total < startoff);
+	if (WARN_ON(*total < startoff))
+		return -EINVAL;
 	*total -= startoff;
 	return 0;
 }
@@ -2249,7 +2261,8 @@ static int compat_do_replace(struct net
 	state.buf_kern_len = size64;
 
 	ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state);
-	BUG_ON(ret < 0);	/* parses same data again */
+	if (WARN_ON(ret < 0))
+		goto out_unlock;
 
 	vfree(entries_tmp);
 	tmp.entries_size = size64;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/core/skbuff.c linux-libre-4.4.134-gnu/net/core/skbuff.c
--- linux-libre-4.4.133-gnu/net/core/skbuff.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/core/skbuff.c	2018-05-30 01:49:18.000000000 -0400
@@ -4295,13 +4295,18 @@ EXPORT_SYMBOL_GPL(skb_gso_transport_segl
 
 static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
 {
+	int mac_len;
+
 	if (skb_cow(skb, skb_headroom(skb)) < 0) {
 		kfree_skb(skb);
 		return NULL;
 	}
 
-	memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len - VLAN_HLEN,
-		2 * ETH_ALEN);
+	mac_len = skb->data - skb_mac_header(skb);
+	if (likely(mac_len > VLAN_HLEN + ETH_TLEN)) {
+		memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb),
+			mac_len - VLAN_HLEN - ETH_TLEN);
+	}
 	skb->mac_header += VLAN_HLEN;
 	return skb;
 }
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/ipv4/ip_vti.c linux-libre-4.4.134-gnu/net/ipv4/ip_vti.c
--- linux-libre-4.4.133-gnu/net/ipv4/ip_vti.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/ipv4/ip_vti.c	2018-05-30 01:49:18.000000000 -0400
@@ -366,8 +366,6 @@ static int vti_tunnel_init(struct net_de
 	memcpy(dev->dev_addr, &iph->saddr, 4);
 	memcpy(dev->broadcast, &iph->daddr, 4);
 
-	dev->hard_header_len	= LL_MAX_HEADER + sizeof(struct iphdr);
-	dev->mtu		= ETH_DATA_LEN;
 	dev->flags		= IFF_NOARP;
 	dev->addr_len		= 4;
 	dev->features		|= NETIF_F_LLTX;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/ipv4/route.c linux-libre-4.4.134-gnu/net/ipv4/route.c
--- linux-libre-4.4.133-gnu/net/ipv4/route.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/ipv4/route.c	2018-05-30 01:49:18.000000000 -0400
@@ -612,6 +612,7 @@ static inline u32 fnhe_hashfun(__be32 da
 static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe)
 {
 	rt->rt_pmtu = fnhe->fnhe_pmtu;
+	rt->rt_mtu_locked = fnhe->fnhe_mtu_locked;
 	rt->dst.expires = fnhe->fnhe_expires;
 
 	if (fnhe->fnhe_gw) {
@@ -622,7 +623,7 @@ static void fill_route_from_fnhe(struct
 }
 
 static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
-				  u32 pmtu, unsigned long expires)
+				  u32 pmtu, bool lock, unsigned long expires)
 {
 	struct fnhe_hash_bucket *hash;
 	struct fib_nh_exception *fnhe;
@@ -659,8 +660,10 @@ static void update_or_create_fnhe(struct
 			fnhe->fnhe_genid = genid;
 		if (gw)
 			fnhe->fnhe_gw = gw;
-		if (pmtu)
+		if (pmtu) {
 			fnhe->fnhe_pmtu = pmtu;
+			fnhe->fnhe_mtu_locked = lock;
+		}
 		fnhe->fnhe_expires = max(1UL, expires);
 		/* Update all cached dsts too */
 		rt = rcu_dereference(fnhe->fnhe_rth_input);
@@ -684,6 +687,7 @@ static void update_or_create_fnhe(struct
 		fnhe->fnhe_daddr = daddr;
 		fnhe->fnhe_gw = gw;
 		fnhe->fnhe_pmtu = pmtu;
+		fnhe->fnhe_mtu_locked = lock;
 		fnhe->fnhe_expires = expires;
 
 		/* Exception created; mark the cached routes for the nexthop
@@ -765,7 +769,8 @@ static void __ip_do_redirect(struct rtab
 				struct fib_nh *nh = &FIB_RES_NH(res);
 
 				update_or_create_fnhe(nh, fl4->daddr, new_gw,
-						0, jiffies + ip_rt_gc_timeout);
+						0, false,
+						jiffies + ip_rt_gc_timeout);
 			}
 			if (kill_route)
 				rt->dst.obsolete = DST_OBSOLETE_KILL;
@@ -977,15 +982,18 @@ static void __ip_rt_update_pmtu(struct r
 {
 	struct dst_entry *dst = &rt->dst;
 	struct fib_result res;
+	bool lock = false;
 
-	if (dst_metric_locked(dst, RTAX_MTU))
+	if (ip_mtu_locked(dst))
 		return;
 
 	if (ipv4_mtu(dst) < mtu)
 		return;
 
-	if (mtu < ip_rt_min_pmtu)
+	if (mtu < ip_rt_min_pmtu) {
+		lock = true;
 		mtu = ip_rt_min_pmtu;
+	}
 
 	if (rt->rt_pmtu == mtu &&
 	    time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2))
@@ -995,7 +1003,7 @@ static void __ip_rt_update_pmtu(struct r
 	if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) {
 		struct fib_nh *nh = &FIB_RES_NH(res);
 
-		update_or_create_fnhe(nh, fl4->daddr, 0, mtu,
+		update_or_create_fnhe(nh, fl4->daddr, 0, mtu, lock,
 				      jiffies + ip_rt_mtu_expires);
 	}
 	rcu_read_unlock();
@@ -1250,7 +1258,7 @@ static unsigned int ipv4_mtu(const struc
 
 	mtu = READ_ONCE(dst->dev->mtu);
 
-	if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
+	if (unlikely(ip_mtu_locked(dst))) {
 		if (rt->rt_uses_gateway && mtu > 576)
 			mtu = 576;
 	}
@@ -1473,6 +1481,7 @@ static struct rtable *rt_dst_alloc(struc
 		rt->rt_is_input = 0;
 		rt->rt_iif = 0;
 		rt->rt_pmtu = 0;
+		rt->rt_mtu_locked = 0;
 		rt->rt_gateway = 0;
 		rt->rt_uses_gateway = 0;
 		rt->rt_table_id = 0;
@@ -2393,6 +2402,7 @@ struct dst_entry *ipv4_blackhole_route(s
 		rt->rt_is_input = ort->rt_is_input;
 		rt->rt_iif = ort->rt_iif;
 		rt->rt_pmtu = ort->rt_pmtu;
+		rt->rt_mtu_locked = ort->rt_mtu_locked;
 
 		rt->rt_genid = rt_genid_ipv4(net);
 		rt->rt_flags = ort->rt_flags;
@@ -2495,6 +2505,8 @@ static int rt_fill_info(struct net *net,
 	memcpy(metrics, dst_metrics_ptr(&rt->dst), sizeof(metrics));
 	if (rt->rt_pmtu && expires)
 		metrics[RTAX_MTU - 1] = rt->rt_pmtu;
+	if (rt->rt_mtu_locked && expires)
+		metrics[RTAX_LOCK - 1] |= BIT(RTAX_MTU);
 	if (rtnetlink_put_metrics(skb, metrics) < 0)
 		goto nla_put_failure;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/ipv4/tcp_illinois.c linux-libre-4.4.134-gnu/net/ipv4/tcp_illinois.c
--- linux-libre-4.4.133-gnu/net/ipv4/tcp_illinois.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/ipv4/tcp_illinois.c	2018-05-30 01:49:18.000000000 -0400
@@ -6,7 +6,7 @@
  * The algorithm is described in:
  * "TCP-Illinois: A Loss and Delay-Based Congestion Control Algorithm
  *  for High-Speed Networks"
- * http://www.ifp.illinois.edu/~srikant/Papers/liubassri06perf.pdf
+ * http://tamerbasar.csl.illinois.edu/LiuBasarSrikantPerfEvalArtJun2008.pdf
  *
  * Implemented from description in paper and ns-2 simulation.
  * Copyright (C) 2007 Stephen Hemminger <shemminger@linux-foundation.org>
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/ipv4/xfrm4_policy.c linux-libre-4.4.134-gnu/net/ipv4/xfrm4_policy.c
--- linux-libre-4.4.133-gnu/net/ipv4/xfrm4_policy.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/ipv4/xfrm4_policy.c	2018-05-30 01:49:18.000000000 -0400
@@ -97,6 +97,7 @@ static int xfrm4_fill_dst(struct xfrm_ds
 	xdst->u.rt.rt_gateway = rt->rt_gateway;
 	xdst->u.rt.rt_uses_gateway = rt->rt_uses_gateway;
 	xdst->u.rt.rt_pmtu = rt->rt_pmtu;
+	xdst->u.rt.rt_mtu_locked = rt->rt_mtu_locked;
 	xdst->u.rt.rt_table_id = rt->rt_table_id;
 	INIT_LIST_HEAD(&xdst->u.rt.rt_uncached);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/ipv6/sit.c linux-libre-4.4.134-gnu/net/ipv6/sit.c
--- linux-libre-4.4.133-gnu/net/ipv6/sit.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/ipv6/sit.c	2018-05-30 01:49:18.000000000 -0400
@@ -1574,6 +1574,13 @@ static int ipip6_newlink(struct net *src
 	if (err < 0)
 		return err;
 
+	if (tb[IFLA_MTU]) {
+		u32 mtu = nla_get_u32(tb[IFLA_MTU]);
+
+		if (mtu >= IPV6_MIN_MTU && mtu <= 0xFFF8 - dev->hard_header_len)
+			dev->mtu = mtu;
+	}
+
 #ifdef CONFIG_IPV6_SIT_6RD
 	if (ipip6_netlink_6rd_parms(data, &ip6rd))
 		err = ipip6_tunnel_update_6rd(nt, &ip6rd);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/llc/llc_c_ac.c linux-libre-4.4.134-gnu/net/llc/llc_c_ac.c
--- linux-libre-4.4.133-gnu/net/llc/llc_c_ac.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/llc/llc_c_ac.c	2018-05-30 01:49:18.000000000 -0400
@@ -389,7 +389,7 @@ static int llc_conn_ac_send_i_cmd_p_set_
 	llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR);
 	rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
 	if (likely(!rc)) {
-		llc_conn_send_pdu(sk, skb);
+		rc = llc_conn_send_pdu(sk, skb);
 		llc_conn_ac_inc_vs_by_1(sk, skb);
 	}
 	return rc;
@@ -916,7 +916,7 @@ static int llc_conn_ac_send_i_rsp_f_set_
 	llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR);
 	rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
 	if (likely(!rc)) {
-		llc_conn_send_pdu(sk, skb);
+		rc = llc_conn_send_pdu(sk, skb);
 		llc_conn_ac_inc_vs_by_1(sk, skb);
 	}
 	return rc;
@@ -935,14 +935,17 @@ static int llc_conn_ac_send_i_rsp_f_set_
 int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb)
 {
 	struct llc_sock *llc = llc_sk(sk);
+	int ret;
 
 	if (llc->ack_must_be_send) {
-		llc_conn_ac_send_i_rsp_f_set_ackpf(sk, skb);
+		ret = llc_conn_ac_send_i_rsp_f_set_ackpf(sk, skb);
 		llc->ack_must_be_send = 0 ;
 		llc->ack_pf = 0;
-	} else
-		llc_conn_ac_send_i_cmd_p_set_0(sk, skb);
-	return 0;
+	} else {
+		ret = llc_conn_ac_send_i_cmd_p_set_0(sk, skb);
+	}
+
+	return ret;
 }
 
 /**
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/llc/llc_conn.c linux-libre-4.4.134-gnu/net/llc/llc_conn.c
--- linux-libre-4.4.133-gnu/net/llc/llc_conn.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/llc/llc_conn.c	2018-05-30 01:49:18.000000000 -0400
@@ -30,7 +30,7 @@
 #endif
 
 static int llc_find_offset(int state, int ev_type);
-static void llc_conn_send_pdus(struct sock *sk);
+static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *skb);
 static int llc_conn_service(struct sock *sk, struct sk_buff *skb);
 static int llc_exec_conn_trans_actions(struct sock *sk,
 				       struct llc_conn_state_trans *trans,
@@ -193,11 +193,11 @@ out_skb_put:
 	return rc;
 }
 
-void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
+int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
 {
 	/* queue PDU to send to MAC layer */
 	skb_queue_tail(&sk->sk_write_queue, skb);
-	llc_conn_send_pdus(sk);
+	return llc_conn_send_pdus(sk, skb);
 }
 
 /**
@@ -255,7 +255,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct
 	if (howmany_resend > 0)
 		llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO;
 	/* any PDUs to re-send are queued up; start sending to MAC */
-	llc_conn_send_pdus(sk);
+	llc_conn_send_pdus(sk, NULL);
 out:;
 }
 
@@ -296,7 +296,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct
 	if (howmany_resend > 0)
 		llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO;
 	/* any PDUs to re-send are queued up; start sending to MAC */
-	llc_conn_send_pdus(sk);
+	llc_conn_send_pdus(sk, NULL);
 out:;
 }
 
@@ -340,12 +340,16 @@ out:
 /**
  *	llc_conn_send_pdus - Sends queued PDUs
  *	@sk: active connection
+ *	@hold_skb: the skb held by caller, or NULL if does not care
  *
- *	Sends queued pdus to MAC layer for transmission.
+ *	Sends queued pdus to MAC layer for transmission. When @hold_skb is
+ *	NULL, always return 0. Otherwise, return 0 if @hold_skb is sent
+ *	successfully, or 1 for failure.
  */
-static void llc_conn_send_pdus(struct sock *sk)
+static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb)
 {
 	struct sk_buff *skb;
+	int ret = 0;
 
 	while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) {
 		struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
@@ -357,10 +361,20 @@ static void llc_conn_send_pdus(struct so
 			skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb);
 			if (!skb2)
 				break;
-			skb = skb2;
+			dev_queue_xmit(skb2);
+		} else {
+			bool is_target = skb == hold_skb;
+			int rc;
+
+			if (is_target)
+				skb_get(skb);
+			rc = dev_queue_xmit(skb);
+			if (is_target)
+				ret = rc;
 		}
-		dev_queue_xmit(skb);
 	}
+
+	return ret;
 }
 
 /**
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/netlabel/netlabel_unlabeled.c linux-libre-4.4.134-gnu/net/netlabel/netlabel_unlabeled.c
--- linux-libre-4.4.133-gnu/net/netlabel/netlabel_unlabeled.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/netlabel/netlabel_unlabeled.c	2018-05-30 01:49:18.000000000 -0400
@@ -1469,6 +1469,16 @@ int netlbl_unlabel_getattr(const struct
 		iface = rcu_dereference(netlbl_unlhsh_def);
 	if (iface == NULL || !iface->valid)
 		goto unlabel_getattr_nolabel;
+
+#if IS_ENABLED(CONFIG_IPV6)
+	/* When resolving a fallback label, check the sk_buff version as
+	 * it is possible (e.g. SCTP) to have family = PF_INET6 while
+	 * receiving ip_hdr(skb)->version = 4.
+	 */
+	if (family == PF_INET6 && ip_hdr(skb)->version == 4)
+		family = PF_INET;
+#endif /* IPv6 */
+
 	switch (family) {
 	case PF_INET: {
 		struct iphdr *hdr4;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/nfc/llcp_commands.c linux-libre-4.4.134-gnu/net/nfc/llcp_commands.c
--- linux-libre-4.4.133-gnu/net/nfc/llcp_commands.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/nfc/llcp_commands.c	2018-05-30 01:49:18.000000000 -0400
@@ -149,6 +149,10 @@ struct nfc_llcp_sdp_tlv *nfc_llcp_build_
 
 	pr_debug("uri: %s, len: %zu\n", uri, uri_len);
 
+	/* sdreq->tlv_len is u8, takes uri_len, + 3 for header, + 1 for NULL */
+	if (WARN_ON_ONCE(uri_len > U8_MAX - 4))
+		return NULL;
+
 	sdreq = kzalloc(sizeof(struct nfc_llcp_sdp_tlv), GFP_KERNEL);
 	if (sdreq == NULL)
 		return NULL;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/nfc/netlink.c linux-libre-4.4.134-gnu/net/nfc/netlink.c
--- linux-libre-4.4.133-gnu/net/nfc/netlink.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/nfc/netlink.c	2018-05-30 01:49:18.000000000 -0400
@@ -68,7 +68,8 @@ static const struct nla_policy nfc_genl_
 };
 
 static const struct nla_policy nfc_sdp_genl_policy[NFC_SDP_ATTR_MAX + 1] = {
-	[NFC_SDP_ATTR_URI] = { .type = NLA_STRING },
+	[NFC_SDP_ATTR_URI] = { .type = NLA_STRING,
+			       .len = U8_MAX - 4 },
 	[NFC_SDP_ATTR_SAP] = { .type = NLA_U8 },
 };
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/net/rds/ib.c linux-libre-4.4.134-gnu/net/rds/ib.c
--- linux-libre-4.4.133-gnu/net/rds/ib.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/net/rds/ib.c	2018-05-30 01:49:18.000000000 -0400
@@ -336,7 +336,8 @@ static int rds_ib_laddr_check(struct net
 	/* Create a CMA ID and try to bind it. This catches both
 	 * IB and iWARP capable NICs.
 	 */
-	cm_id = rdma_create_id(&init_net, NULL, NULL, RDMA_PS_TCP, IB_QPT_RC);
+	cm_id = rdma_create_id(&init_net, rds_rdma_cm_event_handler,
+			       NULL, RDMA_PS_TCP, IB_QPT_RC);
 	if (IS_ERR(cm_id))
 		return PTR_ERR(cm_id);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/scripts/kconfig/expr.c linux-libre-4.4.134-gnu/scripts/kconfig/expr.c
--- linux-libre-4.4.133-gnu/scripts/kconfig/expr.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/scripts/kconfig/expr.c	2018-05-30 01:49:18.000000000 -0400
@@ -113,7 +113,7 @@ void expr_free(struct expr *e)
 		break;
 	case E_NOT:
 		expr_free(e->left.expr);
-		return;
+		break;
 	case E_EQUAL:
 	case E_GEQ:
 	case E_GTH:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/scripts/kconfig/menu.c linux-libre-4.4.134-gnu/scripts/kconfig/menu.c
--- linux-libre-4.4.133-gnu/scripts/kconfig/menu.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/scripts/kconfig/menu.c	2018-05-30 01:49:18.000000000 -0400
@@ -364,6 +364,7 @@ void menu_finalize(struct menu *parent)
 			menu->parent = parent;
 			last_menu = menu;
 		}
+		expr_free(basedep);
 		if (last_menu) {
 			parent->list = parent->next;
 			parent->next = last_menu->next;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/scripts/kconfig/zconf.y linux-libre-4.4.134-gnu/scripts/kconfig/zconf.y
--- linux-libre-4.4.133-gnu/scripts/kconfig/zconf.y	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/scripts/kconfig/zconf.y	2018-05-30 01:49:18.000000000 -0400
@@ -107,7 +107,27 @@ static struct menu *current_menu, *curre
 %%
 input: nl start | start;
 
-start: mainmenu_stmt stmt_list | stmt_list;
+start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list;
+
+/* mainmenu entry */
+
+mainmenu_stmt: T_MAINMENU prompt nl
+{
+	menu_add_prompt(P_MENU, $2, NULL);
+};
+
+/* Default main menu, if there's no mainmenu entry */
+
+no_mainmenu_stmt: /* empty */
+{
+	/*
+	 * Hack: Keep the main menu title on the heap so we can safely free it
+	 * later regardless of whether it comes from the 'prompt' in
+	 * mainmenu_stmt or here
+	 */
+	menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL);
+};
+
 
 stmt_list:
 	  /* empty */
@@ -344,13 +364,6 @@ if_block:
 	| if_block choice_stmt
 ;
 
-/* mainmenu entry */
-
-mainmenu_stmt: T_MAINMENU prompt nl
-{
-	menu_add_prompt(P_MENU, $2, NULL);
-};
-
 /* menu entry */
 
 menu: T_MENU prompt T_EOL
@@ -495,6 +508,7 @@ word_opt: /* empty */			{ $$ = NULL; }
 
 void conf_parse(const char *name)
 {
+	const char *tmp;
 	struct symbol *sym;
 	int i;
 
@@ -502,7 +516,6 @@ void conf_parse(const char *name)
 
 	sym_init();
 	_menu_init();
-	rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
 
 	if (getenv("ZCONF_DEBUG"))
 		zconfdebug = 1;
@@ -512,8 +525,10 @@ void conf_parse(const char *name)
 	if (!modules_sym)
 		modules_sym = sym_find( "n" );
 
+	tmp = rootmenu.prompt->text;
 	rootmenu.prompt->text = _(rootmenu.prompt->text);
 	rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
+	free((char*)tmp);
 
 	menu_finalize(&rootmenu);
 	for_all_symbols(i, sym) {
diff -druNp --no-dereference linux-libre-4.4.133-gnu/security/integrity/ima/ima_crypto.c linux-libre-4.4.134-gnu/security/integrity/ima/ima_crypto.c
--- linux-libre-4.4.133-gnu/security/integrity/ima/ima_crypto.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/security/integrity/ima/ima_crypto.c	2018-05-30 01:49:18.000000000 -0400
@@ -78,6 +78,8 @@ int __init ima_init_crypto(void)
 		       hash_algo_name[ima_hash_algo], rc);
 		return rc;
 	}
+	pr_info("Allocated hash algorithm: %s\n",
+		hash_algo_name[ima_hash_algo]);
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/security/integrity/ima/ima_main.c linux-libre-4.4.134-gnu/security/integrity/ima/ima_main.c
--- linux-libre-4.4.133-gnu/security/integrity/ima/ima_main.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/security/integrity/ima/ima_main.c	2018-05-30 01:49:18.000000000 -0400
@@ -16,6 +16,9 @@
  *	implements the IMA hooks: ima_bprm_check, ima_file_mmap,
  *	and ima_file_check.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/file.h>
 #include <linux/binfmts.h>
@@ -353,6 +356,16 @@ static int __init init_ima(void)
 
 	hash_setup(CONFIG_IMA_DEFAULT_HASH);
 	error = ima_init();
+
+	if (error && strcmp(hash_algo_name[ima_hash_algo],
+			    CONFIG_IMA_DEFAULT_HASH) != 0) {
+		pr_info("Allocating %s failed, going to use default hash algorithm %s\n",
+			hash_algo_name[ima_hash_algo], CONFIG_IMA_DEFAULT_HASH);
+		hash_setup_done = 0;
+		hash_setup(CONFIG_IMA_DEFAULT_HASH);
+		error = ima_init();
+	}
+
 	if (!error) {
 		ima_initialized = 1;
 		ima_update_policy_flag();
diff -druNp --no-dereference linux-libre-4.4.133-gnu/security/integrity/ima/Kconfig linux-libre-4.4.134-gnu/security/integrity/ima/Kconfig
--- linux-libre-4.4.133-gnu/security/integrity/ima/Kconfig	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/security/integrity/ima/Kconfig	2018-05-30 01:49:18.000000000 -0400
@@ -10,6 +10,7 @@ config IMA
 	select CRYPTO_HASH_INFO
 	select TCG_TPM if HAS_IOMEM && !UML
 	select TCG_TIS if TCG_TPM && X86
+	select TCG_CRB if TCG_TPM && ACPI
 	select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES
 	help
 	  The Trusted Computing Group(TCG) runtime Integrity
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/core/timer.c linux-libre-4.4.134-gnu/sound/core/timer.c
--- linux-libre-4.4.133-gnu/sound/core/timer.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/core/timer.c	2018-05-30 01:49:18.000000000 -0400
@@ -548,7 +548,7 @@ static int snd_timer_stop1(struct snd_ti
 	}
 	timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START);
 	snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
-			  SNDRV_TIMER_EVENT_CONTINUE);
+			  SNDRV_TIMER_EVENT_PAUSE);
  unlock:
 	spin_unlock_irqrestore(&timer->lock, flags);
 	return result;
@@ -570,7 +570,7 @@ static int snd_timer_stop_slave(struct s
 		list_del_init(&timeri->ack_list);
 		list_del_init(&timeri->active_list);
 		snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
-				  SNDRV_TIMER_EVENT_CONTINUE);
+				  SNDRV_TIMER_EVENT_PAUSE);
 		spin_unlock(&timeri->timer->lock);
 	}
 	spin_unlock_irqrestore(&slave_active_lock, flags);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/core/vmaster.c linux-libre-4.4.134-gnu/sound/core/vmaster.c
--- linux-libre-4.4.133-gnu/sound/core/vmaster.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/core/vmaster.c	2018-05-30 01:49:18.000000000 -0400
@@ -68,10 +68,13 @@ static int slave_update(struct link_slav
 		return -ENOMEM;
 	uctl->id = slave->slave.id;
 	err = slave->slave.get(&slave->slave, uctl);
+	if (err < 0)
+		goto error;
 	for (ch = 0; ch < slave->info.count; ch++)
 		slave->vals[ch] = uctl->value.integer.value[ch];
+ error:
 	kfree(uctl);
-	return 0;
+	return err < 0 ? err : 0;
 }
 
 /* get the slave ctl info and save the initial values */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/pci/hda/Kconfig linux-libre-4.4.134-gnu/sound/pci/hda/Kconfig
--- linux-libre-4.4.133-gnu/sound/pci/hda/Kconfig	2018-05-26 03:50:11.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/pci/hda/Kconfig	2018-05-30 03:05:36.000000000 -0400
@@ -84,7 +84,6 @@ config SND_HDA_PATCH_LOADER
 config SND_HDA_CODEC_REALTEK
 	tristate "Build Realtek HD-audio codec support"
 	select SND_HDA_GENERIC
-	select INPUT
 	help
 	  Say Y or M here to include Realtek HD-audio codec support in
 	  snd-hda-intel driver, such as ALC880.
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/pci/hda/patch_realtek.c linux-libre-4.4.134-gnu/sound/pci/hda/patch_realtek.c
--- linux-libre-4.4.133-gnu/sound/pci/hda/patch_realtek.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/pci/hda/patch_realtek.c	2018-05-30 01:49:18.000000000 -0400
@@ -3495,6 +3495,7 @@ static void alc280_fixup_hp_gpio4(struct
 	}
 }
 
+#if IS_REACHABLE(INPUT)
 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
 				   struct hda_jack_callback *event)
 {
@@ -3627,6 +3628,10 @@ static void alc233_fixup_lenovo_line2_mi
 		spec->kb_dev = NULL;
 	}
 }
+#else /* INPUT */
+#define alc280_fixup_hp_gpio2_mic_hotkey	NULL
+#define alc233_fixup_lenovo_line2_mic_hotkey	NULL
+#endif /* INPUT */
 
 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
 				const struct hda_fixup *fix, int action)
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/soc/au1x/ac97c.c linux-libre-4.4.134-gnu/sound/soc/au1x/ac97c.c
--- linux-libre-4.4.133-gnu/sound/soc/au1x/ac97c.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/soc/au1x/ac97c.c	2018-05-30 01:49:18.000000000 -0400
@@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_rea
 	do {
 		mutex_lock(&ctx->lock);
 
-		tmo = 5;
-		while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--)
+		tmo = 6;
+		while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
 			udelay(21);	/* wait an ac97 frame time */
 		if (!tmo) {
 			pr_debug("ac97rd timeout #1\n");
@@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_rea
 		 * poll, Forrest, poll...
 		 */
 		tmo = 0x10000;
-		while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--)
+		while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo)
 			asm volatile ("nop");
 		data = RD(ctx, AC97_CMDRESP);
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/soc/samsung/i2s.c linux-libre-4.4.134-gnu/sound/soc/samsung/i2s.c
--- linux-libre-4.4.133-gnu/sound/soc/samsung/i2s.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/soc/samsung/i2s.c	2018-05-30 01:49:18.000000000 -0400
@@ -640,8 +640,12 @@ static int i2s_set_fmt(struct snd_soc_da
 		tmp |= mod_slave;
 		break;
 	case SND_SOC_DAIFMT_CBS_CFS:
-		/* Set default source clock in Master mode */
-		if (i2s->rclk_srcrate == 0)
+		/*
+		 * Set default source clock in Master mode, only when the
+		 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
+		 * clock configuration assigned in DT is not overwritten.
+		 */
+		if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL)
 			i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
 							0, SND_SOC_CLOCK_IN);
 		break;
@@ -856,6 +860,11 @@ static int config_setup(struct i2s_dai *
 		return 0;
 
 	if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
+		struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
+
+		if (i2s->rclk_srcrate == 0 && rclksrc && !IS_ERR(rclksrc))
+			i2s->rclk_srcrate = clk_get_rate(rclksrc);
+
 		psr = i2s->rclk_srcrate / i2s->frmclk / rfs;
 		writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR);
 		dev_dbg(&i2s->pdev->dev,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/sound/soc/soc-topology.c linux-libre-4.4.134-gnu/sound/soc/soc-topology.c
--- linux-libre-4.4.133-gnu/sound/soc/soc-topology.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/sound/soc/soc-topology.c	2018-05-30 01:49:18.000000000 -0400
@@ -1188,6 +1188,9 @@ static struct snd_kcontrol_new *soc_tplg
 			kfree(sm);
 			continue;
 		}
+
+		/* create any TLV data */
+		soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
 	}
 	return kc;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/lib/bpf/libbpf.c linux-libre-4.4.134-gnu/tools/lib/bpf/libbpf.c
--- linux-libre-4.4.133-gnu/tools/lib/bpf/libbpf.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/lib/bpf/libbpf.c	2018-05-30 01:49:18.000000000 -0400
@@ -487,6 +487,24 @@ bpf_object__init_maps(struct bpf_object
 	return 0;
 }
 
+static bool section_have_execinstr(struct bpf_object *obj, int idx)
+{
+	Elf_Scn *scn;
+	GElf_Shdr sh;
+
+	scn = elf_getscn(obj->efile.elf, idx);
+	if (!scn)
+		return false;
+
+	if (gelf_getshdr(scn, &sh) != &sh)
+		return false;
+
+	if (sh.sh_flags & SHF_EXECINSTR)
+		return true;
+
+	return false;
+}
+
 static int bpf_object__elf_collect(struct bpf_object *obj)
 {
 	Elf *elf = obj->efile.elf;
@@ -567,6 +585,14 @@ static int bpf_object__elf_collect(struc
 		} else if (sh.sh_type == SHT_REL) {
 			void *reloc = obj->efile.reloc;
 			int nr_reloc = obj->efile.nr_reloc + 1;
+			int sec = sh.sh_info; /* points to other section */
+
+			/* Only do relo for section with exec instructions */
+			if (!section_have_execinstr(obj, sec)) {
+				pr_debug("skip relo %s(%d) for section(%d)\n",
+					 name, idx, sec);
+				continue;
+			}
 
 			reloc = realloc(reloc,
 					sizeof(*obj->efile.reloc) * nr_reloc);
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/lib/traceevent/event-parse.c linux-libre-4.4.134-gnu/tools/lib/traceevent/event-parse.c
--- linux-libre-4.4.133-gnu/tools/lib/traceevent/event-parse.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/lib/traceevent/event-parse.c	2018-05-30 01:49:18.000000000 -0400
@@ -4905,21 +4905,22 @@ static void pretty_print(struct trace_se
 				else
 					ls = 2;
 
-				if (*(ptr+1) == 'F' || *(ptr+1) == 'f' ||
-				    *(ptr+1) == 'S' || *(ptr+1) == 's') {
+				if (isalnum(ptr[1]))
 					ptr++;
+
+				if (*ptr == 'F' || *ptr == 'f' ||
+				    *ptr == 'S' || *ptr == 's') {
 					show_func = *ptr;
-				} else if (*(ptr+1) == 'M' || *(ptr+1) == 'm') {
-					print_mac_arg(s, *(ptr+1), data, size, event, arg);
-					ptr++;
+				} else if (*ptr == 'M' || *ptr == 'm') {
+					print_mac_arg(s, *ptr, data, size, event, arg);
 					arg = arg->next;
 					break;
-				} else if (*(ptr+1) == 'I' || *(ptr+1) == 'i') {
+				} else if (*ptr == 'I' || *ptr == 'i') {
 					int n;
 
-					n = print_ip_arg(s, ptr+1, data, size, event, arg);
+					n = print_ip_arg(s, ptr, data, size, event, arg);
 					if (n > 0) {
-						ptr += n;
+						ptr += n - 1;
 						arg = arg->next;
 						break;
 					}
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/lib/traceevent/parse-filter.c linux-libre-4.4.134-gnu/tools/lib/traceevent/parse-filter.c
--- linux-libre-4.4.133-gnu/tools/lib/traceevent/parse-filter.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/lib/traceevent/parse-filter.c	2018-05-30 01:49:18.000000000 -0400
@@ -1867,17 +1867,25 @@ static const char *get_field_str(struct
 	struct pevent *pevent;
 	unsigned long long addr;
 	const char *val = NULL;
+	unsigned int size;
 	char hex[64];
 
 	/* If the field is not a string convert it */
 	if (arg->str.field->flags & FIELD_IS_STRING) {
 		val = record->data + arg->str.field->offset;
+		size = arg->str.field->size;
+
+		if (arg->str.field->flags & FIELD_IS_DYNAMIC) {
+			addr = *(unsigned int *)val;
+			val = record->data + (addr & 0xffff);
+			size = addr >> 16;
+		}
 
 		/*
 		 * We need to copy the data since we can't be sure the field
 		 * is null terminated.
 		 */
-		if (*(val + arg->str.field->size - 1)) {
+		if (*(val + size - 1)) {
 			/* copy it */
 			memcpy(arg->str.buffer, val, arg->str.field->size);
 			/* the buffer is already NULL terminated */
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/perf/tests/vmlinux-kallsyms.c linux-libre-4.4.134-gnu/tools/perf/tests/vmlinux-kallsyms.c
--- linux-libre-4.4.133-gnu/tools/perf/tests/vmlinux-kallsyms.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/perf/tests/vmlinux-kallsyms.c	2018-05-30 01:49:18.000000000 -0400
@@ -126,7 +126,7 @@ int test__vmlinux_matches_kallsyms(void)
 
 		if (pair && UM(pair->start) == mem_start) {
 next_pair:
-			if (strcmp(sym->name, pair->name) == 0) {
+			if (arch__compare_symbol_names(sym->name, pair->name) == 0) {
 				/*
 				 * kallsyms don't have the symbol end, so we
 				 * set that by using the next symbol start - 1,
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/perf/util/evsel.c linux-libre-4.4.134-gnu/tools/perf/util/evsel.c
--- linux-libre-4.4.133-gnu/tools/perf/util/evsel.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/perf/util/evsel.c	2018-05-30 01:49:18.000000000 -0400
@@ -624,13 +624,13 @@ static void apply_config_terms(struct pe
 	struct perf_evsel_config_term *term;
 	struct list_head *config_terms = &evsel->config_terms;
 	struct perf_event_attr *attr = &evsel->attr;
-	struct callchain_param param;
+	/* callgraph default */
+	struct callchain_param param = {
+		.record_mode = callchain_param.record_mode,
+	};
 	u32 dump_size = 0;
 	char *callgraph_buf = NULL;
 
-	/* callgraph default */
-	param.record_mode = callchain_param.record_mode;
-
 	list_for_each_entry(term, config_terms, list) {
 		switch (term->type) {
 		case PERF_EVSEL__CONFIG_TERM_PERIOD:
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/perf/util/hist.c linux-libre-4.4.134-gnu/tools/perf/util/hist.c
--- linux-libre-4.4.133-gnu/tools/perf/util/hist.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/perf/util/hist.c	2018-05-30 01:49:18.000000000 -0400
@@ -720,7 +720,7 @@ iter_prepare_cumulative_entry(struct his
 	 * cumulated only one time to prevent entries more than 100%
 	 * overhead.
 	 */
-	he_cache = malloc(sizeof(*he_cache) * (iter->max_stack + 1));
+	he_cache = malloc(sizeof(*he_cache) * (callchain_cursor.nr + 1));
 	if (he_cache == NULL)
 		return -ENOMEM;
 
@@ -881,8 +881,6 @@ int hist_entry_iter__add(struct hist_ent
 	if (err)
 		return err;
 
-	iter->max_stack = max_stack_depth;
-
 	err = iter->ops->prepare_entry(iter, al);
 	if (err)
 		goto out;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/perf/util/hist.h linux-libre-4.4.134-gnu/tools/perf/util/hist.h
--- linux-libre-4.4.133-gnu/tools/perf/util/hist.h	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/perf/util/hist.h	2018-05-30 01:49:18.000000000 -0400
@@ -91,7 +91,6 @@ struct hist_entry_iter {
 	int curr;
 
 	bool hide_unresolved;
-	int max_stack;
 
 	struct perf_evsel *evsel;
 	struct perf_sample *sample;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc linux-libre-4.4.134-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
--- linux-libre-4.4.133-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc	1969-12-31 19:00:00.000000000 -0500
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc	2018-05-30 01:49:18.000000000 -0400
@@ -0,0 +1,46 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Kprobe event string type argument
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+echo 0 > events/enable
+echo > kprobe_events
+
+case `uname -m` in
+x86_64)
+  ARG2=%si
+  OFFS=8
+;;
+i[3456]86)
+  ARG2=%cx
+  OFFS=4
+;;
+aarch64)
+  ARG2=%x1
+  OFFS=8
+;;
+arm*)
+  ARG2=%r1
+  OFFS=4
+;;
+*)
+  echo "Please implement other architecture here"
+  exit_untested
+esac
+
+: "Test get argument (1)"
+echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string" > kprobe_events
+echo 1 > events/kprobes/testprobe/enable
+! echo test >> kprobe_events
+tail -n 1 trace | grep -qe "testprobe.* arg1=\"test\""
+
+echo 0 > events/kprobes/testprobe/enable
+: "Test get argument (2)"
+echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string arg2=+0(+${OFFS}(${ARG2})):string" > kprobe_events
+echo 1 > events/kprobes/testprobe/enable
+! echo test1 test2 >> kprobe_events
+tail -n 1 trace | grep -qe "testprobe.* arg1=\"test1\" arg2=\"test2\""
+
+echo 0 > events/enable
+echo > kprobe_events
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc linux-libre-4.4.134-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc
--- linux-libre-4.4.133-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc	1969-12-31 19:00:00.000000000 -0500
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc	2018-05-30 01:49:18.000000000 -0400
@@ -0,0 +1,97 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Kprobe event argument syntax
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
+
+echo 0 > events/enable
+echo > kprobe_events
+
+PROBEFUNC="vfs_read"
+GOODREG=
+BADREG=
+GOODSYM="_sdata"
+if ! grep -qw ${GOODSYM} /proc/kallsyms ; then
+  GOODSYM=$PROBEFUNC
+fi
+BADSYM="deaqswdefr"
+SYMADDR=0x`grep -w ${GOODSYM} /proc/kallsyms | cut -f 1 -d " "`
+GOODTYPE="x16"
+BADTYPE="y16"
+
+case `uname -m` in
+x86_64|i[3456]86)
+  GOODREG=%ax
+  BADREG=%ex
+;;
+aarch64)
+  GOODREG=%x0
+  BADREG=%ax
+;;
+arm*)
+  GOODREG=%r0
+  BADREG=%ax
+;;
+esac
+
+test_goodarg() # Good-args
+{
+  while [ "$1" ]; do
+    echo "p ${PROBEFUNC} $1" > kprobe_events
+    shift 1
+  done;
+}
+
+test_badarg() # Bad-args
+{
+  while [ "$1" ]; do
+    ! echo "p ${PROBEFUNC} $1" > kprobe_events
+    shift 1
+  done;
+}
+
+echo > kprobe_events
+
+: "Register access"
+test_goodarg ${GOODREG}
+test_badarg ${BADREG}
+
+: "Symbol access"
+test_goodarg "@${GOODSYM}" "@${SYMADDR}" "@${GOODSYM}+10" "@${GOODSYM}-10"
+test_badarg "@" "@${BADSYM}" "@${GOODSYM}*10" "@${GOODSYM}/10" \
+	    "@${GOODSYM}%10" "@${GOODSYM}&10" "@${GOODSYM}|10"
+
+: "Stack access"
+test_goodarg "\$stack" "\$stack0" "\$stack1"
+test_badarg "\$stackp" "\$stack0+10" "\$stack1-10"
+
+: "Retval access"
+echo "r ${PROBEFUNC} \$retval" > kprobe_events
+! echo "p ${PROBEFUNC} \$retval" > kprobe_events
+
+: "Comm access"
+test_goodarg "\$comm"
+
+: "Indirect memory access"
+test_goodarg "+0(${GOODREG})" "-0(${GOODREG})" "+10(\$stack)" \
+	"+0(\$stack1)" "+10(@${GOODSYM}-10)" "+0(+10(+20(\$stack)))"
+test_badarg "+(${GOODREG})" "(${GOODREG}+10)" "-(${GOODREG})" "(${GOODREG})" \
+	"+10(\$comm)" "+0(${GOODREG})+10"
+
+: "Name assignment"
+test_goodarg "varname=${GOODREG}"
+test_badarg "varname=varname2=${GOODREG}"
+
+: "Type syntax"
+test_goodarg "${GOODREG}:${GOODTYPE}"
+test_badarg "${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \
+	"${GOODTYPE}:${GOODREG}"
+
+: "Combination check"
+
+test_goodarg "\$comm:string" "+0(\$stack):string"
+test_badarg "\$comm:x64" "\$stack:string" "${GOODREG}:string"
+
+echo > kprobe_events
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc linux-libre-4.4.134-gnu/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc
--- linux-libre-4.4.133-gnu/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc	1969-12-31 19:00:00.000000000 -0500
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc	2018-05-30 01:49:18.000000000 -0400
@@ -0,0 +1,43 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Kprobe events - probe points
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+TARGET_FUNC=create_trace_kprobe
+
+dec_addr() { # hexaddr
+  printf "%d" "0x"`echo $1 | tail -c 8`
+}
+
+set_offs() { # prev target next
+  A1=`dec_addr $1`
+  A2=`dec_addr $2`
+  A3=`dec_addr $3`
+  TARGET="0x$2" # an address
+  PREV=`expr $A1 - $A2` # offset to previous symbol
+  NEXT=+`expr $A3 - $A2` # offset to next symbol
+  OVERFLOW=+`printf "0x%x" ${PREV}` # overflow offset to previous symbol
+}
+
+# We have to decode symbol addresses to get correct offsets.
+# If the offset is not an instruction boundary, it cause -EILSEQ.
+set_offs `grep -A1 -B1 ${TARGET_FUNC} /proc/kallsyms | cut -f 1 -d " " | xargs`
+
+UINT_TEST=no
+# printf "%x" -1 returns (unsigned long)-1.
+if [ `printf "%x" -1 | wc -c` != 9 ]; then
+  UINT_TEST=yes
+fi
+
+echo 0 > events/enable
+echo > kprobe_events
+echo "p:testprobe ${TARGET_FUNC}" > kprobe_events
+echo "p:testprobe ${TARGET}" > kprobe_events
+echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events
+! echo "p:testprobe ${TARGET_FUNC}${PREV}" > kprobe_events
+if [ "${UINT_TEST}" = yes ]; then
+! echo "p:testprobe ${TARGET_FUNC}${OVERFLOW}" > kprobe_events
+fi
+echo > kprobe_events
+clear_trace
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/Makefile linux-libre-4.4.134-gnu/tools/testing/selftests/Makefile
--- linux-libre-4.4.133-gnu/tools/testing/selftests/Makefile	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/Makefile	2018-05-30 01:49:18.000000000 -0400
@@ -90,6 +90,7 @@ ifdef INSTALL_PATH
 	for TARGET in $(TARGETS); do \
 		echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
 		echo "echo ========================================" >> $(ALL_SCRIPT); \
+		echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
 		echo "cd $$TARGET" >> $(ALL_SCRIPT); \
 		make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
 		echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/memfd/config linux-libre-4.4.134-gnu/tools/testing/selftests/memfd/config
--- linux-libre-4.4.133-gnu/tools/testing/selftests/memfd/config	1969-12-31 19:00:00.000000000 -0500
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/memfd/config	2018-05-30 01:49:18.000000000 -0400
@@ -0,0 +1 @@
+CONFIG_FUSE_FS=m
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/net/psock_fanout.c linux-libre-4.4.134-gnu/tools/testing/selftests/net/psock_fanout.c
--- linux-libre-4.4.133-gnu/tools/testing/selftests/net/psock_fanout.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/net/psock_fanout.c	2018-05-30 01:49:18.000000000 -0400
@@ -97,6 +97,8 @@ static int sock_fanout_open(uint16_t typ
 
 static void sock_fanout_set_ebpf(int fd)
 {
+	static char log_buf[65536];
+
 	const int len_off = __builtin_offsetof(struct __sk_buff, len);
 	struct bpf_insn prog[] = {
 		{ BPF_ALU64 | BPF_MOV | BPF_X,   6, 1, 0, 0 },
@@ -109,7 +111,6 @@ static void sock_fanout_set_ebpf(int fd)
 		{ BPF_ALU   | BPF_MOV | BPF_K,   0, 0, 0, 0 },
 		{ BPF_JMP   | BPF_EXIT,          0, 0, 0, 0 }
 	};
-	char log_buf[512];
 	union bpf_attr attr;
 	int pfd;
 
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/testing/selftests/powerpc/mm/subpage_prot.c linux-libre-4.4.134-gnu/tools/testing/selftests/powerpc/mm/subpage_prot.c
--- linux-libre-4.4.133-gnu/tools/testing/selftests/powerpc/mm/subpage_prot.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/testing/selftests/powerpc/mm/subpage_prot.c	2018-05-30 01:49:18.000000000 -0400
@@ -135,6 +135,16 @@ static int run_test(void *addr, unsigned
 	return 0;
 }
 
+static int syscall_available(void)
+{
+	int rc;
+
+	errno = 0;
+	rc = syscall(__NR_subpage_prot, 0, 0, 0);
+
+	return rc == 0 || (errno != ENOENT && errno != ENOSYS);
+}
+
 int test_anon(void)
 {
 	unsigned long align;
@@ -145,6 +155,8 @@ int test_anon(void)
 	void *mallocblock;
 	unsigned long mallocsize;
 
+	SKIP_IF(!syscall_available());
+
 	if (getpagesize() != 0x10000) {
 		fprintf(stderr, "Kernel page size must be 64K!\n");
 		return 1;
@@ -180,6 +192,8 @@ int test_file(void)
 	off_t filesize;
 	int fd;
 
+	SKIP_IF(!syscall_available());
+
 	fd = open(file_name, O_RDWR);
 	if (fd == -1) {
 		perror("failed to open file");
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/thermal/tmon/sysfs.c linux-libre-4.4.134-gnu/tools/thermal/tmon/sysfs.c
--- linux-libre-4.4.133-gnu/tools/thermal/tmon/sysfs.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/thermal/tmon/sysfs.c	2018-05-30 01:49:18.000000000 -0400
@@ -486,6 +486,7 @@ int zone_instance_to_index(int zone_inst
 int update_thermal_data()
 {
 	int i;
+	int next_thermal_record = cur_thermal_record + 1;
 	char tz_name[256];
 	static unsigned long samples;
 
@@ -495,9 +496,9 @@ int update_thermal_data()
 	}
 
 	/* circular buffer for keeping historic data */
-	if (cur_thermal_record >= NR_THERMAL_RECORDS)
-		cur_thermal_record = 0;
-	gettimeofday(&trec[cur_thermal_record].tv, NULL);
+	if (next_thermal_record >= NR_THERMAL_RECORDS)
+		next_thermal_record = 0;
+	gettimeofday(&trec[next_thermal_record].tv, NULL);
 	if (tmon_log) {
 		fprintf(tmon_log, "%lu ", ++samples);
 		fprintf(tmon_log, "%3.1f ", p_param.t_target);
@@ -507,11 +508,12 @@ int update_thermal_data()
 		snprintf(tz_name, 256, "%s/%s%d", THERMAL_SYSFS, TZONE,
 			ptdata.tzi[i].instance);
 		sysfs_get_ulong(tz_name, "temp",
-				&trec[cur_thermal_record].temp[i]);
+				&trec[next_thermal_record].temp[i]);
 		if (tmon_log)
 			fprintf(tmon_log, "%lu ",
-				trec[cur_thermal_record].temp[i]/1000);
+				trec[next_thermal_record].temp[i] / 1000);
 	}
+	cur_thermal_record = next_thermal_record;
 	for (i = 0; i < ptdata.nr_cooling_dev; i++) {
 		char cdev_name[256];
 		unsigned long val;
diff -druNp --no-dereference linux-libre-4.4.133-gnu/tools/thermal/tmon/tmon.c linux-libre-4.4.134-gnu/tools/thermal/tmon/tmon.c
--- linux-libre-4.4.133-gnu/tools/thermal/tmon/tmon.c	2018-05-26 02:49:01.000000000 -0400
+++ linux-libre-4.4.134-gnu/tools/thermal/tmon/tmon.c	2018-05-30 01:49:18.000000000 -0400
@@ -336,7 +336,6 @@ int main(int argc, char **argv)
 			show_data_w();
 			show_cooling_device();
 		}
-		cur_thermal_record++;
 		time_elapsed += ticktime;
 		controller_handler(trec[0].temp[target_tz_index] / 1000,
 				&yk);
