diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arc/include/asm/bug.h linux-libre-4.9.185-gnu/arch/arc/include/asm/bug.h
--- linux-libre-4.9.184-gnu/arch/arc/include/asm/bug.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arc/include/asm/bug.h	2019-07-10 03:55:47.000000000 -0400
@@ -23,7 +23,8 @@ void die(const char *str, struct pt_regs
 
 #define BUG()	do {								\
 	pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
-	dump_stack();								\
+	barrier_before_unreachable();						\
+	__builtin_trap();							\
 } while (0)
 
 #define HAVE_ARCH_BUG
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arc/include/asm/cmpxchg.h linux-libre-4.9.185-gnu/arch/arc/include/asm/cmpxchg.h
--- linux-libre-4.9.184-gnu/arch/arc/include/asm/cmpxchg.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arc/include/asm/cmpxchg.h	2019-07-10 03:55:47.000000000 -0400
@@ -92,8 +92,11 @@ __cmpxchg(volatile void *ptr, unsigned l
 
 #endif /* CONFIG_ARC_HAS_LLSC */
 
-#define cmpxchg(ptr, o, n) ((typeof(*(ptr)))__cmpxchg((ptr), \
-				(unsigned long)(o), (unsigned long)(n)))
+#define cmpxchg(ptr, o, n) ({				\
+	(typeof(*(ptr)))__cmpxchg((ptr),		\
+				  (unsigned long)(o),	\
+				  (unsigned long)(n));	\
+})
 
 /*
  * atomic_cmpxchg is same as cmpxchg
@@ -198,8 +201,11 @@ static inline unsigned long __xchg(unsig
 	return __xchg_bad_pointer();
 }
 
-#define xchg(ptr, with) ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), \
-						 sizeof(*(ptr))))
+#define xchg(ptr, with) ({				\
+	(typeof(*(ptr)))__xchg((unsigned long)(with),	\
+			       (ptr),			\
+			       sizeof(*(ptr)));		\
+})
 
 #endif /* CONFIG_ARC_PLAT_EZNPS */
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arc/Kconfig linux-libre-4.9.185-gnu/arch/arc/Kconfig
--- linux-libre-4.9.184-gnu/arch/arc/Kconfig	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arc/Kconfig	2019-07-10 03:55:47.000000000 -0400
@@ -23,7 +23,7 @@ config ARC
 	select GENERIC_SMP_IDLE_THREAD
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_TRACEHOOK
-	select HAVE_FUTEX_CMPXCHG
+	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_IOREMAP_PROT
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arc/kernel/traps.c linux-libre-4.9.185-gnu/arch/arc/kernel/traps.c
--- linux-libre-4.9.184-gnu/arch/arc/kernel/traps.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arc/kernel/traps.c	2019-07-10 03:55:47.000000000 -0400
@@ -155,3 +155,11 @@ void do_insterror_or_kprobe(unsigned lon
 
 	insterror_is_error(address, regs);
 }
+
+/*
+ * abort() call generated by older gcc for __builtin_trap()
+ */
+void abort(void)
+{
+	__asm__ __volatile__("trap_s  5\n");
+}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arc/mm/tlb.c linux-libre-4.9.185-gnu/arch/arc/mm/tlb.c
--- linux-libre-4.9.184-gnu/arch/arc/mm/tlb.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arc/mm/tlb.c	2019-07-10 03:55:47.000000000 -0400
@@ -890,9 +890,11 @@ void do_tlb_overlap_fault(unsigned long
 			  struct pt_regs *regs)
 {
 	struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
-	unsigned int pd0[mmu->ways];
 	unsigned long flags;
-	int set;
+	int set, n_ways = mmu->ways;
+
+	n_ways = min(n_ways, 4);
+	BUG_ON(mmu->ways > 4);
 
 	local_irq_save(flags);
 
@@ -900,9 +902,10 @@ void do_tlb_overlap_fault(unsigned long
 	for (set = 0; set < mmu->sets; set++) {
 
 		int is_valid, way;
+		unsigned int pd0[4];
 
 		/* read out all the ways of current set */
-		for (way = 0, is_valid = 0; way < mmu->ways; way++) {
+		for (way = 0, is_valid = 0; way < n_ways; way++) {
 			write_aux_reg(ARC_REG_TLBINDEX,
 					  SET_WAY_TO_IDX(mmu, set, way));
 			write_aux_reg(ARC_REG_TLBCOMMAND, TLBRead);
@@ -916,14 +919,14 @@ void do_tlb_overlap_fault(unsigned long
 			continue;
 
 		/* Scan the set for duplicate ways: needs a nested loop */
-		for (way = 0; way < mmu->ways - 1; way++) {
+		for (way = 0; way < n_ways - 1; way++) {
 
 			int n;
 
 			if (!pd0[way])
 				continue;
 
-			for (n = way + 1; n < mmu->ways; n++) {
+			for (n = way + 1; n < n_ways; n++) {
 				if (pd0[way] != pd0[n])
 					continue;
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arm/mach-imx/cpuidle-imx6sx.c linux-libre-4.9.185-gnu/arch/arm/mach-imx/cpuidle-imx6sx.c
--- linux-libre-4.9.184-gnu/arch/arm/mach-imx/cpuidle-imx6sx.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arm/mach-imx/cpuidle-imx6sx.c	2019-07-10 03:55:47.000000000 -0400
@@ -15,6 +15,7 @@
 
 #include "common.h"
 #include "cpuidle.h"
+#include "hardware.h"
 
 static int imx6sx_idle_finish(unsigned long val)
 {
@@ -108,7 +109,7 @@ int __init imx6sx_cpuidle_init(void)
 	 * except for power up sw2iso which need to be
 	 * larger than LDO ramp up time.
 	 */
-	imx_gpc_set_arm_power_up_timing(0xf, 1);
+	imx_gpc_set_arm_power_up_timing(cpu_is_imx6sx() ? 0xf : 0x2, 1);
 	imx_gpc_set_arm_power_down_timing(1, 1);
 
 	return cpuidle_register(&imx6sx_cpuidle_driver, NULL);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arm64/kernel/module.c linux-libre-4.9.185-gnu/arch/arm64/kernel/module.c
--- linux-libre-4.9.184-gnu/arch/arm64/kernel/module.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arm64/kernel/module.c	2019-07-10 03:55:47.000000000 -0400
@@ -33,10 +33,14 @@
 void *module_alloc(unsigned long size)
 {
 	void *p;
+	u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
+
+	if (IS_ENABLED(CONFIG_KASAN))
+		/* don't exceed the static module region - see below */
+		module_alloc_end = MODULES_END;
 
 	p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
-				module_alloc_base + MODULES_VSIZE,
-				GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
+				module_alloc_end, GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
 				NUMA_NO_NODE, __builtin_return_address(0));
 
 	if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/arm64/kernel/vdso.c linux-libre-4.9.185-gnu/arch/arm64/kernel/vdso.c
--- linux-libre-4.9.184-gnu/arch/arm64/kernel/vdso.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/arm64/kernel/vdso.c	2019-07-10 03:55:47.000000000 -0400
@@ -37,7 +37,7 @@
 #include <asm/vdso.h>
 #include <asm/vdso_datapage.h>
 
-extern char vdso_start, vdso_end;
+extern char vdso_start[], vdso_end[];
 static unsigned long vdso_pages __ro_after_init;
 
 /*
@@ -124,14 +124,14 @@ static int __init vdso_init(void)
 	int i;
 	struct page **vdso_pagelist;
 
-	if (memcmp(&vdso_start, "\177ELF", 4)) {
+	if (memcmp(vdso_start, "\177ELF", 4)) {
 		pr_err("vDSO is not a valid ELF object!\n");
 		return -EINVAL;
 	}
 
-	vdso_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT;
+	vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
 	pr_info("vdso: %ld pages (%ld code @ %p, %ld data @ %p)\n",
-		vdso_pages + 1, vdso_pages, &vdso_start, 1L, vdso_data);
+		vdso_pages + 1, vdso_pages, vdso_start, 1L, vdso_data);
 
 	/* Allocate the vDSO pagelist, plus a page for the data. */
 	vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *),
@@ -144,7 +144,7 @@ static int __init vdso_init(void)
 
 	/* Grab the vDSO code pages. */
 	for (i = 0; i < vdso_pages; i++)
-		vdso_pagelist[i + 1] = pfn_to_page(PHYS_PFN(__pa(&vdso_start)) + i);
+		vdso_pagelist[i + 1] = pfn_to_page(PHYS_PFN(__pa(vdso_start)) + i);
 
 	vdso_spec[0].pages = &vdso_pagelist[0];
 	vdso_spec[1].pages = &vdso_pagelist[1];
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/ia64/include/asm/bug.h linux-libre-4.9.185-gnu/arch/ia64/include/asm/bug.h
--- linux-libre-4.9.184-gnu/arch/ia64/include/asm/bug.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/ia64/include/asm/bug.h	2019-07-10 03:55:47.000000000 -0400
@@ -3,7 +3,11 @@
 
 #ifdef CONFIG_BUG
 #define ia64_abort()	__builtin_trap()
-#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0)
+#define BUG() do {						\
+	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__);	\
+	barrier_before_unreachable();				\
+	ia64_abort();						\
+} while (0)
 
 /* should this BUG be made generic? */
 #define HAVE_ARCH_BUG
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/m68k/include/asm/bug.h linux-libre-4.9.185-gnu/arch/m68k/include/asm/bug.h
--- linux-libre-4.9.184-gnu/arch/m68k/include/asm/bug.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/m68k/include/asm/bug.h	2019-07-10 03:55:47.000000000 -0400
@@ -7,16 +7,19 @@
 #ifndef CONFIG_SUN3
 #define BUG() do { \
 	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+	barrier_before_unreachable(); \
 	__builtin_trap(); \
 } while (0)
 #else
 #define BUG() do { \
 	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+	barrier_before_unreachable(); \
 	panic("BUG!"); \
 } while (0)
 #endif
 #else
 #define BUG() do { \
+	barrier_before_unreachable(); \
 	__builtin_trap(); \
 } while (0)
 #endif
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/mips/include/asm/compiler.h linux-libre-4.9.185-gnu/arch/mips/include/asm/compiler.h
--- linux-libre-4.9.184-gnu/arch/mips/include/asm/compiler.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/mips/include/asm/compiler.h	2019-07-10 03:55:47.000000000 -0400
@@ -8,6 +8,41 @@
 #ifndef _ASM_COMPILER_H
 #define _ASM_COMPILER_H
 
+/*
+ * With GCC 4.5 onwards we can use __builtin_unreachable to indicate to the
+ * compiler that a particular code path will never be hit. This allows it to be
+ * optimised out of the generated binary.
+ *
+ * Unfortunately at least GCC 4.6.3 through 7.3.0 inclusive suffer from a bug
+ * that can lead to instructions from beyond an unreachable statement being
+ * incorrectly reordered into earlier delay slots if the unreachable statement
+ * is the only content of a case in a switch statement. This can lead to
+ * seemingly random behaviour, such as invalid memory accesses from incorrectly
+ * reordered loads or stores. See this potential GCC fix for details:
+ *
+ *   https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html
+ *
+ * It is unclear whether GCC 8 onwards suffer from the same issue - nothing
+ * relevant is mentioned in GCC 8 release notes and nothing obviously relevant
+ * stands out in GCC commit logs, but these newer GCC versions generate very
+ * different code for the testcase which doesn't exhibit the bug.
+ *
+ * GCC also handles stack allocation suboptimally when calling noreturn
+ * functions or calling __builtin_unreachable():
+ *
+ *   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
+ *
+ * We work around both of these issues by placing a volatile asm statement,
+ * which GCC is prevented from reordering past, prior to __builtin_unreachable
+ * calls.
+ *
+ * The .insn statement is required to ensure that any branches to the
+ * statement, which sadly must be kept due to the asm statement, are known to
+ * be branches to code and satisfy linker requirements for microMIPS kernels.
+ */
+#undef barrier_before_unreachable
+#define barrier_before_unreachable() asm volatile(".insn")
+
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
 #define GCC_IMM_ASM() "n"
 #define GCC_REG_ACCUM "$0"
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/mips/include/asm/netlogic/xlr/fmn.h linux-libre-4.9.185-gnu/arch/mips/include/asm/netlogic/xlr/fmn.h
--- linux-libre-4.9.184-gnu/arch/mips/include/asm/netlogic/xlr/fmn.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/mips/include/asm/netlogic/xlr/fmn.h	2019-07-10 03:55:47.000000000 -0400
@@ -301,8 +301,6 @@ static inline int nlm_fmn_send(unsigned
 	for (i = 0; i < 8; i++) {
 		nlm_msgsnd(dest);
 		status = nlm_read_c2_status0();
-		if ((status & 0x2) == 1)
-			pr_info("Send pending fail!\n");
 		if ((status & 0x4) == 0)
 			return 0;
 	}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/mips/Kconfig linux-libre-4.9.185-gnu/arch/mips/Kconfig
--- linux-libre-4.9.184-gnu/arch/mips/Kconfig	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/mips/Kconfig	2019-07-10 03:55:47.000000000 -0400
@@ -13,6 +13,7 @@ config MIPS
 	select HAVE_OPROFILE
 	select HAVE_PERF_EVENTS
 	select PERF_USE_VMALLOC
+	select HAVE_ARCH_COMPILER_H
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_SECCOMP_FILTER
 	select HAVE_ARCH_TRACEHOOK
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/mips/kernel/uprobes.c linux-libre-4.9.185-gnu/arch/mips/kernel/uprobes.c
--- linux-libre-4.9.184-gnu/arch/mips/kernel/uprobes.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/mips/kernel/uprobes.c	2019-07-10 03:55:47.000000000 -0400
@@ -111,9 +111,6 @@ int arch_uprobe_pre_xol(struct arch_upro
 	 */
 	aup->resume_epc = regs->cp0_epc + 4;
 	if (insn_has_delay_slot((union mips_instruction) aup->insn[0])) {
-		unsigned long epc;
-
-		epc = regs->cp0_epc;
 		__compute_return_epc_for_insn(regs,
 			(union mips_instruction) aup->insn[0]);
 		aup->resume_epc = regs->cp0_epc;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/mips/math-emu/cp1emu.c linux-libre-4.9.185-gnu/arch/mips/math-emu/cp1emu.c
--- linux-libre-4.9.184-gnu/arch/mips/math-emu/cp1emu.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/mips/math-emu/cp1emu.c	2019-07-10 03:55:47.000000000 -0400
@@ -828,12 +828,12 @@ do {									\
 } while (0)
 
 #define DIFROMREG(di, x)						\
-	((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0))
+	((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) ^ 1)], 0))
 
 #define DITOREG(di, x)							\
 do {									\
 	unsigned fpr, i;						\
-	fpr = (x) & ~(cop1_64bit(xcp) == 0);				\
+	fpr = (x) & ~(cop1_64bit(xcp) ^ 1);				\
 	set_fpr64(&ctx->fpr[fpr], 0, di);				\
 	for (i = 1; i < ARRAY_SIZE(ctx->fpr[x].val64); i++)		\
 		set_fpr64(&ctx->fpr[fpr], i, 0);			\
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/mips/mm/tlbex.c linux-libre-4.9.185-gnu/arch/mips/mm/tlbex.c
--- linux-libre-4.9.184-gnu/arch/mips/mm/tlbex.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/mips/mm/tlbex.c	2019-07-10 03:55:47.000000000 -0400
@@ -386,6 +386,7 @@ static struct work_registers build_get_w
 static void build_restore_work_registers(u32 **p)
 {
 	if (scratch_reg >= 0) {
+		uasm_i_ehb(p);
 		UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
 		return;
 	}
@@ -674,10 +675,12 @@ static void build_restore_pagemask(u32 *
 			uasm_i_mtc0(p, 0, C0_PAGEMASK);
 			uasm_il_b(p, r, lid);
 		}
-		if (scratch_reg >= 0)
+		if (scratch_reg >= 0) {
+			uasm_i_ehb(p);
 			UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
-		else
+		} else {
 			UASM_i_LW(p, 1, scratchpad_offset(0), 0);
+		}
 	} else {
 		/* Reset default page size */
 		if (PM_DEFAULT_MASK >> 16) {
@@ -935,10 +938,12 @@ build_get_pgd_vmalloc64(u32 **p, struct
 		uasm_i_jr(p, ptr);
 
 		if (mode == refill_scratch) {
-			if (scratch_reg >= 0)
+			if (scratch_reg >= 0) {
+				uasm_i_ehb(p);
 				UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
-			else
+			} else {
 				UASM_i_LW(p, 1, scratchpad_offset(0), 0);
+			}
 		} else {
 			uasm_i_nop(p);
 		}
@@ -1238,6 +1243,7 @@ build_fast_tlb_refill_handler (u32 **p,
 	UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */
 
 	if (c0_scratch_reg >= 0) {
+		uasm_i_ehb(p);
 		UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg);
 		build_tlb_write_entry(p, l, r, tlb_random);
 		uasm_l_leave(l, *p);
@@ -1592,15 +1598,17 @@ static void build_setup_pgd(void)
 		uasm_i_dinsm(&p, a0, 0, 29, 64 - 29);
 		uasm_l_tlbl_goaround1(&l, p);
 		UASM_i_SLL(&p, a0, a0, 11);
-		uasm_i_jr(&p, 31);
 		UASM_i_MTC0(&p, a0, C0_CONTEXT);
+		uasm_i_jr(&p, 31);
+		uasm_i_ehb(&p);
 	} else {
 		/* PGD in c0_KScratch */
-		uasm_i_jr(&p, 31);
 		if (cpu_has_ldpte)
 			UASM_i_MTC0(&p, a0, C0_PWBASE);
 		else
 			UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
+		uasm_i_jr(&p, 31);
+		uasm_i_ehb(&p);
 	}
 #else
 #ifdef CONFIG_SMP
@@ -1614,13 +1622,16 @@ static void build_setup_pgd(void)
 	UASM_i_LA_mostly(&p, a2, pgdc);
 	UASM_i_SW(&p, a0, uasm_rel_lo(pgdc), a2);
 #endif /* SMP */
-	uasm_i_jr(&p, 31);
 
 	/* if pgd_reg is allocated, save PGD also to scratch register */
-	if (pgd_reg != -1)
+	if (pgd_reg != -1) {
 		UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
-	else
+		uasm_i_jr(&p, 31);
+		uasm_i_ehb(&p);
+	} else {
+		uasm_i_jr(&p, 31);
 		uasm_i_nop(&p);
+	}
 #endif
 	if (p >= tlbmiss_handler_setup_pgd_end)
 		panic("tlbmiss_handler_setup_pgd space exceeded");
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/parisc/math-emu/cnv_float.h linux-libre-4.9.185-gnu/arch/parisc/math-emu/cnv_float.h
--- linux-libre-4.9.184-gnu/arch/parisc/math-emu/cnv_float.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/parisc/math-emu/cnv_float.h	2019-07-10 03:55:47.000000000 -0400
@@ -60,19 +60,19 @@
     ((exponent < (SGL_P - 1)) ?				\
      (Sall(sgl_value) << (SGL_EXP_LENGTH + 1 + exponent)) : FALSE)
 
-#define Int_isinexact_to_sgl(int_value)	(int_value << 33 - SGL_EXP_LENGTH)
+#define Int_isinexact_to_sgl(int_value)	((int_value << 33 - SGL_EXP_LENGTH) != 0)
 
 #define Sgl_roundnearest_from_int(int_value,sgl_value)			\
     if (int_value & 1<<(SGL_EXP_LENGTH - 2))   /* round bit */		\
-    	if ((int_value << 34 - SGL_EXP_LENGTH) || Slow(sgl_value))	\
+	if (((int_value << 34 - SGL_EXP_LENGTH) != 0) || Slow(sgl_value)) \
 		Sall(sgl_value)++
 
 #define Dint_isinexact_to_sgl(dint_valueA,dint_valueB)		\
-    ((Dintp1(dint_valueA) << 33 - SGL_EXP_LENGTH) || Dintp2(dint_valueB))
+    (((Dintp1(dint_valueA) << 33 - SGL_EXP_LENGTH) != 0) || Dintp2(dint_valueB))
 
 #define Sgl_roundnearest_from_dint(dint_valueA,dint_valueB,sgl_value)	\
     if (Dintp1(dint_valueA) & 1<<(SGL_EXP_LENGTH - 2)) 			\
-    	if ((Dintp1(dint_valueA) << 34 - SGL_EXP_LENGTH) ||		\
+	if (((Dintp1(dint_valueA) << 34 - SGL_EXP_LENGTH) != 0) ||	\
     	Dintp2(dint_valueB) || Slow(sgl_value)) Sall(sgl_value)++
 
 #define Dint_isinexact_to_dbl(dint_value) 	\
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/powerpc/include/asm/ppc-opcode.h linux-libre-4.9.185-gnu/arch/powerpc/include/asm/ppc-opcode.h
--- linux-libre-4.9.184-gnu/arch/powerpc/include/asm/ppc-opcode.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/powerpc/include/asm/ppc-opcode.h	2019-07-10 03:55:47.000000000 -0400
@@ -261,6 +261,7 @@
 #define PPC_INST_MULLI			0x1c000000
 #define PPC_INST_DIVWU			0x7c000396
 #define PPC_INST_DIVD			0x7c0003d2
+#define PPC_INST_DIVDU			0x7c000392
 #define PPC_INST_RLWINM			0x54000000
 #define PPC_INST_RLWIMI			0x50000000
 #define PPC_INST_RLDICL			0x78000000
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/powerpc/net/bpf_jit_comp64.c linux-libre-4.9.185-gnu/arch/powerpc/net/bpf_jit_comp64.c
--- linux-libre-4.9.184-gnu/arch/powerpc/net/bpf_jit_comp64.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/powerpc/net/bpf_jit_comp64.c	2019-07-10 03:55:47.000000000 -0400
@@ -419,12 +419,12 @@ static int bpf_jit_build_body(struct bpf
 			PPC_LI(b2p[BPF_REG_0], 0);
 			PPC_JMP(exit_addr);
 			if (BPF_OP(code) == BPF_MOD) {
-				PPC_DIVD(b2p[TMP_REG_1], dst_reg, src_reg);
+				PPC_DIVDU(b2p[TMP_REG_1], dst_reg, src_reg);
 				PPC_MULD(b2p[TMP_REG_1], src_reg,
 						b2p[TMP_REG_1]);
 				PPC_SUB(dst_reg, dst_reg, b2p[TMP_REG_1]);
 			} else
-				PPC_DIVD(dst_reg, dst_reg, src_reg);
+				PPC_DIVDU(dst_reg, dst_reg, src_reg);
 			break;
 		case BPF_ALU | BPF_MOD | BPF_K: /* (u32) dst %= (u32) imm */
 		case BPF_ALU | BPF_DIV | BPF_K: /* (u32) dst /= (u32) imm */
@@ -452,7 +452,7 @@ static int bpf_jit_build_body(struct bpf
 				break;
 			case BPF_ALU64:
 				if (BPF_OP(code) == BPF_MOD) {
-					PPC_DIVD(b2p[TMP_REG_2], dst_reg,
+					PPC_DIVDU(b2p[TMP_REG_2], dst_reg,
 							b2p[TMP_REG_1]);
 					PPC_MULD(b2p[TMP_REG_1],
 							b2p[TMP_REG_1],
@@ -460,7 +460,7 @@ static int bpf_jit_build_body(struct bpf
 					PPC_SUB(dst_reg, dst_reg,
 							b2p[TMP_REG_1]);
 				} else
-					PPC_DIVD(dst_reg, dst_reg,
+					PPC_DIVDU(dst_reg, dst_reg,
 							b2p[TMP_REG_1]);
 				break;
 			}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/powerpc/net/bpf_jit.h linux-libre-4.9.185-gnu/arch/powerpc/net/bpf_jit.h
--- linux-libre-4.9.184-gnu/arch/powerpc/net/bpf_jit.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/powerpc/net/bpf_jit.h	2019-07-10 03:55:47.000000000 -0400
@@ -116,7 +116,7 @@
 				     ___PPC_RA(a) | IMM_L(i))
 #define PPC_DIVWU(d, a, b)	EMIT(PPC_INST_DIVWU | ___PPC_RT(d) |	      \
 				     ___PPC_RA(a) | ___PPC_RB(b))
-#define PPC_DIVD(d, a, b)	EMIT(PPC_INST_DIVD | ___PPC_RT(d) |	      \
+#define PPC_DIVDU(d, a, b)	EMIT(PPC_INST_DIVDU | ___PPC_RT(d) |	      \
 				     ___PPC_RA(a) | ___PPC_RB(b))
 #define PPC_AND(d, a, b)	EMIT(PPC_INST_AND | ___PPC_RA(d) |	      \
 				     ___PPC_RS(a) | ___PPC_RB(b))
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/sparc/include/asm/bug.h linux-libre-4.9.185-gnu/arch/sparc/include/asm/bug.h
--- linux-libre-4.9.184-gnu/arch/sparc/include/asm/bug.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/sparc/include/asm/bug.h	2019-07-10 03:55:47.000000000 -0400
@@ -8,10 +8,14 @@
 void do_BUG(const char *file, int line);
 #define BUG() do {					\
 	do_BUG(__FILE__, __LINE__);			\
+	barrier_before_unreachable();			\
 	__builtin_trap();				\
 } while (0)
 #else
-#define BUG()		__builtin_trap()
+#define BUG() do {					\
+	barrier_before_unreachable();			\
+	__builtin_trap();				\
+} while (0)
 #endif
 
 #define HAVE_ARCH_BUG
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/sparc/kernel/perf_event.c linux-libre-4.9.185-gnu/arch/sparc/kernel/perf_event.c
--- linux-libre-4.9.184-gnu/arch/sparc/kernel/perf_event.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/sparc/kernel/perf_event.c	2019-07-10 03:55:47.000000000 -0400
@@ -889,6 +889,10 @@ static int sparc_perf_event_set_period(s
 	s64 period = hwc->sample_period;
 	int ret = 0;
 
+	/* The period may have been changed by PERF_EVENT_IOC_PERIOD */
+	if (unlikely(period != hwc->last_period))
+		left = period - (hwc->last_period - left);
+
 	if (unlikely(left <= -period)) {
 		left = period;
 		local64_set(&hwc->period_left, left);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/x86/kernel/cpu/bugs.c linux-libre-4.9.185-gnu/arch/x86/kernel/cpu/bugs.c
--- linux-libre-4.9.184-gnu/arch/x86/kernel/cpu/bugs.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/x86/kernel/cpu/bugs.c	2019-07-10 03:55:47.000000000 -0400
@@ -829,6 +829,16 @@ static enum ssb_mitigation __init __ssb_
 	}
 
 	/*
+	 * If SSBD is controlled by the SPEC_CTRL MSR, then set the proper
+	 * bit in the mask to allow guests to use the mitigation even in the
+	 * case where the host does not enable it.
+	 */
+	if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) ||
+	    static_cpu_has(X86_FEATURE_AMD_SSBD)) {
+		x86_spec_ctrl_mask |= SPEC_CTRL_SSBD;
+	}
+
+	/*
 	 * We have three CPU feature flags that are in play here:
 	 *  - X86_BUG_SPEC_STORE_BYPASS - CPU is susceptible.
 	 *  - X86_FEATURE_SSBD - CPU is able to turn off speculative store bypass
@@ -845,7 +855,6 @@ static enum ssb_mitigation __init __ssb_
 			x86_amd_ssb_disable();
 		} else {
 			x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
-			x86_spec_ctrl_mask |= SPEC_CTRL_SSBD;
 			wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
 		}
 	}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/x86/kvm/lapic.c linux-libre-4.9.185-gnu/arch/x86/kvm/lapic.c
--- linux-libre-4.9.184-gnu/arch/x86/kvm/lapic.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/x86/kvm/lapic.c	2019-07-10 03:55:47.000000000 -0400
@@ -1992,7 +1992,7 @@ int kvm_apic_has_interrupt(struct kvm_vc
 	struct kvm_lapic *apic = vcpu->arch.apic;
 	int highest_irr;
 
-	if (!apic_enabled(apic))
+	if (!kvm_apic_hw_enabled(apic))
 		return -1;
 
 	apic_update_ppr(apic);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/arch/x86/kvm/x86.c linux-libre-4.9.185-gnu/arch/x86/kvm/x86.c
--- linux-libre-4.9.184-gnu/arch/x86/kvm/x86.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/arch/x86/kvm/x86.c	2019-07-10 03:55:47.000000000 -0400
@@ -1365,7 +1365,7 @@ static int set_tsc_khz(struct kvm_vcpu *
 			vcpu->arch.tsc_always_catchup = 1;
 			return 0;
 		} else {
-			WARN(1, "user requested TSC rate below hardware speed\n");
+			pr_warn_ratelimited("user requested TSC rate below hardware speed\n");
 			return -1;
 		}
 	}
@@ -1375,8 +1375,8 @@ static int set_tsc_khz(struct kvm_vcpu *
 				user_tsc_khz, tsc_khz);
 
 	if (ratio == 0 || ratio >= kvm_max_tsc_scaling_ratio) {
-		WARN_ONCE(1, "Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
-			  user_tsc_khz);
+		pr_warn_ratelimited("Invalid TSC scaling ratio - virtual-tsc-khz=%u\n",
+			            user_tsc_khz);
 		return -1;
 	}
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/crypto/crypto_user.c linux-libre-4.9.185-gnu/crypto/crypto_user.c
--- linux-libre-4.9.184-gnu/crypto/crypto_user.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/crypto/crypto_user.c	2019-07-10 03:55:47.000000000 -0400
@@ -55,6 +55,9 @@ static struct crypto_alg *crypto_alg_mat
 	list_for_each_entry(q, &crypto_alg_list, cra_list) {
 		int match = 0;
 
+		if (crypto_is_larval(q))
+			continue;
+
 		if ((q->cra_flags ^ p->cru_type) & p->cru_mask)
 			continue;
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/clk/sunxi/clk-sun8i-bus-gates.c linux-libre-4.9.185-gnu/drivers/clk/sunxi/clk-sun8i-bus-gates.c
--- linux-libre-4.9.184-gnu/drivers/clk/sunxi/clk-sun8i-bus-gates.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/clk/sunxi/clk-sun8i-bus-gates.c	2019-07-10 03:55:47.000000000 -0400
@@ -78,6 +78,10 @@ static void __init sun8i_h3_bus_gates_in
 			clk_parent = APB1;
 		else if (index >= 96 && index <= 127)
 			clk_parent = APB2;
+		else {
+			WARN_ON(true);
+			continue;
+		}
 
 		clk_reg = reg + 4 * (index / 32);
 		clk_bit = index % 32;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/dma/imx-sdma.c linux-libre-4.9.185-gnu/drivers/dma/imx-sdma.c
--- linux-libre-4.9.184-gnu/drivers/dma/imx-sdma.c	2019-06-26 22:05:34.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/dma/imx-sdma.c	2019-07-10 18:46:34.000000000 -0400
@@ -632,7 +632,7 @@ static int sdma_load_script(struct sdma_
 	spin_lock_irqsave(&sdma->channel_0_lock, flags);
 
 	bd0->mode.command = C0_SETPM;
-	bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD;
+	bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
 	bd0->mode.count = size / 2;
 	bd0->buffer_addr = buf_phys;
 	bd0->ext_buffer_addr = address;
@@ -909,7 +909,7 @@ static int sdma_load_context(struct sdma
 	context->gReg[7] = sdmac->watermark_level;
 
 	bd0->mode.command = C0_SETDM;
-	bd0->mode.status = BD_DONE | BD_INTR | BD_WRAP | BD_EXTD;
+	bd0->mode.status = BD_DONE | BD_WRAP | BD_EXTD;
 	bd0->mode.count = sizeof(*context) / 4;
 	bd0->buffer_addr = sdma->context_phys;
 	bd0->ext_buffer_addr = 2048 + (sizeof(*context) / 4) * channel;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/gpu/drm/arm/hdlcd_crtc.c linux-libre-4.9.185-gnu/drivers/gpu/drm/arm/hdlcd_crtc.c
--- linux-libre-4.9.184-gnu/drivers/gpu/drm/arm/hdlcd_crtc.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/gpu/drm/arm/hdlcd_crtc.c	2019-07-10 03:55:47.000000000 -0400
@@ -170,7 +170,8 @@ static int hdlcd_crtc_atomic_check(struc
 	long rate, clk_rate = mode->clock * 1000;
 
 	rate = clk_round_rate(hdlcd->clk, clk_rate);
-	if (rate != clk_rate) {
+	/* 0.1% seems a close enough tolerance for the TDA19988 on Juno */
+	if (abs(rate - clk_rate) * 1000 > clk_rate) {
 		/* clock required by mode not supported by hardware */
 		return -EINVAL;
 	}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/gpu/drm/i915/intel_csr.c linux-libre-4.9.185-gnu/drivers/gpu/drm/i915/intel_csr.c
--- linux-libre-4.9.184-gnu/drivers/gpu/drm/i915/intel_csr.c	2019-06-26 22:04:25.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/gpu/drm/i915/intel_csr.c	2019-07-10 18:45:04.000000000 -0400
@@ -280,10 +280,17 @@ static uint32_t *parse_csr_fw(struct drm
 	uint32_t i;
 	uint32_t *dmc_payload;
 	uint32_t required_version;
+	size_t fsize;
 
 	if (!fw)
 		return NULL;
 
+	fsize = sizeof(struct intel_css_header) +
+		sizeof(struct intel_package_header) +
+		sizeof(struct intel_dmc_header);
+	if (fsize > fw->size)
+		goto error_truncated;
+
 	/* Extract CSS Header information*/
 	css_header = (struct intel_css_header *)fw->data;
 	if (sizeof(struct intel_css_header) !=
@@ -349,6 +356,9 @@ static uint32_t *parse_csr_fw(struct drm
 		return NULL;
 	}
 	readcount += dmc_offset;
+	fsize += dmc_offset;
+	if (fsize > fw->size)
+		goto error_truncated;
 
 	/* Extract dmc_header information. */
 	dmc_header = (struct intel_dmc_header *)&fw->data[readcount];
@@ -379,6 +389,10 @@ static uint32_t *parse_csr_fw(struct drm
 
 	/* fw_size is in dwords, so multiplied by 4 to convert into bytes. */
 	nbytes = dmc_header->fw_size * 4;
+	fsize += nbytes;
+	if (fsize > fw->size)
+		goto error_truncated;
+
 	if (nbytes > CSR_MAX_FW_SIZE) {
 		DRM_ERROR("CSR firmware too big (%u) bytes\n", nbytes);
 		return NULL;
@@ -392,6 +406,10 @@ static uint32_t *parse_csr_fw(struct drm
 	}
 
 	return memcpy(dmc_payload, &fw->data[readcount], nbytes);
+
+error_truncated:
+	DRM_ERROR("Truncated DMC firmware, rejecting.\n");
+	return NULL;
 }
 
 static void csr_load_work_fn(struct work_struct *work)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/gpu/drm/imx/ipuv3-crtc.c linux-libre-4.9.185-gnu/drivers/gpu/drm/imx/ipuv3-crtc.c
--- linux-libre-4.9.184-gnu/drivers/gpu/drm/imx/ipuv3-crtc.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/gpu/drm/imx/ipuv3-crtc.c	2019-07-10 03:55:47.000000000 -0400
@@ -76,14 +76,14 @@ static void ipu_crtc_atomic_disable(stru
 	drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, false);
 	ipu_dc_disable(ipu);
 
+	drm_crtc_vblank_off(crtc);
+
 	spin_lock_irq(&crtc->dev->event_lock);
-	if (crtc->state->event) {
+	if (crtc->state->event && !crtc->state->active) {
 		drm_crtc_send_vblank_event(crtc, crtc->state->event);
 		crtc->state->event = NULL;
 	}
 	spin_unlock_irq(&crtc->dev->event_lock);
-
-	drm_crtc_vblank_off(crtc);
 }
 
 static void imx_drm_crtc_reset(struct drm_crtc *crtc)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/gpu/drm/mediatek/mtk_dsi.c linux-libre-4.9.185-gnu/drivers/gpu/drm/mediatek/mtk_dsi.c
--- linux-libre-4.9.184-gnu/drivers/gpu/drm/mediatek/mtk_dsi.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/gpu/drm/mediatek/mtk_dsi.c	2019-07-10 03:55:47.000000000 -0400
@@ -720,6 +720,8 @@ static void mtk_dsi_destroy_conn_enc(str
 	/* Skip connector cleanup if creation was delegated to the bridge */
 	if (dsi->conn.dev)
 		drm_connector_cleanup(&dsi->conn);
+	if (dsi->panel)
+		drm_panel_detach(dsi->panel);
 }
 
 static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/hwmon/pmbus/pmbus_core.c linux-libre-4.9.185-gnu/drivers/hwmon/pmbus/pmbus_core.c
--- linux-libre-4.9.184-gnu/drivers/hwmon/pmbus/pmbus_core.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/hwmon/pmbus/pmbus_core.c	2019-07-10 03:55:47.000000000 -0400
@@ -1028,14 +1028,15 @@ static int pmbus_add_sensor_attrs_one(st
 				      const struct pmbus_driver_info *info,
 				      const char *name,
 				      int index, int page,
-				      const struct pmbus_sensor_attr *attr)
+				      const struct pmbus_sensor_attr *attr,
+				      bool paged)
 {
 	struct pmbus_sensor *base;
 	int ret;
 
 	if (attr->label) {
 		ret = pmbus_add_label(data, name, index, attr->label,
-				      attr->paged ? page + 1 : 0);
+				      paged ? page + 1 : 0);
 		if (ret)
 			return ret;
 	}
@@ -1067,6 +1068,30 @@ static int pmbus_add_sensor_attrs_one(st
 	return 0;
 }
 
+static bool pmbus_sensor_is_paged(const struct pmbus_driver_info *info,
+				  const struct pmbus_sensor_attr *attr)
+{
+	int p;
+
+	if (attr->paged)
+		return true;
+
+	/*
+	 * Some attributes may be present on more than one page despite
+	 * not being marked with the paged attribute. If that is the case,
+	 * then treat the sensor as being paged and add the page suffix to the
+	 * attribute name.
+	 * We don't just add the paged attribute to all such attributes, in
+	 * order to maintain the un-suffixed labels in the case where the
+	 * attribute is only on page 0.
+	 */
+	for (p = 1; p < info->pages; p++) {
+		if (info->func[p] & attr->func)
+			return true;
+	}
+	return false;
+}
+
 static int pmbus_add_sensor_attrs(struct i2c_client *client,
 				  struct pmbus_data *data,
 				  const char *name,
@@ -1080,14 +1105,15 @@ static int pmbus_add_sensor_attrs(struct
 	index = 1;
 	for (i = 0; i < nattrs; i++) {
 		int page, pages;
+		bool paged = pmbus_sensor_is_paged(info, attrs);
 
-		pages = attrs->paged ? info->pages : 1;
+		pages = paged ? info->pages : 1;
 		for (page = 0; page < pages; page++) {
 			if (!(info->func[page] & attrs->func))
 				continue;
 			ret = pmbus_add_sensor_attrs_one(client, data, info,
 							 name, index, page,
-							 attrs);
+							 attrs, paged);
 			if (ret)
 				return ret;
 			index++;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/chip.c linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/chip.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/chip.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/chip.c	2019-07-10 03:55:47.000000000 -0400
@@ -9620,6 +9620,7 @@ void hfi1_quiet_serdes(struct hfi1_pport
 
 	/* disable the port */
 	clear_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
+	cancel_work_sync(&ppd->freeze_work);
 }
 
 static inline int init_cpu_counters(struct hfi1_devdata *dd)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/sdma.c linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/sdma.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/sdma.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/sdma.c	2019-07-10 03:55:47.000000000 -0400
@@ -410,10 +410,7 @@ static void sdma_flush(struct sdma_engin
 	sdma_flush_descq(sde);
 	spin_lock_irqsave(&sde->flushlist_lock, flags);
 	/* copy flush list */
-	list_for_each_entry_safe(txp, txp_next, &sde->flushlist, list) {
-		list_del_init(&txp->list);
-		list_add_tail(&txp->list, &flushlist);
-	}
+	list_splice_init(&sde->flushlist, &flushlist);
 	spin_unlock_irqrestore(&sde->flushlist_lock, flags);
 	/* flush from flush list */
 	list_for_each_entry_safe(txp, txp_next, &flushlist, list)
@@ -2406,7 +2403,7 @@ unlock_noconn:
 		wait->tx_count++;
 		wait->count += tx->num_desc;
 	}
-	schedule_work(&sde->flush_worker);
+	queue_work_on(sde->cpu, system_highpri_wq, &sde->flush_worker);
 	ret = -ECOMM;
 	goto unlock;
 nodesc:
@@ -2504,7 +2501,7 @@ unlock_noconn:
 		}
 	}
 	spin_unlock(&sde->flushlist_lock);
-	schedule_work(&sde->flush_worker);
+	queue_work_on(sde->cpu, system_highpri_wq, &sde->flush_worker);
 	ret = -ECOMM;
 	goto update_tail;
 nodesc:
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/user_sdma.c linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/user_sdma.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/user_sdma.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/user_sdma.c	2019-07-10 03:55:47.000000000 -0400
@@ -260,7 +260,6 @@ struct user_sdma_txreq {
 	struct list_head list;
 	struct user_sdma_request *req;
 	u16 flags;
-	unsigned busycount;
 	u64 seqnum;
 };
 
@@ -323,25 +322,22 @@ static int defer_packet_queue(
 	struct hfi1_user_sdma_pkt_q *pq =
 		container_of(wait, struct hfi1_user_sdma_pkt_q, busy);
 	struct hfi1_ibdev *dev = &pq->dd->verbs_dev;
-	struct user_sdma_txreq *tx =
-		container_of(txreq, struct user_sdma_txreq, txreq);
 
-	if (sdma_progress(sde, seq, txreq)) {
-		if (tx->busycount++ < MAX_DEFER_RETRY_COUNT)
-			goto eagain;
-	}
+	write_seqlock(&dev->iowait_lock);
+	if (sdma_progress(sde, seq, txreq))
+		goto eagain;
 	/*
 	 * We are assuming that if the list is enqueued somewhere, it
 	 * is to the dmawait list since that is the only place where
 	 * it is supposed to be enqueued.
 	 */
 	xchg(&pq->state, SDMA_PKT_Q_DEFERRED);
-	write_seqlock(&dev->iowait_lock);
 	if (list_empty(&pq->busy.list))
 		list_add_tail(&pq->busy.list, &sde->dmawait);
 	write_sequnlock(&dev->iowait_lock);
 	return -EBUSY;
 eagain:
+	write_sequnlock(&dev->iowait_lock);
 	return -EAGAIN;
 }
 
@@ -925,7 +921,6 @@ static int user_sdma_send_pkts(struct us
 
 		tx->flags = 0;
 		tx->req = req;
-		tx->busycount = 0;
 		INIT_LIST_HEAD(&tx->list);
 
 		if (req->seqnum == req->info.npkts - 1)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/verbs.c linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/verbs.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/verbs.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/verbs.c	2019-07-10 03:55:47.000000000 -0400
@@ -1344,8 +1344,6 @@ static void hfi1_fill_device_attr(struct
 	rdi->dparms.props.max_cq = hfi1_max_cqs;
 	rdi->dparms.props.max_ah = hfi1_max_ahs;
 	rdi->dparms.props.max_cqe = hfi1_max_cqes;
-	rdi->dparms.props.max_mr = rdi->lkey_table.max;
-	rdi->dparms.props.max_fmr = rdi->lkey_table.max;
 	rdi->dparms.props.max_map_per_fmr = 32767;
 	rdi->dparms.props.max_pd = hfi1_max_pds;
 	rdi->dparms.props.max_qp_rd_atom = HFI1_MAX_RDMA_ATOMIC;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.c linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.c	2019-07-10 03:55:47.000000000 -0400
@@ -100,7 +100,7 @@ struct verbs_txreq *__get_txreq(struct h
 	if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) {
 		struct hfi1_qp_priv *priv;
 
-		tx = kmem_cache_alloc(dev->verbs_txreq_cache, GFP_ATOMIC);
+		tx = kmem_cache_alloc(dev->verbs_txreq_cache, VERBS_TXREQ_GFP);
 		if (tx)
 			goto out;
 		priv = qp->priv;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.h linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.h
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/hfi1/verbs_txreq.h	2019-07-10 03:55:47.000000000 -0400
@@ -71,6 +71,7 @@ struct hfi1_ibdev;
 struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
 				struct rvt_qp *qp);
 
+#define VERBS_TXREQ_GFP (GFP_ATOMIC | __GFP_NOWARN)
 static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,
 					    struct rvt_qp *qp)
 	__must_hold(&qp->slock)
@@ -78,7 +79,7 @@ static inline struct verbs_txreq *get_tx
 	struct verbs_txreq *tx;
 	struct hfi1_qp_priv *priv = qp->priv;
 
-	tx = kmem_cache_alloc(dev->verbs_txreq_cache, GFP_ATOMIC);
+	tx = kmem_cache_alloc(dev->verbs_txreq_cache, VERBS_TXREQ_GFP);
 	if (unlikely(!tx)) {
 		/* call slow path to get the lock */
 		tx = __get_txreq(dev, qp);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/hw/qib/qib_verbs.c linux-libre-4.9.185-gnu/drivers/infiniband/hw/qib/qib_verbs.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/hw/qib/qib_verbs.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/hw/qib/qib_verbs.c	2019-07-10 03:55:47.000000000 -0400
@@ -1568,8 +1568,6 @@ static void qib_fill_device_attr(struct
 	rdi->dparms.props.max_cq = ib_qib_max_cqs;
 	rdi->dparms.props.max_cqe = ib_qib_max_cqes;
 	rdi->dparms.props.max_ah = ib_qib_max_ahs;
-	rdi->dparms.props.max_mr = rdi->lkey_table.max;
-	rdi->dparms.props.max_fmr = rdi->lkey_table.max;
 	rdi->dparms.props.max_map_per_fmr = 32767;
 	rdi->dparms.props.max_qp_rd_atom = QIB_MAX_RDMA_ATOMIC;
 	rdi->dparms.props.max_qp_init_rd_atom = 255;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/sw/rdmavt/mr.c linux-libre-4.9.185-gnu/drivers/infiniband/sw/rdmavt/mr.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/sw/rdmavt/mr.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/sw/rdmavt/mr.c	2019-07-10 03:55:47.000000000 -0400
@@ -94,6 +94,8 @@ int rvt_driver_mr_init(struct rvt_dev_in
 	for (i = 0; i < rdi->lkey_table.max; i++)
 		RCU_INIT_POINTER(rdi->lkey_table.table[i], NULL);
 
+	rdi->dparms.props.max_mr = rdi->lkey_table.max;
+	rdi->dparms.props.max_fmr = rdi->lkey_table.max;
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/infiniband/sw/rdmavt/qp.c linux-libre-4.9.185-gnu/drivers/infiniband/sw/rdmavt/qp.c
--- linux-libre-4.9.184-gnu/drivers/infiniband/sw/rdmavt/qp.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/infiniband/sw/rdmavt/qp.c	2019-07-10 03:55:47.000000000 -0400
@@ -370,7 +370,8 @@ static int alloc_qpn(struct rvt_dev_info
 			offset = qpt->incr | ((offset & 1) ^ 1);
 		}
 		/* there can be no set bits in low-order QoS bits */
-		WARN_ON(offset & (BIT(rdi->dparms.qos_shift) - 1));
+		WARN_ON(rdi->dparms.qos_shift > 1 &&
+			offset & ((BIT(rdi->dparms.qos_shift - 1) - 1) << 1));
 		qpn = mk_qpn(qpt, map, offset);
 	}
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/input/misc/uinput.c linux-libre-4.9.185-gnu/drivers/input/misc/uinput.c
--- linux-libre-4.9.184-gnu/drivers/input/misc/uinput.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/input/misc/uinput.c	2019-07-10 03:55:47.000000000 -0400
@@ -991,13 +991,31 @@ static long uinput_ioctl(struct file *fi
 
 #ifdef CONFIG_COMPAT
 
-#define UI_SET_PHYS_COMPAT	_IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t)
+/*
+ * These IOCTLs change their size and thus their numbers between
+ * 32 and 64 bits.
+ */
+#define UI_SET_PHYS_COMPAT		\
+	_IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t)
+#define UI_BEGIN_FF_UPLOAD_COMPAT	\
+	_IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload_compat)
+#define UI_END_FF_UPLOAD_COMPAT		\
+	_IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload_compat)
 
 static long uinput_compat_ioctl(struct file *file,
 				unsigned int cmd, unsigned long arg)
 {
-	if (cmd == UI_SET_PHYS_COMPAT)
+	switch (cmd) {
+	case UI_SET_PHYS_COMPAT:
 		cmd = UI_SET_PHYS;
+		break;
+	case UI_BEGIN_FF_UPLOAD_COMPAT:
+		cmd = UI_BEGIN_FF_UPLOAD;
+		break;
+	case UI_END_FF_UPLOAD_COMPAT:
+		cmd = UI_END_FF_UPLOAD;
+		break;
+	}
 
 	return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg));
 }
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/mfd/omap-usb-tll.c linux-libre-4.9.185-gnu/drivers/mfd/omap-usb-tll.c
--- linux-libre-4.9.184-gnu/drivers/mfd/omap-usb-tll.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/mfd/omap-usb-tll.c	2019-07-10 03:55:47.000000000 -0400
@@ -131,12 +131,12 @@ static inline u32 usbtll_read(void __iom
 	return readl_relaxed(base + reg);
 }
 
-static inline void usbtll_writeb(void __iomem *base, u8 reg, u8 val)
+static inline void usbtll_writeb(void __iomem *base, u32 reg, u8 val)
 {
 	writeb_relaxed(val, base + reg);
 }
 
-static inline u8 usbtll_readb(void __iomem *base, u8 reg)
+static inline u8 usbtll_readb(void __iomem *base, u32 reg)
 {
 	return readb_relaxed(base + reg);
 }
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/bonding/bond_main.c linux-libre-4.9.185-gnu/drivers/net/bonding/bond_main.c
--- linux-libre-4.9.184-gnu/drivers/net/bonding/bond_main.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/bonding/bond_main.c	2019-07-10 03:55:47.000000000 -0400
@@ -4241,12 +4241,12 @@ void bond_setup(struct net_device *bond_
 	bond_dev->features |= NETIF_F_NETNS_LOCAL;
 
 	bond_dev->hw_features = BOND_VLAN_FEATURES |
-				NETIF_F_HW_VLAN_CTAG_TX |
 				NETIF_F_HW_VLAN_CTAG_RX |
 				NETIF_F_HW_VLAN_CTAG_FILTER;
 
 	bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
 	bond_dev->features |= bond_dev->hw_features;
+	bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX;
 }
 
 /* Destroy a bonding device.
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/can/flexcan.c linux-libre-4.9.185-gnu/drivers/net/can/flexcan.c
--- linux-libre-4.9.184-gnu/drivers/net/can/flexcan.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/can/flexcan.c	2019-07-10 03:55:47.000000000 -0400
@@ -171,7 +171,7 @@
 #define FLEXCAN_MB_CNT_LENGTH(x)	(((x) & 0xf) << 16)
 #define FLEXCAN_MB_CNT_TIMESTAMP(x)	((x) & 0xffff)
 
-#define FLEXCAN_TIMEOUT_US		(50)
+#define FLEXCAN_TIMEOUT_US		(250)
 
 /* FLEXCAN hardware feature flags
  *
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/dsa/mv88e6xxx/chip.c linux-libre-4.9.185-gnu/drivers/net/dsa/mv88e6xxx/chip.c
--- linux-libre-4.9.184-gnu/drivers/net/dsa/mv88e6xxx/chip.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/dsa/mv88e6xxx/chip.c	2019-07-10 03:55:47.000000000 -0400
@@ -1742,7 +1742,7 @@ static int _mv88e6xxx_vtu_get(struct mv8
 	int err;
 
 	if (!vid)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	err = _mv88e6xxx_vtu_vid_write(chip, vid - 1);
 	if (err)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c linux-libre-4.9.185-gnu/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
--- linux-libre-4.9.184-gnu/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c	2019-07-10 03:55:47.000000000 -0400
@@ -367,6 +367,7 @@ static int __lb_setup(struct net_device
 static int __lb_up(struct net_device *ndev,
 		   enum hnae_loop loop_mode)
 {
+#define NIC_LB_TEST_WAIT_PHY_LINK_TIME 300
 	struct hns_nic_priv *priv = netdev_priv(ndev);
 	struct hnae_handle *h = priv->ae_handle;
 	int speed, duplex;
@@ -393,6 +394,9 @@ static int __lb_up(struct net_device *nd
 
 	h->dev->ops->adjust_link(h, speed, duplex);
 
+	/* wait adjust link done and phy ready */
+	msleep(NIC_LB_TEST_WAIT_PHY_LINK_TIME);
+
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/ethernet/mediatek/mtk_eth_soc.c linux-libre-4.9.185-gnu/drivers/net/ethernet/mediatek/mtk_eth_soc.c
--- linux-libre-4.9.184-gnu/drivers/net/ethernet/mediatek/mtk_eth_soc.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/ethernet/mediatek/mtk_eth_soc.c	2019-07-10 03:55:47.000000000 -0400
@@ -1700,6 +1700,7 @@ static void mtk_poll_controller(struct n
 
 static int mtk_start_dma(struct mtk_eth *eth)
 {
+	u32 rx_2b_offset = (NET_IP_ALIGN == 2) ? MTK_RX_2B_OFFSET : 0;
 	int err;
 
 	err = mtk_dma_init(eth);
@@ -1714,7 +1715,7 @@ static int mtk_start_dma(struct mtk_eth
 		MTK_QDMA_GLO_CFG);
 
 	mtk_w32(eth,
-		MTK_RX_DMA_EN | MTK_RX_2B_OFFSET |
+		MTK_RX_DMA_EN | rx_2b_offset |
 		MTK_RX_BT_32DWORDS | MTK_MULTI_EN,
 		MTK_PDMA_GLO_CFG);
 
@@ -2175,13 +2176,13 @@ static int mtk_get_rxnfc(struct net_devi
 
 	switch (cmd->cmd) {
 	case ETHTOOL_GRXRINGS:
-		if (dev->features & NETIF_F_LRO) {
+		if (dev->hw_features & NETIF_F_LRO) {
 			cmd->data = MTK_MAX_RX_RING_NUM;
 			ret = 0;
 		}
 		break;
 	case ETHTOOL_GRXCLSRLCNT:
-		if (dev->features & NETIF_F_LRO) {
+		if (dev->hw_features & NETIF_F_LRO) {
 			struct mtk_mac *mac = netdev_priv(dev);
 
 			cmd->rule_cnt = mac->hwlro_ip_cnt;
@@ -2189,11 +2190,11 @@ static int mtk_get_rxnfc(struct net_devi
 		}
 		break;
 	case ETHTOOL_GRXCLSRULE:
-		if (dev->features & NETIF_F_LRO)
+		if (dev->hw_features & NETIF_F_LRO)
 			ret = mtk_hwlro_get_fdir_entry(dev, cmd);
 		break;
 	case ETHTOOL_GRXCLSRLALL:
-		if (dev->features & NETIF_F_LRO)
+		if (dev->hw_features & NETIF_F_LRO)
 			ret = mtk_hwlro_get_fdir_all(dev, cmd,
 						     rule_locs);
 		break;
@@ -2210,11 +2211,11 @@ static int mtk_set_rxnfc(struct net_devi
 
 	switch (cmd->cmd) {
 	case ETHTOOL_SRXCLSRLINS:
-		if (dev->features & NETIF_F_LRO)
+		if (dev->hw_features & NETIF_F_LRO)
 			ret = mtk_hwlro_add_ipaddr(dev, cmd);
 		break;
 	case ETHTOOL_SRXCLSRLDEL:
-		if (dev->features & NETIF_F_LRO)
+		if (dev->hw_features & NETIF_F_LRO)
 			ret = mtk_hwlro_del_ipaddr(dev, cmd);
 		break;
 	default:
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c linux-libre-4.9.185-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
--- linux-libre-4.9.184-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c	2019-07-10 03:55:47.000000000 -0400
@@ -125,7 +125,7 @@ static int stmmac_adjust_systime(void __
 		 * programmed with (2^32 – <new_sec_value>)
 		 */
 		if (gmac4)
-			sec = (100000000ULL - sec);
+			sec = -sec;
 
 		value = readl(ioaddr + PTP_TCR);
 		if (value & PTP_TCR_TSCTRLSSR)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/team/team.c linux-libre-4.9.185-gnu/drivers/net/team/team.c
--- linux-libre-4.9.184-gnu/drivers/net/team/team.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/team/team.c	2019-07-10 03:55:47.000000000 -0400
@@ -2136,12 +2136,12 @@ static void team_setup(struct net_device
 	dev->features |= NETIF_F_NETNS_LOCAL;
 
 	dev->hw_features = TEAM_VLAN_FEATURES |
-			   NETIF_F_HW_VLAN_CTAG_TX |
 			   NETIF_F_HW_VLAN_CTAG_RX |
 			   NETIF_F_HW_VLAN_CTAG_FILTER;
 
 	dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
 	dev->features |= dev->hw_features;
+	dev->features |= NETIF_F_HW_VLAN_CTAG_TX;
 }
 
 static int team_newlink(struct net *src_net, struct net_device *dev,
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/net/tun.c linux-libre-4.9.185-gnu/drivers/net/tun.c
--- linux-libre-4.9.184-gnu/drivers/net/tun.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/net/tun.c	2019-07-10 03:55:47.000000000 -0400
@@ -828,18 +828,8 @@ static void tun_net_uninit(struct net_de
 /* Net device open. */
 static int tun_net_open(struct net_device *dev)
 {
-	struct tun_struct *tun = netdev_priv(dev);
-	int i;
-
 	netif_tx_start_all_queues(dev);
 
-	for (i = 0; i < tun->numqueues; i++) {
-		struct tun_file *tfile;
-
-		tfile = rtnl_dereference(tun->tfiles[i]);
-		tfile->socket.sk->sk_write_space(tfile->socket.sk);
-	}
-
 	return 0;
 }
 
@@ -2534,6 +2524,7 @@ static int tun_device_event(struct notif
 {
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 	struct tun_struct *tun = netdev_priv(dev);
+	int i;
 
 	if (dev->rtnl_link_ops != &tun_link_ops)
 		return NOTIFY_DONE;
@@ -2543,6 +2534,14 @@ static int tun_device_event(struct notif
 		if (tun_queue_resize(tun))
 			return NOTIFY_BAD;
 		break;
+	case NETDEV_UP:
+		for (i = 0; i < tun->numqueues; i++) {
+			struct tun_file *tfile;
+
+			tfile = rtnl_dereference(tun->tfiles[i]);
+			tfile->socket.sk->sk_write_space(tfile->socket.sk);
+		}
+		break;
 	default:
 		break;
 	}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/nvme/host/core.c linux-libre-4.9.185-gnu/drivers/nvme/host/core.c
--- linux-libre-4.9.184-gnu/drivers/nvme/host/core.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/nvme/host/core.c	2019-07-10 03:55:47.000000000 -0400
@@ -1765,7 +1765,8 @@ static int nvme_scan_ns_list(struct nvme
 {
 	struct nvme_ns *ns;
 	__le32 *ns_list;
-	unsigned i, j, nsid, prev = 0, num_lists = DIV_ROUND_UP(nn, 1024);
+	unsigned i, j, nsid, prev = 0;
+	unsigned num_lists = DIV_ROUND_UP_ULL((u64)nn, 1024);
 	int ret = 0;
 
 	ns_list = kzalloc(0x1000, GFP_KERNEL);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/parport/share.c linux-libre-4.9.185-gnu/drivers/parport/share.c
--- linux-libre-4.9.184-gnu/drivers/parport/share.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/parport/share.c	2019-07-10 03:55:47.000000000 -0400
@@ -895,6 +895,7 @@ parport_register_dev_model(struct parpor
 	par_dev->devmodel = true;
 	ret = device_register(&par_dev->dev);
 	if (ret) {
+		kfree(par_dev->state);
 		put_device(&par_dev->dev);
 		goto err_put_port;
 	}
@@ -912,6 +913,7 @@ parport_register_dev_model(struct parpor
 			spin_unlock(&port->physport->pardevice_lock);
 			pr_debug("%s: cannot grant exclusive access for device %s\n",
 				 port->name, name);
+			kfree(par_dev->state);
 			device_unregister(&par_dev->dev);
 			goto err_put_port;
 		}
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/s390/net/qeth_l2_main.c linux-libre-4.9.185-gnu/drivers/s390/net/qeth_l2_main.c
--- linux-libre-4.9.184-gnu/drivers/s390/net/qeth_l2_main.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/s390/net/qeth_l2_main.c	2019-07-10 03:55:47.000000000 -0400
@@ -2124,7 +2124,7 @@ static void qeth_bridgeport_an_set_cb(vo
 
 	l2entry = (struct qdio_brinfo_entry_l2 *)entry;
 	code = IPA_ADDR_CHANGE_CODE_MACADDR;
-	if (l2entry->addr_lnid.lnid)
+	if (l2entry->addr_lnid.lnid < VLAN_N_VID)
 		code |= IPA_ADDR_CHANGE_CODE_VLANID;
 	qeth_bridge_emit_host_event(card, anev_reg_unreg, code,
 		(struct net_if_token *)&l2entry->nit,
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/scsi/hpsa.c linux-libre-4.9.185-gnu/drivers/scsi/hpsa.c
--- linux-libre-4.9.184-gnu/drivers/scsi/hpsa.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/scsi/hpsa.c	2019-07-10 03:55:47.000000000 -0400
@@ -4815,7 +4815,7 @@ static int hpsa_scsi_ioaccel2_queue_comm
 			curr_sg->reserved[0] = 0;
 			curr_sg->reserved[1] = 0;
 			curr_sg->reserved[2] = 0;
-			curr_sg->chain_indicator = 0x80;
+			curr_sg->chain_indicator = IOACCEL2_CHAIN;
 
 			curr_sg = h->ioaccel2_cmd_sg_list[c->cmdindex];
 		}
@@ -4832,6 +4832,11 @@ static int hpsa_scsi_ioaccel2_queue_comm
 			curr_sg++;
 		}
 
+		/*
+		 * Set the last s/g element bit
+		 */
+		(curr_sg - 1)->chain_indicator = IOACCEL2_LAST_SG;
+
 		switch (cmd->sc_data_direction) {
 		case DMA_TO_DEVICE:
 			cp->direction &= ~IOACCEL2_DIRECTION_MASK;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/scsi/hpsa_cmd.h linux-libre-4.9.185-gnu/drivers/scsi/hpsa_cmd.h
--- linux-libre-4.9.184-gnu/drivers/scsi/hpsa_cmd.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/scsi/hpsa_cmd.h	2019-07-10 03:55:47.000000000 -0400
@@ -516,6 +516,7 @@ struct ioaccel2_sg_element {
 	u8 reserved[3];
 	u8 chain_indicator;
 #define IOACCEL2_CHAIN 0x80
+#define IOACCEL2_LAST_SG 0x40
 };
 
 /*
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/scsi/ufs/ufshcd.c linux-libre-4.9.185-gnu/drivers/scsi/ufs/ufshcd.c
--- linux-libre-4.9.184-gnu/drivers/scsi/ufs/ufshcd.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/scsi/ufs/ufshcd.c	2019-07-10 03:55:47.000000000 -0400
@@ -941,7 +941,8 @@ int ufshcd_copy_query_response(struct uf
 	memcpy(&query_res->upiu_res, &lrbp->ucd_rsp_ptr->qr, QUERY_OSF_SIZE);
 
 	/* Get the descriptor */
-	if (lrbp->ucd_rsp_ptr->qr.opcode == UPIU_QUERY_OPCODE_READ_DESC) {
+	if (hba->dev_cmd.query.descriptor &&
+	    lrbp->ucd_rsp_ptr->qr.opcode == UPIU_QUERY_OPCODE_READ_DESC) {
 		u8 *descp = (u8 *)lrbp->ucd_rsp_ptr +
 				GENERAL_UPIU_REQUEST_SIZE;
 		u16 resp_len;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/scsi/ufs/ufshcd-pltfrm.c linux-libre-4.9.185-gnu/drivers/scsi/ufs/ufshcd-pltfrm.c
--- linux-libre-4.9.184-gnu/drivers/scsi/ufs/ufshcd-pltfrm.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/scsi/ufs/ufshcd-pltfrm.c	2019-07-10 03:55:47.000000000 -0400
@@ -342,24 +342,21 @@ int ufshcd_pltfrm_init(struct platform_d
 		goto dealloc_host;
 	}
 
-	pm_runtime_set_active(&pdev->dev);
-	pm_runtime_enable(&pdev->dev);
-
 	ufshcd_init_lanes_per_dir(hba);
 
 	err = ufshcd_init(hba, mmio_base, irq);
 	if (err) {
 		dev_err(dev, "Initialization failed\n");
-		goto out_disable_rpm;
+		goto dealloc_host;
 	}
 
 	platform_set_drvdata(pdev, hba);
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	return 0;
 
-out_disable_rpm:
-	pm_runtime_disable(&pdev->dev);
-	pm_runtime_set_suspended(&pdev->dev);
 dealloc_host:
 	ufshcd_dealloc_host(hba);
 out:
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/scsi/vmw_pvscsi.c linux-libre-4.9.185-gnu/drivers/scsi/vmw_pvscsi.c
--- linux-libre-4.9.184-gnu/drivers/scsi/vmw_pvscsi.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/scsi/vmw_pvscsi.c	2019-07-10 03:55:47.000000000 -0400
@@ -766,6 +766,7 @@ static int pvscsi_queue_lck(struct scsi_
 	struct pvscsi_adapter *adapter = shost_priv(host);
 	struct pvscsi_ctx *ctx;
 	unsigned long flags;
+	unsigned char op;
 
 	spin_lock_irqsave(&adapter->hw_lock, flags);
 
@@ -778,13 +779,14 @@ static int pvscsi_queue_lck(struct scsi_
 	}
 
 	cmd->scsi_done = done;
+	op = cmd->cmnd[0];
 
 	dev_dbg(&cmd->device->sdev_gendev,
-		"queued cmd %p, ctx %p, op=%x\n", cmd, ctx, cmd->cmnd[0]);
+		"queued cmd %p, ctx %p, op=%x\n", cmd, ctx, op);
 
 	spin_unlock_irqrestore(&adapter->hw_lock, flags);
 
-	pvscsi_kick_io(adapter, cmd->cmnd[0]);
+	pvscsi_kick_io(adapter, op);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/spi/spi-bitbang.c linux-libre-4.9.185-gnu/drivers/spi/spi-bitbang.c
--- linux-libre-4.9.184-gnu/drivers/spi/spi-bitbang.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/spi/spi-bitbang.c	2019-07-10 03:55:47.000000000 -0400
@@ -392,7 +392,7 @@ int spi_bitbang_start(struct spi_bitbang
 	if (ret)
 		spi_master_put(master);
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(spi_bitbang_start);
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/tty/rocket.c linux-libre-4.9.185-gnu/drivers/tty/rocket.c
--- linux-libre-4.9.184-gnu/drivers/tty/rocket.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/tty/rocket.c	2019-07-10 03:55:47.000000000 -0400
@@ -279,7 +279,7 @@ MODULE_PARM_DESC(pc104_3, "set interface
 module_param_array(pc104_4, ulong, NULL, 0);
 MODULE_PARM_DESC(pc104_4, "set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,...");
 
-static int rp_init(void);
+static int __init rp_init(void);
 static void rp_cleanup_module(void);
 
 module_init(rp_init);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/usb/chipidea/udc.c linux-libre-4.9.185-gnu/drivers/usb/chipidea/udc.c
--- linux-libre-4.9.184-gnu/drivers/usb/chipidea/udc.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/usb/chipidea/udc.c	2019-07-10 03:55:47.000000000 -0400
@@ -1621,6 +1621,25 @@ static int ci_udc_pullup(struct usb_gadg
 static int ci_udc_start(struct usb_gadget *gadget,
 			 struct usb_gadget_driver *driver);
 static int ci_udc_stop(struct usb_gadget *gadget);
+
+/* Match ISOC IN from the highest endpoint */
+static struct usb_ep *ci_udc_match_ep(struct usb_gadget *gadget,
+			      struct usb_endpoint_descriptor *desc,
+			      struct usb_ss_ep_comp_descriptor *comp_desc)
+{
+	struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget);
+	struct usb_ep *ep;
+
+	if (usb_endpoint_xfer_isoc(desc) && usb_endpoint_dir_in(desc)) {
+		list_for_each_entry_reverse(ep, &ci->gadget.ep_list, ep_list) {
+			if (ep->caps.dir_in && !ep->claimed)
+				return ep;
+		}
+	}
+
+	return NULL;
+}
+
 /**
  * Device operations part of the API to the USB controller hardware,
  * which don't involve endpoints (or i/o)
@@ -1634,6 +1653,7 @@ static const struct usb_gadget_ops usb_g
 	.vbus_draw	= ci_udc_vbus_draw,
 	.udc_start	= ci_udc_start,
 	.udc_stop	= ci_udc_stop,
+	.match_ep 	= ci_udc_match_ep,
 };
 
 static int init_eps(struct ci_hdrc *ci)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/usb/gadget/udc/fusb300_udc.c linux-libre-4.9.185-gnu/drivers/usb/gadget/udc/fusb300_udc.c
--- linux-libre-4.9.184-gnu/drivers/usb/gadget/udc/fusb300_udc.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/usb/gadget/udc/fusb300_udc.c	2019-07-10 03:55:47.000000000 -0400
@@ -1345,12 +1345,15 @@ static const struct usb_gadget_ops fusb3
 static int fusb300_remove(struct platform_device *pdev)
 {
 	struct fusb300 *fusb300 = platform_get_drvdata(pdev);
+	int i;
 
 	usb_del_gadget_udc(&fusb300->gadget);
 	iounmap(fusb300->reg);
 	free_irq(platform_get_irq(pdev, 0), fusb300);
 
 	fusb300_free_request(&fusb300->ep[0]->ep, fusb300->ep0_req);
+	for (i = 0; i < FUSB300_MAX_NUM_EP; i++)
+		kfree(fusb300->ep[i]);
 	kfree(fusb300);
 
 	return 0;
@@ -1494,6 +1497,8 @@ clean_up:
 		if (fusb300->ep0_req)
 			fusb300_free_request(&fusb300->ep[0]->ep,
 				fusb300->ep0_req);
+		for (i = 0; i < FUSB300_MAX_NUM_EP; i++)
+			kfree(fusb300->ep[i]);
 		kfree(fusb300);
 	}
 	if (reg)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/drivers/usb/gadget/udc/lpc32xx_udc.c linux-libre-4.9.185-gnu/drivers/usb/gadget/udc/lpc32xx_udc.c
--- linux-libre-4.9.184-gnu/drivers/usb/gadget/udc/lpc32xx_udc.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/drivers/usb/gadget/udc/lpc32xx_udc.c	2019-07-10 03:55:47.000000000 -0400
@@ -935,8 +935,7 @@ static struct lpc32xx_usbd_dd_gad *udc_d
 	dma_addr_t			dma;
 	struct lpc32xx_usbd_dd_gad	*dd;
 
-	dd = (struct lpc32xx_usbd_dd_gad *) dma_pool_alloc(
-			udc->dd_cache, (GFP_KERNEL | GFP_DMA), &dma);
+	dd = dma_pool_alloc(udc->dd_cache, GFP_ATOMIC | GFP_DMA, &dma);
 	if (dd)
 		dd->this_dma = dma;
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/9p/acl.c linux-libre-4.9.185-gnu/fs/9p/acl.c
--- linux-libre-4.9.184-gnu/fs/9p/acl.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/9p/acl.c	2019-07-10 03:55:47.000000000 -0400
@@ -276,7 +276,7 @@ static int v9fs_xattr_set_acl(const stru
 	switch (handler->flags) {
 	case ACL_TYPE_ACCESS:
 		if (acl) {
-			struct iattr iattr;
+			struct iattr iattr = { 0 };
 			struct posix_acl *old_acl = acl;
 
 			retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/binfmt_flat.c linux-libre-4.9.185-gnu/fs/binfmt_flat.c
--- linux-libre-4.9.184-gnu/fs/binfmt_flat.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/binfmt_flat.c	2019-07-10 03:55:47.000000000 -0400
@@ -859,9 +859,14 @@ err:
 
 static int load_flat_shared_library(int id, struct lib_info *libs)
 {
+	/*
+	 * This is a fake bprm struct; only the members "buf", "file" and
+	 * "filename" are actually used.
+	 */
 	struct linux_binprm bprm;
 	int res;
 	char buf[16];
+	loff_t pos = 0;
 
 	memset(&bprm, 0, sizeof(bprm));
 
@@ -875,25 +880,11 @@ static int load_flat_shared_library(int
 	if (IS_ERR(bprm.file))
 		return res;
 
-	bprm.cred = prepare_exec_creds();
-	res = -ENOMEM;
-	if (!bprm.cred)
-		goto out;
-
-	/* We don't really care about recalculating credentials at this point
-	 * as we're past the point of no return and are dealing with shared
-	 * libraries.
-	 */
-	bprm.cred_prepared = 1;
-
-	res = prepare_binprm(&bprm);
+	res = kernel_read(bprm.file, pos, bprm.buf, BINPRM_BUF_SIZE);
 
-	if (!res)
+	if (res >= 0)
 		res = load_flat_file(&bprm, libs, id, NULL);
 
-	abort_creds(bprm.cred);
-
-out:
 	allow_write_access(bprm.file);
 	fput(bprm.file);
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/btrfs/dev-replace.c linux-libre-4.9.185-gnu/fs/btrfs/dev-replace.c
--- linux-libre-4.9.184-gnu/fs/btrfs/dev-replace.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/btrfs/dev-replace.c	2019-07-10 03:55:47.000000000 -0400
@@ -511,18 +511,27 @@ static int btrfs_dev_replace_finishing(s
 	}
 	btrfs_wait_ordered_roots(root->fs_info, -1, 0, (u64)-1);
 
-	trans = btrfs_start_transaction(root, 0);
-	if (IS_ERR(trans)) {
-		mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
-		return PTR_ERR(trans);
+	while (1) {
+		trans = btrfs_start_transaction(root, 0);
+		if (IS_ERR(trans)) {
+			mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
+			return PTR_ERR(trans);
+		}
+		ret = btrfs_commit_transaction(trans, root);
+		WARN_ON(ret);
+		mutex_lock(&uuid_mutex);
+		/* keep away write_all_supers() during the finishing procedure */
+		mutex_lock(&root->fs_info->fs_devices->device_list_mutex);
+		mutex_lock(&root->fs_info->chunk_mutex);
+		if (src_device->has_pending_chunks) {
+			mutex_unlock(&root->fs_info->chunk_mutex);
+			mutex_unlock(&root->fs_info->fs_devices->device_list_mutex);
+			mutex_unlock(&uuid_mutex);
+		} else {
+			break;
+		}
 	}
-	ret = btrfs_commit_transaction(trans, root);
-	WARN_ON(ret);
 
-	mutex_lock(&uuid_mutex);
-	/* keep away write_all_supers() during the finishing procedure */
-	mutex_lock(&root->fs_info->fs_devices->device_list_mutex);
-	mutex_lock(&root->fs_info->chunk_mutex);
 	btrfs_dev_replace_lock(dev_replace, 1);
 	dev_replace->replace_state =
 		scrub_ret ? BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/btrfs/reada.c linux-libre-4.9.185-gnu/fs/btrfs/reada.c
--- linux-libre-4.9.184-gnu/fs/btrfs/reada.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/btrfs/reada.c	2019-07-10 03:55:47.000000000 -0400
@@ -759,6 +759,7 @@ static void __reada_start_machine(struct
 	u64 total = 0;
 	int i;
 
+again:
 	do {
 		enqueued = 0;
 		mutex_lock(&fs_devices->device_list_mutex);
@@ -771,6 +772,10 @@ static void __reada_start_machine(struct
 		mutex_unlock(&fs_devices->device_list_mutex);
 		total += enqueued;
 	} while (enqueued && total < 10000);
+	if (fs_devices->seed) {
+		fs_devices = fs_devices->seed;
+		goto again;
+	}
 
 	if (enqueued == 0)
 		return;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/btrfs/volumes.c linux-libre-4.9.185-gnu/fs/btrfs/volumes.c
--- linux-libre-4.9.184-gnu/fs/btrfs/volumes.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/btrfs/volumes.c	2019-07-10 03:55:47.000000000 -0400
@@ -4876,6 +4876,7 @@ static int __btrfs_alloc_chunk(struct bt
 	for (i = 0; i < map->num_stripes; i++) {
 		num_bytes = map->stripes[i].dev->bytes_used + stripe_size;
 		btrfs_device_set_bytes_used(map->stripes[i].dev, num_bytes);
+		map->stripes[i].dev->has_pending_chunks = true;
 	}
 
 	spin_lock(&extent_root->fs_info->free_chunk_lock);
@@ -7250,6 +7251,7 @@ void btrfs_update_commit_device_bytes_us
 		for (i = 0; i < map->num_stripes; i++) {
 			dev = map->stripes[i].dev;
 			dev->commit_bytes_used = dev->bytes_used;
+			dev->has_pending_chunks = false;
 		}
 	}
 	unlock_chunks(root);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/btrfs/volumes.h linux-libre-4.9.185-gnu/fs/btrfs/volumes.h
--- linux-libre-4.9.184-gnu/fs/btrfs/volumes.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/btrfs/volumes.h	2019-07-10 03:55:47.000000000 -0400
@@ -62,6 +62,11 @@ struct btrfs_device {
 
 	spinlock_t io_lock ____cacheline_aligned;
 	int running_pending;
+	/* When true means this device has pending chunk alloc in
+	 * current transaction. Protected by chunk_mutex.
+	 */
+	bool has_pending_chunks;
+
 	/* regular prio bios */
 	struct btrfs_pending_bios pending_bios;
 	/* WRITE_SYNC bios */
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/nfs/flexfilelayout/flexfilelayoutdev.c linux-libre-4.9.185-gnu/fs/nfs/flexfilelayout/flexfilelayoutdev.c
--- linux-libre-4.9.184-gnu/fs/nfs/flexfilelayout/flexfilelayoutdev.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/nfs/flexfilelayout/flexfilelayoutdev.c	2019-07-10 03:55:47.000000000 -0400
@@ -17,7 +17,7 @@
 
 #define NFSDBG_FACILITY		NFSDBG_PNFS_LD
 
-static unsigned int dataserver_timeo = NFS_DEF_TCP_RETRANS;
+static unsigned int dataserver_timeo = NFS_DEF_TCP_TIMEO;
 static unsigned int dataserver_retrans;
 
 void nfs4_ff_layout_put_deviceid(struct nfs4_ff_layout_ds *mirror_ds)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/fs/proc/array.c linux-libre-4.9.185-gnu/fs/proc/array.c
--- linux-libre-4.9.184-gnu/fs/proc/array.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/fs/proc/array.c	2019-07-10 03:55:47.000000000 -0400
@@ -448,7 +448,7 @@ static int do_task_stat(struct seq_file
 		 * a program is not able to use ptrace(2) in that case. It is
 		 * safe because the task has stopped executing permanently.
 		 */
-		if (permitted && (task->flags & PF_DUMPCORE)) {
+		if (permitted && (task->flags & (PF_EXITING|PF_DUMPCORE))) {
 			if (try_get_task_stack(task)) {
 				eip = KSTK_EIP(task);
 				esp = KSTK_ESP(task);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/include/asm-generic/bug.h linux-libre-4.9.185-gnu/include/asm-generic/bug.h
--- linux-libre-4.9.184-gnu/include/asm-generic/bug.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/include/asm-generic/bug.h	2019-07-10 03:55:47.000000000 -0400
@@ -47,6 +47,7 @@ struct bug_entry {
 #ifndef HAVE_ARCH_BUG
 #define BUG() do { \
 	printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
+	barrier_before_unreachable(); \
 	panic("BUG!"); \
 } while (0)
 #endif
diff -druNp --no-dereference linux-libre-4.9.184-gnu/include/linux/compiler-gcc.h linux-libre-4.9.185-gnu/include/linux/compiler-gcc.h
--- linux-libre-4.9.184-gnu/include/linux/compiler-gcc.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/include/linux/compiler-gcc.h	2019-07-10 03:55:47.000000000 -0400
@@ -234,6 +234,15 @@
 #endif
 
 /*
+ * calling noreturn functions, __builtin_unreachable() and __builtin_trap()
+ * confuse the stack allocation in gcc, leading to overly large stack
+ * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
+ *
+ * Adding an empty inline assembly before it works around the problem
+ */
+#define barrier_before_unreachable() asm volatile("")
+
+/*
  * Mark a position in code as unreachable.  This can be used to
  * suppress control flow warnings after asm blocks that transfer
  * control elsewhere.
@@ -243,7 +252,11 @@
  * unreleased.  Really, we need to have autoconf for the kernel.
  */
 #define unreachable() \
-	do { annotate_unreachable(); __builtin_unreachable(); } while (0)
+	do {					\
+		annotate_unreachable();		\
+		barrier_before_unreachable();	\
+		__builtin_unreachable();	\
+	} while (0)
 
 /* Mark a function definition as prohibited from being cloned. */
 #define __noclone	__attribute__((__noclone__, __optimize__("no-tracer")))
diff -druNp --no-dereference linux-libre-4.9.184-gnu/include/linux/compiler.h linux-libre-4.9.185-gnu/include/linux/compiler.h
--- linux-libre-4.9.184-gnu/include/linux/compiler.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/include/linux/compiler.h	2019-07-10 03:55:47.000000000 -0400
@@ -177,6 +177,11 @@ void ftrace_likely_update(struct ftrace_
 # define barrier_data(ptr) barrier()
 #endif
 
+/* workaround for GCC PR82365 if needed */
+#ifndef barrier_before_unreachable
+# define barrier_before_unreachable() do { } while (0)
+#endif
+
 /* Unreachable code */
 #ifndef unreachable
 # define unreachable() do { } while (1)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/include/net/bluetooth/hci_core.h linux-libre-4.9.185-gnu/include/net/bluetooth/hci_core.h
--- linux-libre-4.9.184-gnu/include/net/bluetooth/hci_core.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/include/net/bluetooth/hci_core.h	2019-07-10 03:55:47.000000000 -0400
@@ -176,6 +176,9 @@ struct adv_info {
 
 #define HCI_MAX_SHORT_NAME_LENGTH	10
 
+/* Min encryption key size to match with SMP */
+#define HCI_MIN_ENC_KEY_SIZE		7
+
 /* Default LE RPA expiry time, 15 minutes */
 #define HCI_DEFAULT_RPA_TIMEOUT		(15 * 60)
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/kernel/cpu.c linux-libre-4.9.185-gnu/kernel/cpu.c
--- linux-libre-4.9.184-gnu/kernel/cpu.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/kernel/cpu.c	2019-07-10 03:55:47.000000000 -0400
@@ -2245,6 +2245,9 @@ static int __init mitigations_parse_cmdl
 		cpu_mitigations = CPU_MITIGATIONS_AUTO;
 	else if (!strcmp(arg, "auto,nosmt"))
 		cpu_mitigations = CPU_MITIGATIONS_AUTO_NOSMT;
+	else
+		pr_crit("Unsupported mitigations=%s, system may still be vulnerable\n",
+			arg);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.9.184-gnu/kernel/ptrace.c linux-libre-4.9.185-gnu/kernel/ptrace.c
--- linux-libre-4.9.184-gnu/kernel/ptrace.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/kernel/ptrace.c	2019-07-10 03:55:47.000000000 -0400
@@ -74,9 +74,7 @@ void __ptrace_link(struct task_struct *c
  */
 static void ptrace_link(struct task_struct *child, struct task_struct *new_parent)
 {
-	rcu_read_lock();
-	__ptrace_link(child, new_parent, __task_cred(new_parent));
-	rcu_read_unlock();
+	__ptrace_link(child, new_parent, current_cred());
 }
 
 /**
diff -druNp --no-dereference linux-libre-4.9.184-gnu/kernel/trace/trace.c linux-libre-4.9.185-gnu/kernel/trace/trace.c
--- linux-libre-4.9.184-gnu/kernel/trace/trace.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/kernel/trace/trace.c	2019-07-10 03:55:47.000000000 -0400
@@ -7613,12 +7613,8 @@ void ftrace_dump(enum ftrace_dump_mode o
 
 		cnt++;
 
-		/* reset all but tr, trace, and overruns */
-		memset(&iter.seq, 0,
-		       sizeof(struct trace_iterator) -
-		       offsetof(struct trace_iterator, seq));
+		trace_iterator_reset(&iter);
 		iter.iter_flags |= TRACE_FILE_LAT_FMT;
-		iter.pos = -1;
 
 		if (trace_find_next_entry_inc(&iter) != NULL) {
 			int ret;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/kernel/trace/trace.h linux-libre-4.9.185-gnu/kernel/trace/trace.h
--- linux-libre-4.9.184-gnu/kernel/trace/trace.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/kernel/trace/trace.h	2019-07-10 03:55:47.000000000 -0400
@@ -1673,4 +1673,22 @@ static inline void trace_event_enum_upda
 
 extern struct trace_iterator *tracepoint_print_iter;
 
+/*
+ * Reset the state of the trace_iterator so that it can read consumed data.
+ * Normally, the trace_iterator is used for reading the data when it is not
+ * consumed, and must retain state.
+ */
+static __always_inline void trace_iterator_reset(struct trace_iterator *iter)
+{
+	const size_t offset = offsetof(struct trace_iterator, seq);
+
+	/*
+	 * Keep gcc from complaining about overwriting more than just one
+	 * member in the structure.
+	 */
+	memset((char *)iter + offset, 0, sizeof(struct trace_iterator) - offset);
+
+	iter->pos = -1;
+}
+
 #endif /* _LINUX_KERNEL_TRACE_H */
diff -druNp --no-dereference linux-libre-4.9.184-gnu/kernel/trace/trace_kdb.c linux-libre-4.9.185-gnu/kernel/trace/trace_kdb.c
--- linux-libre-4.9.184-gnu/kernel/trace/trace_kdb.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/kernel/trace/trace_kdb.c	2019-07-10 03:55:47.000000000 -0400
@@ -40,12 +40,8 @@ static void ftrace_dump_buf(int skip_lin
 
 	kdb_printf("Dumping ftrace buffer:\n");
 
-	/* reset all but tr, trace, and overruns */
-	memset(&iter.seq, 0,
-		   sizeof(struct trace_iterator) -
-		   offsetof(struct trace_iterator, seq));
+	trace_iterator_reset(&iter);
 	iter.iter_flags |= TRACE_FILE_LAT_FMT;
-	iter.pos = -1;
 
 	if (cpu_file == RING_BUFFER_ALL_CPUS) {
 		for_each_tracing_cpu(cpu) {
diff -druNp --no-dereference linux-libre-4.9.184-gnu/lib/mpi/mpi-pow.c linux-libre-4.9.185-gnu/lib/mpi/mpi-pow.c
--- linux-libre-4.9.184-gnu/lib/mpi/mpi-pow.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/lib/mpi/mpi-pow.c	2019-07-10 03:55:47.000000000 -0400
@@ -37,6 +37,7 @@
 int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)
 {
 	mpi_ptr_t mp_marker = NULL, bp_marker = NULL, ep_marker = NULL;
+	struct karatsuba_ctx karactx = {};
 	mpi_ptr_t xp_marker = NULL;
 	mpi_ptr_t tspace = NULL;
 	mpi_ptr_t rp, ep, mp, bp;
@@ -164,13 +165,11 @@ int mpi_powm(MPI res, MPI base, MPI exp,
 		int c;
 		mpi_limb_t e;
 		mpi_limb_t carry_limb;
-		struct karatsuba_ctx karactx;
 
 		xp = xp_marker = mpi_alloc_limb_space(2 * (msize + 1));
 		if (!xp)
 			goto enomem;
 
-		memset(&karactx, 0, sizeof karactx);
 		negative_result = (ep[0] & 1) && base->sign;
 
 		i = esize - 1;
@@ -295,8 +294,6 @@ int mpi_powm(MPI res, MPI base, MPI exp,
 		if (mod_shift_cnt)
 			mpihelp_rshift(rp, rp, rsize, mod_shift_cnt);
 		MPN_NORMALIZE(rp, rsize);
-
-		mpihelp_release_karatsuba_ctx(&karactx);
 	}
 
 	if (negative_result && rsize) {
@@ -313,6 +310,7 @@ int mpi_powm(MPI res, MPI base, MPI exp,
 leave:
 	rc = 0;
 enomem:
+	mpihelp_release_karatsuba_ctx(&karactx);
 	if (assign_rp)
 		mpi_assign_limb_space(res, rp, size);
 	if (mp_marker)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/Makefile linux-libre-4.9.185-gnu/Makefile
--- linux-libre-4.9.184-gnu/Makefile	2019-06-26 22:01:42.000000000 -0400
+++ linux-libre-4.9.185-gnu/Makefile	2019-07-10 18:41:31.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 184
+SUBLEVEL = 185
 EXTRAVERSION = -gnu
 NAME = Roaring Lionus
 
@@ -647,6 +647,7 @@ KBUILD_CFLAGS	+= $(call cc-disable-warni
 KBUILD_CFLAGS	+= $(call cc-disable-warning, format-truncation)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, int-in-bool-context)
+KBUILD_CFLAGS	+= $(call cc-disable-warning, address-of-packed-member)
 KBUILD_CFLAGS	+= $(call cc-disable-warning, attribute-alias)
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
@@ -718,7 +719,6 @@ ifeq ($(cc-name),clang)
 KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
 KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
-KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
 # Quiet clang warning: comparison of unsigned expression < 0 is always false
 KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
diff -druNp --no-dereference linux-libre-4.9.184-gnu/mm/mlock.c linux-libre-4.9.185-gnu/mm/mlock.c
--- linux-libre-4.9.184-gnu/mm/mlock.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/mm/mlock.c	2019-07-10 03:55:47.000000000 -0400
@@ -630,11 +630,11 @@ static int apply_vma_lock_flags(unsigned
  * is also counted.
  * Return value: previously mlocked page counts
  */
-static int count_mm_mlocked_page_nr(struct mm_struct *mm,
+static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm,
 		unsigned long start, size_t len)
 {
 	struct vm_area_struct *vma;
-	int count = 0;
+	unsigned long count = 0;
 
 	if (mm == NULL)
 		mm = current->mm;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/mm/page_idle.c linux-libre-4.9.185-gnu/mm/page_idle.c
--- linux-libre-4.9.184-gnu/mm/page_idle.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/mm/page_idle.c	2019-07-10 03:55:47.000000000 -0400
@@ -131,7 +131,7 @@ static ssize_t page_idle_bitmap_read(str
 
 	end_pfn = pfn + count * BITS_PER_BYTE;
 	if (end_pfn > max_pfn)
-		end_pfn = ALIGN(max_pfn, BITMAP_CHUNK_BITS);
+		end_pfn = max_pfn;
 
 	for (; pfn < end_pfn; pfn++) {
 		bit = pfn % BITMAP_CHUNK_BITS;
@@ -176,7 +176,7 @@ static ssize_t page_idle_bitmap_write(st
 
 	end_pfn = pfn + count * BITS_PER_BYTE;
 	if (end_pfn > max_pfn)
-		end_pfn = ALIGN(max_pfn, BITMAP_CHUNK_BITS);
+		end_pfn = max_pfn;
 
 	for (; pfn < end_pfn; pfn++) {
 		bit = pfn % BITMAP_CHUNK_BITS;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/9p/protocol.c linux-libre-4.9.185-gnu/net/9p/protocol.c
--- linux-libre-4.9.184-gnu/net/9p/protocol.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/9p/protocol.c	2019-07-10 03:55:47.000000000 -0400
@@ -622,13 +622,19 @@ int p9dirent_read(struct p9_client *clnt
 	if (ret) {
 		p9_debug(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret);
 		trace_9p_protocol_dump(clnt, &fake_pdu);
-		goto out;
+		return ret;
 	}
 
-	strcpy(dirent->d_name, nameptr);
+	ret = strscpy(dirent->d_name, nameptr, sizeof(dirent->d_name));
+	if (ret < 0) {
+		p9_debug(P9_DEBUG_ERROR,
+			 "On the wire dirent name too long: %s\n",
+			 nameptr);
+		kfree(nameptr);
+		return ret;
+	}
 	kfree(nameptr);
 
-out:
 	return fake_pdu.offset;
 }
 EXPORT_SYMBOL(p9dirent_read);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/9p/trans_common.c linux-libre-4.9.185-gnu/net/9p/trans_common.c
--- linux-libre-4.9.184-gnu/net/9p/trans_common.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/9p/trans_common.c	2019-07-10 03:55:47.000000000 -0400
@@ -14,6 +14,7 @@
 
 #include <linux/mm.h>
 #include <linux/module.h>
+#include "trans_common.h"
 
 /**
  *  p9_release_req_pages - Release pages after the transaction.
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/9p/trans_rdma.c linux-libre-4.9.185-gnu/net/9p/trans_rdma.c
--- linux-libre-4.9.184-gnu/net/9p/trans_rdma.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/9p/trans_rdma.c	2019-07-10 03:55:47.000000000 -0400
@@ -254,8 +254,7 @@ p9_cm_event_handler(struct rdma_cm_id *i
 	case RDMA_CM_EVENT_DISCONNECTED:
 		if (rdma)
 			rdma->state = P9_RDMA_CLOSED;
-		if (c)
-			c->status = Disconnected;
+		c->status = Disconnected;
 		break;
 
 	case RDMA_CM_EVENT_TIMEWAIT_EXIT:
@@ -454,7 +453,7 @@ static int rdma_request(struct p9_client
 
 	err = post_recv(client, rpl_context);
 	if (err) {
-		p9_debug(P9_DEBUG_FCALL, "POST RECV failed\n");
+		p9_debug(P9_DEBUG_ERROR, "POST RECV failed: %d\n", err);
 		goto recv_error;
 	}
 	/* remove posted receive buffer from request structure */
@@ -523,7 +522,7 @@ dont_need_post_recv:
  recv_error:
 	kfree(rpl_context);
 	spin_lock_irqsave(&rdma->req_lock, flags);
-	if (rdma->state < P9_RDMA_CLOSING) {
+	if (err != -EINTR && rdma->state < P9_RDMA_CLOSING) {
 		rdma->state = P9_RDMA_CLOSING;
 		spin_unlock_irqrestore(&rdma->req_lock, flags);
 		rdma_disconnect(rdma->cm_id);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/bluetooth/hci_conn.c linux-libre-4.9.185-gnu/net/bluetooth/hci_conn.c
--- linux-libre-4.9.184-gnu/net/bluetooth/hci_conn.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/bluetooth/hci_conn.c	2019-07-10 03:55:47.000000000 -0400
@@ -1281,8 +1281,16 @@ auth:
 		return 0;
 
 encrypt:
-	if (test_bit(HCI_CONN_ENCRYPT, &conn->flags))
+	if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) {
+		/* Ensure that the encryption key size has been read,
+		 * otherwise stall the upper layer responses.
+		 */
+		if (!conn->enc_key_size)
+			return 0;
+
+		/* Nothing else needed, all requirements are met */
 		return 1;
+	}
 
 	hci_conn_encrypt(conn);
 	return 0;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/bluetooth/l2cap_core.c linux-libre-4.9.185-gnu/net/bluetooth/l2cap_core.c
--- linux-libre-4.9.184-gnu/net/bluetooth/l2cap_core.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/bluetooth/l2cap_core.c	2019-07-10 03:55:47.000000000 -0400
@@ -1340,6 +1340,21 @@ static void l2cap_request_info(struct l2
 		       sizeof(req), &req);
 }
 
+static bool l2cap_check_enc_key_size(struct hci_conn *hcon)
+{
+	/* The minimum encryption key size needs to be enforced by the
+	 * host stack before establishing any L2CAP connections. The
+	 * specification in theory allows a minimum of 1, but to align
+	 * BR/EDR and LE transports, a minimum of 7 is chosen.
+	 *
+	 * This check might also be called for unencrypted connections
+	 * that have no key size requirements. Ensure that the link is
+	 * actually encrypted before enforcing a key size.
+	 */
+	return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) ||
+		hcon->enc_key_size >= HCI_MIN_ENC_KEY_SIZE);
+}
+
 static void l2cap_do_start(struct l2cap_chan *chan)
 {
 	struct l2cap_conn *conn = chan->conn;
@@ -1357,9 +1372,14 @@ static void l2cap_do_start(struct l2cap_
 	if (!(conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE))
 		return;
 
-	if (l2cap_chan_check_security(chan, true) &&
-	    __l2cap_no_conn_pending(chan))
+	if (!l2cap_chan_check_security(chan, true) ||
+	    !__l2cap_no_conn_pending(chan))
+		return;
+
+	if (l2cap_check_enc_key_size(conn->hcon))
 		l2cap_start_connection(chan);
+	else
+		__set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
 }
 
 static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask)
@@ -1438,7 +1458,10 @@ static void l2cap_conn_start(struct l2ca
 				continue;
 			}
 
-			l2cap_start_connection(chan);
+			if (l2cap_check_enc_key_size(conn->hcon))
+				l2cap_start_connection(chan);
+			else
+				l2cap_chan_close(chan, ECONNREFUSED);
 
 		} else if (chan->state == BT_CONNECT2) {
 			struct l2cap_conn_rsp rsp;
@@ -7447,7 +7470,7 @@ static void l2cap_security_cfm(struct hc
 		}
 
 		if (chan->state == BT_CONNECT) {
-			if (!status)
+			if (!status && l2cap_check_enc_key_size(hcon))
 				l2cap_start_connection(chan);
 			else
 				__set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
@@ -7456,7 +7479,7 @@ static void l2cap_security_cfm(struct hc
 			struct l2cap_conn_rsp rsp;
 			__u16 res, stat;
 
-			if (!status) {
+			if (!status && l2cap_check_enc_key_size(hcon)) {
 				if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) {
 					res = L2CAP_CR_PEND;
 					stat = L2CAP_CS_AUTHOR_PEND;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/can/af_can.c linux-libre-4.9.185-gnu/net/can/af_can.c
--- linux-libre-4.9.184-gnu/net/can/af_can.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/can/af_can.c	2019-07-10 03:55:47.000000000 -0400
@@ -113,6 +113,7 @@ EXPORT_SYMBOL(can_ioctl);
 static void can_sock_destruct(struct sock *sk)
 {
 	skb_queue_purge(&sk->sk_receive_queue);
+	skb_queue_purge(&sk->sk_error_queue);
 }
 
 static const struct can_proto *can_get_proto(int protocol)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/core/dev.c linux-libre-4.9.185-gnu/net/core/dev.c
--- linux-libre-4.9.184-gnu/net/core/dev.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/core/dev.c	2019-07-10 03:55:47.000000000 -0400
@@ -5083,7 +5083,10 @@ bool sk_busy_loop(struct sock *sk, int n
 		goto out;
 
 	/* Note: ndo_busy_poll method is optional in linux-4.5 */
-	busy_poll = napi->dev->netdev_ops->ndo_busy_poll;
+	if (napi->dev->netdev_ops)
+		busy_poll = napi->dev->netdev_ops->ndo_busy_poll;
+	else
+		busy_poll = NULL;
 
 	do {
 		rc = 0;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/ipv4/raw.c linux-libre-4.9.185-gnu/net/ipv4/raw.c
--- linux-libre-4.9.184-gnu/net/ipv4/raw.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/ipv4/raw.c	2019-07-10 03:55:47.000000000 -0400
@@ -197,7 +197,7 @@ static int raw_v4_input(struct sk_buff *
 		}
 		sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol,
 				     iph->saddr, iph->daddr,
-				     skb->dev->ifindex);
+				     dif);
 	}
 out:
 	read_unlock(&raw_v4_hashinfo.lock);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/ipv4/udp.c linux-libre-4.9.185-gnu/net/ipv4/udp.c
--- linux-libre-4.9.184-gnu/net/ipv4/udp.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/ipv4/udp.c	2019-07-10 03:55:47.000000000 -0400
@@ -569,7 +569,11 @@ static inline struct sock *__udp4_lib_lo
 struct sock *udp4_lib_lookup_skb(struct sk_buff *skb,
 				 __be16 sport, __be16 dport)
 {
-	return __udp4_lib_lookup_skb(skb, sport, dport, &udp_table);
+	const struct iphdr *iph = ip_hdr(skb);
+
+	return __udp4_lib_lookup(dev_net(skb->dev), iph->saddr, sport,
+				 iph->daddr, dport, inet_iif(skb),
+				 &udp_table, NULL);
 }
 EXPORT_SYMBOL_GPL(udp4_lib_lookup_skb);
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/ipv6/udp.c linux-libre-4.9.185-gnu/net/ipv6/udp.c
--- linux-libre-4.9.184-gnu/net/ipv6/udp.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/ipv6/udp.c	2019-07-10 03:55:47.000000000 -0400
@@ -294,7 +294,7 @@ struct sock *udp6_lib_lookup_skb(struct
 
 	return __udp6_lib_lookup(dev_net(skb->dev), &iph->saddr, sport,
 				 &iph->daddr, dport, inet6_iif(skb),
-				 &udp_table, skb);
+				 &udp_table, NULL);
 }
 EXPORT_SYMBOL_GPL(udp6_lib_lookup_skb);
 
@@ -479,7 +479,7 @@ void __udp6_lib_err(struct sk_buff *skb,
 	struct net *net = dev_net(skb->dev);
 
 	sk = __udp6_lib_lookup(net, daddr, uh->dest, saddr, uh->source,
-			       inet6_iif(skb), udptable, skb);
+			       inet6_iif(skb), udptable, NULL);
 	if (!sk) {
 		__ICMP6_INC_STATS(net, __in6_dev_get(skb->dev),
 				  ICMP6_MIB_INERRORS);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/mac80211/rx.c linux-libre-4.9.185-gnu/net/mac80211/rx.c
--- linux-libre-4.9.184-gnu/net/mac80211/rx.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/mac80211/rx.c	2019-07-10 03:55:47.000000000 -0400
@@ -3568,6 +3568,8 @@ static bool ieee80211_accept_frame(struc
 	case NL80211_IFTYPE_STATION:
 		if (!bssid && !sdata->u.mgd.use_4addr)
 			return false;
+		if (ieee80211_is_robust_mgmt_frame(skb) && !rx->sta)
+			return false;
 		if (multicast)
 			return true;
 		return ether_addr_equal(sdata->vif.addr, hdr->addr1);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/mac80211/wpa.c linux-libre-4.9.185-gnu/net/mac80211/wpa.c
--- linux-libre-4.9.184-gnu/net/mac80211/wpa.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/mac80211/wpa.c	2019-07-10 03:55:47.000000000 -0400
@@ -1169,7 +1169,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct
 	struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
 	struct ieee80211_key *key = rx->key;
 	struct ieee80211_mmie_16 *mmie;
-	u8 aad[GMAC_AAD_LEN], mic[GMAC_MIC_LEN], ipn[6], nonce[GMAC_NONCE_LEN];
+	u8 aad[GMAC_AAD_LEN], *mic, ipn[6], nonce[GMAC_NONCE_LEN];
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 
 	if (!ieee80211_is_mgmt(hdr->frame_control))
@@ -1200,13 +1200,18 @@ ieee80211_crypto_aes_gmac_decrypt(struct
 		memcpy(nonce, hdr->addr2, ETH_ALEN);
 		memcpy(nonce + ETH_ALEN, ipn, 6);
 
+		mic = kmalloc(GMAC_MIC_LEN, GFP_ATOMIC);
+		if (!mic)
+			return RX_DROP_UNUSABLE;
 		if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
 				       skb->data + 24, skb->len - 24,
 				       mic) < 0 ||
 		    crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) {
 			key->u.aes_gmac.icverrors++;
+			kfree(mic);
 			return RX_DROP_UNUSABLE;
 		}
+		kfree(mic);
 	}
 
 	memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/packet/af_packet.c linux-libre-4.9.185-gnu/net/packet/af_packet.c
--- linux-libre-4.9.184-gnu/net/packet/af_packet.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/packet/af_packet.c	2019-07-10 03:55:47.000000000 -0400
@@ -2399,6 +2399,9 @@ static void tpacket_destruct_skb(struct
 
 		ts = __packet_set_timestamp(po, ph, skb);
 		__packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts);
+
+		if (!packet_read_pending(&po->tx_ring))
+			complete(&po->skb_completion);
 	}
 
 	sock_wfree(skb);
@@ -2629,7 +2632,7 @@ static int tpacket_parse_header(struct p
 
 static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
 {
-	struct sk_buff *skb;
+	struct sk_buff *skb = NULL;
 	struct net_device *dev;
 	struct virtio_net_hdr *vnet_hdr = NULL;
 	struct sockcm_cookie sockc;
@@ -2644,6 +2647,7 @@ static int tpacket_snd(struct packet_soc
 	int len_sum = 0;
 	int status = TP_STATUS_AVAILABLE;
 	int hlen, tlen, copylen = 0;
+	long timeo = 0;
 
 	mutex_lock(&po->pg_vec_lock);
 
@@ -2690,12 +2694,21 @@ static int tpacket_snd(struct packet_soc
 	if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !po->has_vnet_hdr)
 		size_max = dev->mtu + reserve + VLAN_HLEN;
 
+	reinit_completion(&po->skb_completion);
+
 	do {
 		ph = packet_current_frame(po, &po->tx_ring,
 					  TP_STATUS_SEND_REQUEST);
 		if (unlikely(ph == NULL)) {
-			if (need_wait && need_resched())
-				schedule();
+			if (need_wait && skb) {
+				timeo = sock_sndtimeo(&po->sk, msg->msg_flags & MSG_DONTWAIT);
+				timeo = wait_for_completion_interruptible_timeout(&po->skb_completion, timeo);
+				if (timeo <= 0) {
+					err = !timeo ? -ETIMEDOUT : -ERESTARTSYS;
+					goto out_put;
+				}
+			}
+			/* check for additional frames */
 			continue;
 		}
 
@@ -3249,6 +3262,7 @@ static int packet_create(struct net *net
 	sock_init_data(sock, sk);
 
 	po = pkt_sk(sk);
+	init_completion(&po->skb_completion);
 	sk->sk_family = PF_PACKET;
 	po->num = proto;
 	po->xmit = dev_queue_xmit;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/packet/internal.h linux-libre-4.9.185-gnu/net/packet/internal.h
--- linux-libre-4.9.184-gnu/net/packet/internal.h	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/packet/internal.h	2019-07-10 03:55:47.000000000 -0400
@@ -125,6 +125,7 @@ struct packet_sock {
 	unsigned int		tp_hdrlen;
 	unsigned int		tp_reserve;
 	unsigned int		tp_tstamp;
+	struct completion	skb_completion;
 	struct net_device __rcu	*cached_dev;
 	int			(*xmit)(struct sk_buff *skb);
 	struct packet_type	prot_hook ____cacheline_aligned_in_smp;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/sctp/endpointola.c linux-libre-4.9.185-gnu/net/sctp/endpointola.c
--- linux-libre-4.9.184-gnu/net/sctp/endpointola.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/sctp/endpointola.c	2019-07-10 03:55:47.000000000 -0400
@@ -125,10 +125,6 @@ static struct sctp_endpoint *sctp_endpoi
 	/* Initialize the bind addr area */
 	sctp_bind_addr_init(&ep->base.bind_addr, 0);
 
-	/* Remember who we are attached to.  */
-	ep->base.sk = sk;
-	sock_hold(ep->base.sk);
-
 	/* Create the lists of associations.  */
 	INIT_LIST_HEAD(&ep->asocs);
 
@@ -165,6 +161,10 @@ static struct sctp_endpoint *sctp_endpoi
 	ep->auth_chunk_list = auth_chunks;
 	ep->prsctp_enable = net->sctp.prsctp_enable;
 
+	/* Remember who we are attached to.  */
+	ep->base.sk = sk;
+	sock_hold(ep->base.sk);
+
 	return ep;
 
 nomem_hmacs:
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/tipc/core.c linux-libre-4.9.185-gnu/net/tipc/core.c
--- linux-libre-4.9.184-gnu/net/tipc/core.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/tipc/core.c	2019-07-10 03:55:47.000000000 -0400
@@ -128,7 +128,7 @@ static int __init tipc_init(void)
 	if (err)
 		goto out_sysctl;
 
-	err = register_pernet_subsys(&tipc_net_ops);
+	err = register_pernet_device(&tipc_net_ops);
 	if (err)
 		goto out_pernet;
 
@@ -136,7 +136,7 @@ static int __init tipc_init(void)
 	if (err)
 		goto out_socket;
 
-	err = register_pernet_subsys(&tipc_topsrv_net_ops);
+	err = register_pernet_device(&tipc_topsrv_net_ops);
 	if (err)
 		goto out_pernet_topsrv;
 
@@ -147,11 +147,11 @@ static int __init tipc_init(void)
 	pr_info("Started in single node mode\n");
 	return 0;
 out_bearer:
-	unregister_pernet_subsys(&tipc_topsrv_net_ops);
+	unregister_pernet_device(&tipc_topsrv_net_ops);
 out_pernet_topsrv:
 	tipc_socket_stop();
 out_socket:
-	unregister_pernet_subsys(&tipc_net_ops);
+	unregister_pernet_device(&tipc_net_ops);
 out_pernet:
 	tipc_unregister_sysctl();
 out_sysctl:
@@ -166,9 +166,9 @@ out_netlink:
 static void __exit tipc_exit(void)
 {
 	tipc_bearer_cleanup();
-	unregister_pernet_subsys(&tipc_topsrv_net_ops);
+	unregister_pernet_device(&tipc_topsrv_net_ops);
 	tipc_socket_stop();
-	unregister_pernet_subsys(&tipc_net_ops);
+	unregister_pernet_device(&tipc_net_ops);
 	tipc_netlink_stop();
 	tipc_netlink_compat_stop();
 	tipc_unregister_sysctl();
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/tipc/netlink_compat.c linux-libre-4.9.185-gnu/net/tipc/netlink_compat.c
--- linux-libre-4.9.184-gnu/net/tipc/netlink_compat.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/tipc/netlink_compat.c	2019-07-10 03:55:47.000000000 -0400
@@ -436,7 +436,11 @@ static int tipc_nl_compat_bearer_disable
 	if (!bearer)
 		return -EMSGSIZE;
 
-	len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME);
+	len = TLV_GET_DATA_LEN(msg->req);
+	if (len <= 0)
+		return -EINVAL;
+
+	len = min_t(int, len, TIPC_MAX_BEARER_NAME);
 	if (!string_is_valid(name, len))
 		return -EINVAL;
 
@@ -528,7 +532,11 @@ static int tipc_nl_compat_link_stat_dump
 
 	name = (char *)TLV_DATA(msg->req);
 
-	len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
+	len = TLV_GET_DATA_LEN(msg->req);
+	if (len <= 0)
+		return -EINVAL;
+
+	len = min_t(int, len, TIPC_MAX_BEARER_NAME);
 	if (!string_is_valid(name, len))
 		return -EINVAL;
 
@@ -806,7 +814,11 @@ static int tipc_nl_compat_link_reset_sta
 	if (!link)
 		return -EMSGSIZE;
 
-	len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME);
+	len = TLV_GET_DATA_LEN(msg->req);
+	if (len <= 0)
+		return -EINVAL;
+
+	len = min_t(int, len, TIPC_MAX_BEARER_NAME);
 	if (!string_is_valid(name, len))
 		return -EINVAL;
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/tipc/udp_media.c linux-libre-4.9.185-gnu/net/tipc/udp_media.c
--- linux-libre-4.9.184-gnu/net/tipc/udp_media.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/tipc/udp_media.c	2019-07-10 03:55:47.000000000 -0400
@@ -174,7 +174,6 @@ static int tipc_udp_xmit(struct net *net
 			goto tx_error;
 		}
 
-		skb->dev = rt->dst.dev;
 		ttl = ip4_dst_hoplimit(&rt->dst);
 		udp_tunnel_xmit_skb(rt, ub->ubsock->sk, skb, src->ipv4.s_addr,
 				    dst->ipv4.s_addr, 0, ttl, 0, src->port,
@@ -193,10 +192,9 @@ static int tipc_udp_xmit(struct net *net
 		if (err)
 			goto tx_error;
 		ttl = ip6_dst_hoplimit(ndst);
-		err = udp_tunnel6_xmit_skb(ndst, ub->ubsock->sk, skb,
-					   ndst->dev, &src->ipv6,
-					   &dst->ipv6, 0, ttl, 0, src->port,
-					   dst->port, false);
+		err = udp_tunnel6_xmit_skb(ndst, ub->ubsock->sk, skb, NULL,
+					   &src->ipv6, &dst->ipv6, 0, ttl, 0,
+					   src->port, dst->port, false);
 #endif
 	}
 	return err;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/net/wireless/core.c linux-libre-4.9.185-gnu/net/wireless/core.c
--- linux-libre-4.9.184-gnu/net/wireless/core.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/net/wireless/core.c	2019-07-10 03:55:47.000000000 -0400
@@ -478,7 +478,7 @@ use_default_name:
 				   &rdev->rfkill_ops, rdev);
 
 	if (!rdev->rfkill) {
-		kfree(rdev);
+		wiphy_free(&rdev->wiphy);
 		return NULL;
 	}
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/scripts/checkstack.pl linux-libre-4.9.185-gnu/scripts/checkstack.pl
--- linux-libre-4.9.184-gnu/scripts/checkstack.pl	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/scripts/checkstack.pl	2019-07-10 03:55:47.000000000 -0400
@@ -45,7 +45,7 @@ my (@stack, $re, $dre, $x, $xs, $funcre)
 	$x	= "[0-9a-f]";	# hex character
 	$xs	= "[0-9a-f ]";	# hex character or space
 	$funcre = qr/^$x* <(.*)>:$/;
-	if ($arch eq 'aarch64') {
+	if ($arch =~ '^(aarch|arm)64$') {
 		#ffffffc0006325cc:       a9bb7bfd        stp     x29, x30, [sp, #-80]!
 		$re = qr/^.*stp.*sp, \#-([0-9]{1,8})\]\!/o;
 	} elsif ($arch eq 'arm') {
diff -druNp --no-dereference linux-libre-4.9.184-gnu/scripts/decode_stacktrace.sh linux-libre-4.9.185-gnu/scripts/decode_stacktrace.sh
--- linux-libre-4.9.184-gnu/scripts/decode_stacktrace.sh	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/scripts/decode_stacktrace.sh	2019-07-10 03:55:47.000000000 -0400
@@ -65,7 +65,7 @@ parse_symbol() {
 	if [[ "${cache[$module,$address]+isset}" == "isset" ]]; then
 		local code=${cache[$module,$address]}
 	else
-		local code=$(addr2line -i -e "$objfile" "$address")
+		local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address")
 		cache[$module,$address]=$code
 	fi
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/security/apparmor/policy_unpack.c linux-libre-4.9.185-gnu/security/apparmor/policy_unpack.c
--- linux-libre-4.9.184-gnu/security/apparmor/policy_unpack.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/security/apparmor/policy_unpack.c	2019-07-10 03:55:47.000000000 -0400
@@ -177,7 +177,7 @@ static bool unpack_nameX(struct aa_ext *
 		char *tag = NULL;
 		size_t size = unpack_u16_chunk(e, &tag);
 		/* if a name is specified it must match. otherwise skip tag */
-		if (name && (!size || strcmp(name, tag)))
+		if (name && (!size || tag[size-1] != '\0' || strcmp(name, tag)))
 			goto fail;
 	} else if (name) {
 		/* if a name is specified and there is no name tag fail */
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/core/seq/oss/seq_oss_ioctl.c linux-libre-4.9.185-gnu/sound/core/seq/oss/seq_oss_ioctl.c
--- linux-libre-4.9.184-gnu/sound/core/seq/oss/seq_oss_ioctl.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/core/seq/oss/seq_oss_ioctl.c	2019-07-10 03:55:47.000000000 -0400
@@ -62,7 +62,7 @@ static int snd_seq_oss_oob_user(struct s
 	if (copy_from_user(ev, arg, 8))
 		return -EFAULT;
 	memset(&tmpev, 0, sizeof(tmpev));
-	snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.port, dp->addr.client);
+	snd_seq_oss_fill_addr(dp, &tmpev, dp->addr.client, dp->addr.port);
 	tmpev.time.tick = 0;
 	if (! snd_seq_oss_process_event(dp, (union evrec *)ev, &tmpev)) {
 		snd_seq_oss_dispatch(dp, &tmpev, 0, 0);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/core/seq/oss/seq_oss_rw.c linux-libre-4.9.185-gnu/sound/core/seq/oss/seq_oss_rw.c
--- linux-libre-4.9.184-gnu/sound/core/seq/oss/seq_oss_rw.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/core/seq/oss/seq_oss_rw.c	2019-07-10 03:55:47.000000000 -0400
@@ -174,7 +174,7 @@ insert_queue(struct seq_oss_devinfo *dp,
 	memset(&event, 0, sizeof(event));
 	/* set dummy -- to be sure */
 	event.type = SNDRV_SEQ_EVENT_NOTEOFF;
-	snd_seq_oss_fill_addr(dp, &event, dp->addr.port, dp->addr.client);
+	snd_seq_oss_fill_addr(dp, &event, dp->addr.client, dp->addr.port);
 
 	if (snd_seq_oss_process_event(dp, rec, &event))
 		return 0; /* invalid event - no need to insert queue */
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/firewire/amdtp-am824.c linux-libre-4.9.185-gnu/sound/firewire/amdtp-am824.c
--- linux-libre-4.9.184-gnu/sound/firewire/amdtp-am824.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/firewire/amdtp-am824.c	2019-07-10 03:55:47.000000000 -0400
@@ -388,7 +388,7 @@ static void read_midi_messages(struct am
 	u8 *b;
 
 	for (f = 0; f < frames; f++) {
-		port = (s->data_block_counter + f) % 8;
+		port = (8 - s->tx_first_dbc + s->data_block_counter + f) % 8;
 		b = (u8 *)&buffer[p->midi_position];
 
 		len = b[0] - 0x80;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/soc/codecs/cs4265.c linux-libre-4.9.185-gnu/sound/soc/codecs/cs4265.c
--- linux-libre-4.9.184-gnu/sound/soc/codecs/cs4265.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/soc/codecs/cs4265.c	2019-07-10 03:55:47.000000000 -0400
@@ -60,7 +60,7 @@ static const struct reg_default cs4265_r
 static bool cs4265_readable_register(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
-	case CS4265_CHIP_ID ... CS4265_SPDIF_CTL2:
+	case CS4265_CHIP_ID ... CS4265_MAX_REGISTER:
 		return true;
 	default:
 		return false;
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/soc/codecs/max98090.c linux-libre-4.9.185-gnu/sound/soc/codecs/max98090.c
--- linux-libre-4.9.184-gnu/sound/soc/codecs/max98090.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/soc/codecs/max98090.c	2019-07-10 03:55:47.000000000 -0400
@@ -1924,6 +1924,21 @@ static int max98090_configure_dmic(struc
 	return 0;
 }
 
+static int max98090_dai_startup(struct snd_pcm_substream *substream,
+				struct snd_soc_dai *dai)
+{
+	struct snd_soc_component *component = dai->component;
+	struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
+	unsigned int fmt = max98090->dai_fmt;
+
+	/* Remove 24-bit format support if it is not in right justified mode. */
+	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
+		substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+		snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
+	}
+	return 0;
+}
+
 static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
 				   struct snd_pcm_hw_params *params,
 				   struct snd_soc_dai *dai)
@@ -2331,6 +2346,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
 #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops max98090_dai_ops = {
+	.startup = max98090_dai_startup,
 	.set_sysclk = max98090_dai_set_sysclk,
 	.set_fmt = max98090_dai_set_fmt,
 	.set_tdm_slot = max98090_set_tdm_slot,
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/soc/soc-pcm.c linux-libre-4.9.185-gnu/sound/soc/soc-pcm.c
--- linux-libre-4.9.184-gnu/sound/soc/soc-pcm.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/soc/soc-pcm.c	2019-07-10 03:55:47.000000000 -0400
@@ -2247,7 +2247,8 @@ int dpcm_be_dai_prepare(struct snd_soc_p
 
 		if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
 		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
-		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND))
+		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) &&
+		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
 			continue;
 
 		dev_dbg(be->dev, "ASoC: prepare BE %s\n",
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/usb/line6/pcm.c linux-libre-4.9.185-gnu/sound/usb/line6/pcm.c
--- linux-libre-4.9.184-gnu/sound/usb/line6/pcm.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/usb/line6/pcm.c	2019-07-10 03:55:47.000000000 -0400
@@ -558,6 +558,11 @@ int line6_init_pcm(struct usb_line6 *lin
 	line6pcm->max_packet_size_out =
 		usb_maxpacket(line6->usbdev,
 			usb_sndisocpipe(line6->usbdev, ep_write), 1);
+	if (!line6pcm->max_packet_size_in || !line6pcm->max_packet_size_out) {
+		dev_err(line6pcm->line6->ifcdev,
+			"cannot get proper max packet size\n");
+		return -EINVAL;
+	}
 
 	spin_lock_init(&line6pcm->out.lock);
 	spin_lock_init(&line6pcm->in.lock);
diff -druNp --no-dereference linux-libre-4.9.184-gnu/sound/usb/mixer_quirks.c linux-libre-4.9.185-gnu/sound/usb/mixer_quirks.c
--- linux-libre-4.9.184-gnu/sound/usb/mixer_quirks.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/sound/usb/mixer_quirks.c	2019-07-10 03:55:47.000000000 -0400
@@ -753,7 +753,7 @@ static int snd_ni_control_init_val(struc
 		return err;
 	}
 
-	kctl->private_value |= (value << 24);
+	kctl->private_value |= ((unsigned int)value << 24);
 	return 0;
 }
 
@@ -914,7 +914,7 @@ static int snd_ftu_eff_switch_init(struc
 	if (err < 0)
 		return err;
 
-	kctl->private_value |= value[0] << 24;
+	kctl->private_value |= (unsigned int)value[0] << 24;
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.9.184-gnu/tools/perf/builtin-help.c linux-libre-4.9.185-gnu/tools/perf/builtin-help.c
--- linux-libre-4.9.184-gnu/tools/perf/builtin-help.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/tools/perf/builtin-help.c	2019-07-10 03:55:47.000000000 -0400
@@ -186,7 +186,7 @@ static void add_man_viewer(const char *n
 	while (*p)
 		p = &((*p)->next);
 	*p = zalloc(sizeof(**p) + len + 1);
-	strncpy((*p)->name, name, len);
+	strcpy((*p)->name, name);
 }
 
 static int supported_man_viewer(const char *name, size_t len)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/tools/perf/ui/tui/helpline.c linux-libre-4.9.185-gnu/tools/perf/ui/tui/helpline.c
--- linux-libre-4.9.184-gnu/tools/perf/ui/tui/helpline.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/tools/perf/ui/tui/helpline.c	2019-07-10 03:55:47.000000000 -0400
@@ -23,7 +23,7 @@ static void tui_helpline__push(const cha
 	SLsmg_set_color(0);
 	SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
 	SLsmg_refresh();
-	strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
+	strlcpy(ui_helpline__current, msg, sz);
 }
 
 static int tui_helpline__show(const char *format, va_list ap)
diff -druNp --no-dereference linux-libre-4.9.184-gnu/tools/perf/util/header.c linux-libre-4.9.185-gnu/tools/perf/util/header.c
--- linux-libre-4.9.184-gnu/tools/perf/util/header.c	2019-06-26 20:14:21.000000000 -0400
+++ linux-libre-4.9.185-gnu/tools/perf/util/header.c	2019-07-10 03:55:47.000000000 -0400
@@ -3027,7 +3027,7 @@ perf_event__synthesize_event_update_name
 	if (ev == NULL)
 		return -ENOMEM;
 
-	strncpy(ev->data, evsel->name, len);
+	strlcpy(ev->data, evsel->name, len + 1);
 	err = process(tool, (union perf_event*) ev, NULL, NULL);
 	free(ev);
 	return err;
