diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm/boot/dts/exynos5420-peach-pit.dts linux-libre-4.14.147-gnu/arch/arm/boot/dts/exynos5420-peach-pit.dts
--- linux-libre-4.14.146-gnu/arch/arm/boot/dts/exynos5420-peach-pit.dts	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm/boot/dts/exynos5420-peach-pit.dts	2019-10-05 06:48:14.000000000 -0400
@@ -426,6 +426,7 @@
 				regulator-name = "vdd_ldo10";
 				regulator-min-microvolt = <1800000>;
 				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
 				regulator-state-mem {
 					regulator-off-in-suspend;
 				};
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm/boot/dts/exynos5800-peach-pi.dts linux-libre-4.14.147-gnu/arch/arm/boot/dts/exynos5800-peach-pi.dts
--- linux-libre-4.14.146-gnu/arch/arm/boot/dts/exynos5800-peach-pi.dts	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm/boot/dts/exynos5800-peach-pi.dts	2019-10-05 06:48:14.000000000 -0400
@@ -426,6 +426,7 @@
 				regulator-name = "vdd_ldo10";
 				regulator-min-microvolt = <1800000>;
 				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
 				regulator-state-mem {
 					regulator-off-in-suspend;
 				};
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm/boot/dts/imx7d-cl-som-imx7.dts linux-libre-4.14.147-gnu/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
--- linux-libre-4.14.146-gnu/arch/arm/boot/dts/imx7d-cl-som-imx7.dts	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm/boot/dts/imx7d-cl-som-imx7.dts	2019-10-05 06:48:14.000000000 -0400
@@ -43,7 +43,7 @@
 			  <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
 	assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
 	assigned-clock-rates = <0>, <100000000>;
-	phy-mode = "rgmii";
+	phy-mode = "rgmii-id";
 	phy-handle = <&ethphy0>;
 	fsl,magic-packet;
 	status = "okay";
@@ -69,7 +69,7 @@
 			  <&clks IMX7D_ENET2_TIME_ROOT_CLK>;
 	assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
 	assigned-clock-rates = <0>, <100000000>;
-	phy-mode = "rgmii";
+	phy-mode = "rgmii-id";
 	phy-handle = <&ethphy1>;
 	fsl,magic-packet;
 	status = "okay";
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm/mach-zynq/platsmp.c linux-libre-4.14.147-gnu/arch/arm/mach-zynq/platsmp.c
--- linux-libre-4.14.146-gnu/arch/arm/mach-zynq/platsmp.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm/mach-zynq/platsmp.c	2019-10-05 06:48:14.000000000 -0400
@@ -65,7 +65,7 @@ int zynq_cpun_start(u32 address, int cpu
 			* 0x4: Jump by mov instruction
 			* 0x8: Jumping address
 			*/
-			memcpy((__force void *)zero, &zynq_secondary_trampoline,
+			memcpy_toio(zero, &zynq_secondary_trampoline,
 							trampoline_size);
 			writel(address, zero + trampoline_size);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm/plat-samsung/watchdog-reset.c linux-libre-4.14.147-gnu/arch/arm/plat-samsung/watchdog-reset.c
--- linux-libre-4.14.146-gnu/arch/arm/plat-samsung/watchdog-reset.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm/plat-samsung/watchdog-reset.c	2019-10-05 06:48:14.000000000 -0400
@@ -67,6 +67,7 @@ void samsung_wdt_reset(void)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c2410_wdt_match[] = {
 	{ .compatible = "samsung,s3c2410-wdt" },
+	{ .compatible = "samsung,s3c6410-wdt" },
 	{},
 };
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm64/boot/dts/rockchip/rk3328.dtsi linux-libre-4.14.147-gnu/arch/arm64/boot/dts/rockchip/rk3328.dtsi
--- linux-libre-4.14.146-gnu/arch/arm64/boot/dts/rockchip/rk3328.dtsi	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm64/boot/dts/rockchip/rk3328.dtsi	2019-10-05 06:48:14.000000000 -0400
@@ -685,6 +685,7 @@
 			 <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
+		max-frequency = <150000000>;
 		status = "disabled";
 	};
 
@@ -696,6 +697,7 @@
 			 <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
+		max-frequency = <150000000>;
 		status = "disabled";
 	};
 
@@ -707,6 +709,7 @@
 			 <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
 		fifo-depth = <0x100>;
+		max-frequency = <150000000>;
 		status = "disabled";
 	};
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm64/kernel/cpufeature.c linux-libre-4.14.147-gnu/arch/arm64/kernel/cpufeature.c
--- linux-libre-4.14.146-gnu/arch/arm64/kernel/cpufeature.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm64/kernel/cpufeature.c	2019-10-05 06:48:14.000000000 -0400
@@ -838,6 +838,11 @@ static bool unmap_kernel_at_el0(const st
 	switch (read_cpuid_id() & MIDR_CPU_MODEL_MASK) {
 	case MIDR_CAVIUM_THUNDERX2:
 	case MIDR_BRCM_VULCAN:
+	case MIDR_CORTEX_A53:
+	case MIDR_CORTEX_A55:
+	case MIDR_CORTEX_A57:
+	case MIDR_CORTEX_A72:
+	case MIDR_CORTEX_A73:
 		return false;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/arm64/mm/proc.S linux-libre-4.14.147-gnu/arch/arm64/mm/proc.S
--- linux-libre-4.14.146-gnu/arch/arm64/mm/proc.S	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/arm64/mm/proc.S	2019-10-05 06:48:14.000000000 -0400
@@ -280,6 +280,15 @@ skip_pgd:
 	msr	sctlr_el1, x18
 	isb
 
+	/*
+	 * Invalidate the local I-cache so that any instructions fetched
+	 * speculatively from the PoC are discarded, since they may have
+	 * been dynamically patched at the PoU.
+	 */
+	ic	iallu
+	dsb	nsh
+	isb
+
 	/* Set the flag to zero to indicate that we're all done */
 	str	wzr, [flag_ptr]
 	ret
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/ia64/kernel/module.c linux-libre-4.14.147-gnu/arch/ia64/kernel/module.c
--- linux-libre-4.14.146-gnu/arch/ia64/kernel/module.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/ia64/kernel/module.c	2019-10-05 06:48:14.000000000 -0400
@@ -913,8 +913,12 @@ module_finalize (const Elf_Ehdr *hdr, co
 void
 module_arch_cleanup (struct module *mod)
 {
-	if (mod->arch.init_unw_table)
+	if (mod->arch.init_unw_table) {
 		unw_remove_unwind_table(mod->arch.init_unw_table);
-	if (mod->arch.core_unw_table)
+		mod->arch.init_unw_table = NULL;
+	}
+	if (mod->arch.core_unw_table) {
 		unw_remove_unwind_table(mod->arch.core_unw_table);
+		mod->arch.core_unw_table = NULL;
+	}
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/powerpc/include/asm/opal.h linux-libre-4.14.147-gnu/arch/powerpc/include/asm/opal.h
--- linux-libre-4.14.146-gnu/arch/powerpc/include/asm/opal.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/powerpc/include/asm/opal.h	2019-10-05 06:48:14.000000000 -0400
@@ -266,7 +266,7 @@ int64_t opal_xive_get_vp_info(uint64_t v
 int64_t opal_xive_set_vp_info(uint64_t vp,
 			      uint64_t flags,
 			      uint64_t report_cl_pair);
-int64_t opal_xive_allocate_irq(uint32_t chip_id);
+int64_t opal_xive_allocate_irq_raw(uint32_t chip_id);
 int64_t opal_xive_free_irq(uint32_t girq);
 int64_t opal_xive_sync(uint32_t type, uint32_t id);
 int64_t opal_xive_dump(uint32_t type, uint32_t id);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/powerpc/platforms/powernv/opal-wrappers.S linux-libre-4.14.147-gnu/arch/powerpc/platforms/powernv/opal-wrappers.S
--- linux-libre-4.14.146-gnu/arch/powerpc/platforms/powernv/opal-wrappers.S	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/powerpc/platforms/powernv/opal-wrappers.S	2019-10-05 06:48:14.000000000 -0400
@@ -301,7 +301,7 @@ OPAL_CALL(opal_xive_set_queue_info,		OPA
 OPAL_CALL(opal_xive_donate_page,		OPAL_XIVE_DONATE_PAGE);
 OPAL_CALL(opal_xive_alloc_vp_block,		OPAL_XIVE_ALLOCATE_VP_BLOCK);
 OPAL_CALL(opal_xive_free_vp_block,		OPAL_XIVE_FREE_VP_BLOCK);
-OPAL_CALL(opal_xive_allocate_irq,		OPAL_XIVE_ALLOCATE_IRQ);
+OPAL_CALL(opal_xive_allocate_irq_raw,		OPAL_XIVE_ALLOCATE_IRQ);
 OPAL_CALL(opal_xive_free_irq,			OPAL_XIVE_FREE_IRQ);
 OPAL_CALL(opal_xive_get_vp_info,		OPAL_XIVE_GET_VP_INFO);
 OPAL_CALL(opal_xive_set_vp_info,		OPAL_XIVE_SET_VP_INFO);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/powerpc/sysdev/xive/native.c linux-libre-4.14.147-gnu/arch/powerpc/sysdev/xive/native.c
--- linux-libre-4.14.146-gnu/arch/powerpc/sysdev/xive/native.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/powerpc/sysdev/xive/native.c	2019-10-05 06:48:14.000000000 -0400
@@ -234,6 +234,17 @@ static bool xive_native_match(struct dev
 	return of_device_is_compatible(node, "ibm,opal-xive-vc");
 }
 
+static s64 opal_xive_allocate_irq(u32 chip_id)
+{
+	s64 irq = opal_xive_allocate_irq_raw(chip_id);
+
+	/*
+	 * Old versions of skiboot can incorrectly return 0xffffffff to
+	 * indicate no space, fix it up here.
+	 */
+	return irq == 0xffffffff ? OPAL_RESOURCE : irq;
+}
+
 #ifdef CONFIG_SMP
 static int xive_native_get_ipi(unsigned int cpu, struct xive_cpu *xc)
 {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/s390/crypto/aes_s390.c linux-libre-4.14.147-gnu/arch/s390/crypto/aes_s390.c
--- linux-libre-4.14.146-gnu/arch/s390/crypto/aes_s390.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/s390/crypto/aes_s390.c	2019-10-05 06:48:14.000000000 -0400
@@ -572,6 +572,9 @@ static int xts_aes_encrypt(struct blkcip
 	struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
 	struct blkcipher_walk walk;
 
+	if (!nbytes)
+		return -EINVAL;
+
 	if (unlikely(!xts_ctx->fc))
 		return xts_fallback_encrypt(desc, dst, src, nbytes);
 
@@ -586,6 +589,9 @@ static int xts_aes_decrypt(struct blkcip
 	struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
 	struct blkcipher_walk walk;
 
+	if (!nbytes)
+		return -EINVAL;
+
 	if (unlikely(!xts_ctx->fc))
 		return xts_fallback_decrypt(desc, dst, src, nbytes);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/x86/kernel/apic/apic.c linux-libre-4.14.147-gnu/arch/x86/kernel/apic/apic.c
--- linux-libre-4.14.146-gnu/arch/x86/kernel/apic/apic.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/x86/kernel/apic/apic.c	2019-10-05 06:48:14.000000000 -0400
@@ -1384,6 +1384,14 @@ void setup_local_APIC(void)
 		return;
 	}
 
+	/*
+	 * If this comes from kexec/kcrash the APIC might be enabled in
+	 * SPIV. Soft disable it before doing further initialization.
+	 */
+	value = apic_read(APIC_SPIV);
+	value &= ~APIC_SPIV_APIC_ENABLED;
+	apic_write(APIC_SPIV, value);
+
 #ifdef CONFIG_X86_32
 	/* Pound the ESR really hard over the head with a big hammer - mbligh */
 	if (lapic_is_integrated() && apic->disable_esr) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/x86/kernel/smp.c linux-libre-4.14.147-gnu/arch/x86/kernel/smp.c
--- linux-libre-4.14.146-gnu/arch/x86/kernel/smp.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/x86/kernel/smp.c	2019-10-05 06:48:14.000000000 -0400
@@ -181,6 +181,12 @@ asmlinkage __visible void smp_reboot_int
 	irq_exit();
 }
 
+static int register_stop_handler(void)
+{
+	return register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
+				    NMI_FLAG_FIRST, "smp_stop");
+}
+
 static void native_stop_other_cpus(int wait)
 {
 	unsigned long flags;
@@ -214,39 +220,41 @@ static void native_stop_other_cpus(int w
 		apic->send_IPI_allbutself(REBOOT_VECTOR);
 
 		/*
-		 * Don't wait longer than a second if the caller
-		 * didn't ask us to wait.
+		 * Don't wait longer than a second for IPI completion. The
+		 * wait request is not checked here because that would
+		 * prevent an NMI shutdown attempt in case that not all
+		 * CPUs reach shutdown state.
 		 */
 		timeout = USEC_PER_SEC;
-		while (num_online_cpus() > 1 && (wait || timeout--))
+		while (num_online_cpus() > 1 && timeout--)
 			udelay(1);
 	}
-	
-	/* if the REBOOT_VECTOR didn't work, try with the NMI */
-	if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi))  {
-		if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
-					 NMI_FLAG_FIRST, "smp_stop"))
-			/* Note: we ignore failures here */
-			/* Hope the REBOOT_IRQ is good enough */
-			goto finish;
-
-		/* sync above data before sending IRQ */
-		wmb();
 
-		pr_emerg("Shutting down cpus with NMI\n");
+	/* if the REBOOT_VECTOR didn't work, try with the NMI */
+	if (num_online_cpus() > 1) {
+		/*
+		 * If NMI IPI is enabled, try to register the stop handler
+		 * and send the IPI. In any case try to wait for the other
+		 * CPUs to stop.
+		 */
+		if (!smp_no_nmi_ipi && !register_stop_handler()) {
+			/* Sync above data before sending IRQ */
+			wmb();
 
-		apic->send_IPI_allbutself(NMI_VECTOR);
+			pr_emerg("Shutting down cpus with NMI\n");
 
+			apic->send_IPI_allbutself(NMI_VECTOR);
+		}
 		/*
-		 * Don't wait longer than a 10 ms if the caller
-		 * didn't ask us to wait.
+		 * Don't wait longer than 10 ms if the caller didn't
+		 * reqeust it. If wait is true, the machine hangs here if
+		 * one or more CPUs do not reach shutdown state.
 		 */
 		timeout = USEC_PER_MSEC * 10;
 		while (num_online_cpus() > 1 && (wait || timeout--))
 			udelay(1);
 	}
 
-finish:
 	local_irq_save(flags);
 	disable_local_APIC();
 	mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/x86/kvm/emulate.c linux-libre-4.14.147-gnu/arch/x86/kvm/emulate.c
--- linux-libre-4.14.146-gnu/arch/x86/kvm/emulate.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/x86/kvm/emulate.c	2019-10-05 06:48:14.000000000 -0400
@@ -5298,6 +5298,8 @@ done_prefixes:
 					ctxt->memopp->addr.mem.ea + ctxt->_eip);
 
 done:
+	if (rc == X86EMUL_PROPAGATE_FAULT)
+		ctxt->have_exception = true;
 	return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK;
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/x86/kvm/x86.c linux-libre-4.14.147-gnu/arch/x86/kvm/x86.c
--- linux-libre-4.14.146-gnu/arch/x86/kvm/x86.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/x86/kvm/x86.c	2019-10-05 06:48:14.000000000 -0400
@@ -563,8 +563,14 @@ static int kvm_read_nested_guest_page(st
 				       data, offset, len, access);
 }
 
+static inline u64 pdptr_rsvd_bits(struct kvm_vcpu *vcpu)
+{
+	return rsvd_bits(cpuid_maxphyaddr(vcpu), 63) | rsvd_bits(5, 8) |
+	       rsvd_bits(1, 2);
+}
+
 /*
- * Load the pae pdptrs.  Return true is they are all valid.
+ * Load the pae pdptrs.  Return 1 if they are all valid, 0 otherwise.
  */
 int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
 {
@@ -583,8 +589,7 @@ int load_pdptrs(struct kvm_vcpu *vcpu, s
 	}
 	for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
 		if ((pdpte[i] & PT_PRESENT_MASK) &&
-		    (pdpte[i] &
-		     vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
+		    (pdpte[i] & pdptr_rsvd_bits(vcpu))) {
 			ret = 0;
 			goto out;
 		}
@@ -5892,8 +5897,16 @@ int x86_emulate_instruction(struct kvm_v
 			if (reexecute_instruction(vcpu, cr2, write_fault_to_spt,
 						emulation_type))
 				return EMULATE_DONE;
-			if (ctxt->have_exception && inject_emulated_exception(vcpu))
+			if (ctxt->have_exception) {
+				/*
+				 * #UD should result in just EMULATION_FAILED, and trap-like
+				 * exception should not be encountered during decode.
+				 */
+				WARN_ON_ONCE(ctxt->exception.vector == UD_VECTOR ||
+					     exception_type(ctxt->exception.vector) == EXCPT_TRAP);
+				inject_emulated_exception(vcpu);
 				return EMULATE_DONE;
+			}
 			if (emulation_type & EMULTYPE_SKIP)
 				return EMULATE_FAIL;
 			return handle_emulation_failure(vcpu);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/arch/x86/Makefile linux-libre-4.14.147-gnu/arch/x86/Makefile
--- linux-libre-4.14.146-gnu/arch/x86/Makefile	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/arch/x86/Makefile	2019-10-05 06:48:14.000000000 -0400
@@ -249,7 +249,7 @@ ifdef CONFIG_RETPOLINE
   # retpoline builds, however, gcc does not for x86. This has
   # only been fixed starting from gcc stable version 8.4.0 and
   # onwards, but not for older ones. See gcc bug #86952.
-  ifndef CONFIG_CC_IS_CLANG
+  ifneq ($(cc-name), clang)
     KBUILD_CFLAGS += $(call cc-option,-fno-jump-tables)
   endif
 endif
diff -druNp --no-dereference linux-libre-4.14.146-gnu/block/blk-mq.c linux-libre-4.14.147-gnu/block/blk-mq.c
--- linux-libre-4.14.146-gnu/block/blk-mq.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/block/blk-mq.c	2019-10-05 06:48:14.000000000 -0400
@@ -2294,8 +2294,6 @@ void blk_mq_release(struct request_queue
 	struct blk_mq_hw_ctx *hctx;
 	unsigned int i;
 
-	cancel_delayed_work_sync(&q->requeue_work);
-
 	/* hctx kobj stays in hctx */
 	queue_for_each_hw_ctx(q, hctx, i) {
 		if (!hctx)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/block/blk-sysfs.c linux-libre-4.14.147-gnu/block/blk-sysfs.c
--- linux-libre-4.14.146-gnu/block/blk-sysfs.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/block/blk-sysfs.c	2019-10-05 06:48:14.000000000 -0400
@@ -811,6 +811,9 @@ static void __blk_release_queue(struct w
 
 	blk_free_queue_stats(q->stats);
 
+	if (q->mq_ops)
+		cancel_delayed_work_sync(&q->requeue_work);
+
 	blk_exit_rl(q, &q->root_rl);
 
 	if (q->queue_tags)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/acpi/acpi_processor.c linux-libre-4.14.147-gnu/drivers/acpi/acpi_processor.c
--- linux-libre-4.14.146-gnu/drivers/acpi/acpi_processor.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/acpi/acpi_processor.c	2019-10-05 06:48:14.000000000 -0400
@@ -281,9 +281,13 @@ static int acpi_processor_get_info(struc
 	}
 
 	if (acpi_duplicate_processor_id(pr->acpi_id)) {
-		dev_err(&device->dev,
-			"Failed to get unique processor _UID (0x%x)\n",
-			pr->acpi_id);
+		if (pr->acpi_id == 0xff)
+			dev_info_once(&device->dev,
+				"Entry not well-defined, consider updating BIOS\n");
+		else
+			dev_err(&device->dev,
+				"Failed to get unique processor _UID (0x%x)\n",
+				pr->acpi_id);
 		return -ENODEV;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/acpi/acpi_video.c linux-libre-4.14.147-gnu/drivers/acpi/acpi_video.c
--- linux-libre-4.14.146-gnu/drivers/acpi/acpi_video.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/acpi/acpi_video.c	2019-10-05 06:48:14.000000000 -0400
@@ -73,6 +73,12 @@ module_param(report_key_events, int, 064
 MODULE_PARM_DESC(report_key_events,
 	"0: none, 1: output changes, 2: brightness changes, 3: all");
 
+static int hw_changes_brightness = -1;
+module_param(hw_changes_brightness, int, 0644);
+MODULE_PARM_DESC(hw_changes_brightness,
+	"Set this to 1 on buggy hw which changes the brightness itself when "
+	"a hotkey is pressed: -1: auto, 0: normal 1: hw-changes-brightness");
+
 /*
  * Whether the struct acpi_video_device_attrib::device_id_scheme bit should be
  * assumed even if not actually set.
@@ -418,6 +424,14 @@ static int video_set_report_key_events(c
 	return 0;
 }
 
+static int video_hw_changes_brightness(
+	const struct dmi_system_id *d)
+{
+	if (hw_changes_brightness == -1)
+		hw_changes_brightness = 1;
+	return 0;
+}
+
 static const struct dmi_system_id video_dmi_table[] = {
 	/*
 	 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -542,6 +556,21 @@ static const struct dmi_system_id video_
 		DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"),
 		},
 	},
+	/*
+	 * Some machines change the brightness themselves when a brightness
+	 * hotkey gets pressed, despite us telling them not to. In this case
+	 * acpi_video_device_notify() should only call backlight_force_update(
+	 * BACKLIGHT_UPDATE_HOTKEY) and not do anything else.
+	 */
+	{
+	 /* https://bugzilla.kernel.org/show_bug.cgi?id=204077 */
+	 .callback = video_hw_changes_brightness,
+	 .ident = "Packard Bell EasyNote MZ35",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"),
+		DMI_MATCH(DMI_PRODUCT_NAME, "EasyNote MZ35"),
+		},
+	},
 	{}
 };
 
@@ -1624,6 +1653,14 @@ static void acpi_video_device_notify(acp
 	bus = video_device->video;
 	input = bus->input;
 
+	if (hw_changes_brightness > 0) {
+		if (video_device->backlight)
+			backlight_force_update(video_device->backlight,
+					       BACKLIGHT_UPDATE_HOTKEY);
+		acpi_notifier_call_chain(device, event, 0);
+		return;
+	}
+
 	switch (event) {
 	case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:	/* Cycle brightness */
 		brightness_switch_event(video_device, event);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/acpi/cppc_acpi.c linux-libre-4.14.147-gnu/drivers/acpi/cppc_acpi.c
--- linux-libre-4.14.146-gnu/drivers/acpi/cppc_acpi.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/acpi/cppc_acpi.c	2019-10-05 06:48:14.000000000 -0400
@@ -365,8 +365,10 @@ static int acpi_get_psd(struct cpc_desc
 	union acpi_object  *psd = NULL;
 	struct acpi_psd_package *pdomain;
 
-	status = acpi_evaluate_object_typed(handle, "_PSD", NULL, &buffer,
-			ACPI_TYPE_PACKAGE);
+	status = acpi_evaluate_object_typed(handle, "_PSD", NULL,
+					    &buffer, ACPI_TYPE_PACKAGE);
+	if (status == AE_NOT_FOUND)	/* _PSD is optional */
+		return 0;
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/acpi/custom_method.c linux-libre-4.14.147-gnu/drivers/acpi/custom_method.c
--- linux-libre-4.14.146-gnu/drivers/acpi/custom_method.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/acpi/custom_method.c	2019-10-05 06:48:14.000000000 -0400
@@ -48,8 +48,10 @@ static ssize_t cm_write(struct file *fil
 	if ((*ppos > max_size) ||
 	    (*ppos + count > max_size) ||
 	    (*ppos + count < count) ||
-	    (count > uncopied_bytes))
+	    (count > uncopied_bytes)) {
+		kfree(buf);
 		return -EINVAL;
+	}
 
 	if (copy_from_user(buf + (*ppos), user_buf, count)) {
 		kfree(buf);
@@ -69,6 +71,7 @@ static ssize_t cm_write(struct file *fil
 		add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
 	}
 
+	kfree(buf);
 	return count;
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/acpi/pci_irq.c linux-libre-4.14.147-gnu/drivers/acpi/pci_irq.c
--- linux-libre-4.14.146-gnu/drivers/acpi/pci_irq.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/acpi/pci_irq.c	2019-10-05 06:48:14.000000000 -0400
@@ -462,8 +462,10 @@ int acpi_pci_irq_enable(struct pci_dev *
 		 * No IRQ known to the ACPI subsystem - maybe the BIOS /
 		 * driver reported one, then use it. Exit in any case.
 		 */
-		if (!acpi_pci_irq_valid(dev, pin))
+		if (!acpi_pci_irq_valid(dev, pin)) {
+			kfree(entry);
 			return 0;
+		}
 
 		if (acpi_isa_register_gsi(dev))
 			dev_warn(&dev->dev, "PCI INT %c: no GSI\n",
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/base/soc.c linux-libre-4.14.147-gnu/drivers/base/soc.c
--- linux-libre-4.14.146-gnu/drivers/base/soc.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/base/soc.c	2019-10-05 06:48:14.000000000 -0400
@@ -155,6 +155,7 @@ out2:
 out1:
 	return ERR_PTR(ret);
 }
+EXPORT_SYMBOL_GPL(soc_device_register);
 
 /* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
 void soc_device_unregister(struct soc_device *soc_dev)
@@ -164,6 +165,7 @@ void soc_device_unregister(struct soc_de
 	device_unregister(&soc_dev->dev);
 	early_soc_dev_attr = NULL;
 }
+EXPORT_SYMBOL_GPL(soc_device_unregister);
 
 static int __init soc_bus_register(void)
 {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/block/nbd.c linux-libre-4.14.147-gnu/drivers/block/nbd.c
--- linux-libre-4.14.146-gnu/drivers/block/nbd.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/block/nbd.c	2019-10-05 06:48:14.000000000 -0400
@@ -340,8 +340,10 @@ static enum blk_eh_timer_return nbd_xmit
 	}
 	config = nbd->config;
 
-	if (!mutex_trylock(&cmd->lock))
+	if (!mutex_trylock(&cmd->lock)) {
+		nbd_config_put(nbd);
 		return BLK_EH_RESET_TIMER;
+	}
 
 	if (config->num_connections > 1) {
 		dev_err_ratelimited(nbd_to_dev(nbd),
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/bluetooth/btusb.c linux-libre-4.14.147-gnu/drivers/bluetooth/btusb.c
--- linux-libre-4.14.146-gnu/drivers/bluetooth/btusb.c	2019-09-21 06:24:42.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/bluetooth/btusb.c	2019-10-05 12:03:21.000000000 -0400
@@ -388,6 +388,9 @@ static const struct usb_device_id blackl
 	/* Additional Realtek 8822BE Bluetooth devices */
 	{ USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
 
+	/* Additional Realtek 8822CE Bluetooth devices */
+	{ USB_DEVICE(0x04ca, 0x4005), .driver_info = BTUSB_REALTEK },
+
 	/* Silicon Wave based devices */
 	{ USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE },
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/char/hw_random/core.c linux-libre-4.14.147-gnu/drivers/char/hw_random/core.c
--- linux-libre-4.14.146-gnu/drivers/char/hw_random/core.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/char/hw_random/core.c	2019-10-05 06:48:14.000000000 -0400
@@ -67,7 +67,7 @@ static void add_early_randomness(struct
 	size_t size = min_t(size_t, 16, rng_buffer_size());
 
 	mutex_lock(&reading_mutex);
-	bytes_read = rng_get_data(rng, rng_buffer, size, 1);
+	bytes_read = rng_get_data(rng, rng_buffer, size, 0);
 	mutex_unlock(&reading_mutex);
 	if (bytes_read > 0)
 		add_device_randomness(rng_buffer, bytes_read);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/char/mem.c linux-libre-4.14.147-gnu/drivers/char/mem.c
--- linux-libre-4.14.146-gnu/drivers/char/mem.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/char/mem.c	2019-10-05 06:48:14.000000000 -0400
@@ -97,6 +97,13 @@ void __weak unxlate_dev_mem_ptr(phys_add
 }
 #endif
 
+static inline bool should_stop_iteration(void)
+{
+	if (need_resched())
+		cond_resched();
+	return fatal_signal_pending(current);
+}
+
 /*
  * This funcion reads the *physical* memory. The f_pos points directly to the
  * memory location.
@@ -175,6 +182,8 @@ static ssize_t read_mem(struct file *fil
 		p += sz;
 		count -= sz;
 		read += sz;
+		if (should_stop_iteration())
+			break;
 	}
 	kfree(bounce);
 
@@ -251,6 +260,8 @@ static ssize_t write_mem(struct file *fi
 		p += sz;
 		count -= sz;
 		written += sz;
+		if (should_stop_iteration())
+			break;
 	}
 
 	*ppos += written;
@@ -464,6 +475,10 @@ static ssize_t read_kmem(struct file *fi
 			read += sz;
 			low_count -= sz;
 			count -= sz;
+			if (should_stop_iteration()) {
+				count = 0;
+				break;
+			}
 		}
 	}
 
@@ -488,6 +503,8 @@ static ssize_t read_kmem(struct file *fi
 			buf += sz;
 			read += sz;
 			p += sz;
+			if (should_stop_iteration())
+				break;
 		}
 		free_page((unsigned long)kbuf);
 	}
@@ -540,6 +557,8 @@ static ssize_t do_write_kmem(unsigned lo
 		p += sz;
 		count -= sz;
 		written += sz;
+		if (should_stop_iteration())
+			break;
 	}
 
 	*ppos += written;
@@ -591,6 +610,8 @@ static ssize_t write_kmem(struct file *f
 			buf += sz;
 			virtr += sz;
 			p += sz;
+			if (should_stop_iteration())
+				break;
 		}
 		free_page((unsigned long)kbuf);
 	}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/crypto/talitos.c linux-libre-4.14.147-gnu/drivers/crypto/talitos.c
--- linux-libre-4.14.146-gnu/drivers/crypto/talitos.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/crypto/talitos.c	2019-10-05 06:48:14.000000000 -0400
@@ -3043,6 +3043,7 @@ static int talitos_remove(struct platfor
 			break;
 		case CRYPTO_ALG_TYPE_AEAD:
 			crypto_unregister_aead(&t_alg->algt.alg.aead);
+			break;
 		case CRYPTO_ALG_TYPE_AHASH:
 			crypto_unregister_ahash(&t_alg->algt.alg.hash);
 			break;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/devfreq/exynos-bus.c linux-libre-4.14.147-gnu/drivers/devfreq/exynos-bus.c
--- linux-libre-4.14.146-gnu/drivers/devfreq/exynos-bus.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/devfreq/exynos-bus.c	2019-10-05 06:48:14.000000000 -0400
@@ -194,11 +194,10 @@ static void exynos_bus_exit(struct devic
 	if (ret < 0)
 		dev_warn(dev, "failed to disable the devfreq-event devices\n");
 
-	if (bus->regulator)
-		regulator_disable(bus->regulator);
-
 	dev_pm_opp_of_remove_table(dev);
 	clk_disable_unprepare(bus->clk);
+	if (bus->regulator)
+		regulator_disable(bus->regulator);
 }
 
 /*
@@ -386,6 +385,7 @@ static int exynos_bus_probe(struct platf
 	struct exynos_bus *bus;
 	int ret, max_state;
 	unsigned long min_freq, max_freq;
+	bool passive = false;
 
 	if (!np) {
 		dev_err(dev, "failed to find devicetree node\n");
@@ -399,27 +399,27 @@ static int exynos_bus_probe(struct platf
 	bus->dev = &pdev->dev;
 	platform_set_drvdata(pdev, bus);
 
-	/* Parse the device-tree to get the resource information */
-	ret = exynos_bus_parse_of(np, bus);
-	if (ret < 0)
-		return ret;
-
 	profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL);
-	if (!profile) {
-		ret = -ENOMEM;
-		goto err;
-	}
+	if (!profile)
+		return -ENOMEM;
 
 	node = of_parse_phandle(dev->of_node, "devfreq", 0);
 	if (node) {
 		of_node_put(node);
-		goto passive;
+		passive = true;
 	} else {
 		ret = exynos_bus_parent_parse_of(np, bus);
+		if (ret < 0)
+			return ret;
 	}
 
+	/* Parse the device-tree to get the resource information */
+	ret = exynos_bus_parse_of(np, bus);
 	if (ret < 0)
-		goto err;
+		goto err_reg;
+
+	if (passive)
+		goto passive;
 
 	/* Initialize the struct profile and governor data for parent device */
 	profile->polling_ms = 50;
@@ -509,6 +509,9 @@ out:
 err:
 	dev_pm_opp_of_remove_table(dev);
 	clk_disable_unprepare(bus->clk);
+err_reg:
+	if (!passive)
+		regulator_disable(bus->regulator);
 
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/devfreq/governor_passive.c linux-libre-4.14.147-gnu/drivers/devfreq/governor_passive.c
--- linux-libre-4.14.146-gnu/drivers/devfreq/governor_passive.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/devfreq/governor_passive.c	2019-10-05 06:48:14.000000000 -0400
@@ -152,7 +152,6 @@ static int devfreq_passive_notifier_call
 static int devfreq_passive_event_handler(struct devfreq *devfreq,
 				unsigned int event, void *data)
 {
-	struct device *dev = devfreq->dev.parent;
 	struct devfreq_passive_data *p_data
 			= (struct devfreq_passive_data *)devfreq->data;
 	struct devfreq *parent = (struct devfreq *)p_data->parent;
@@ -168,12 +167,12 @@ static int devfreq_passive_event_handler
 			p_data->this = devfreq;
 
 		nb->notifier_call = devfreq_passive_notifier_call;
-		ret = devm_devfreq_register_notifier(dev, parent, nb,
+		ret = devfreq_register_notifier(parent, nb,
 					DEVFREQ_TRANSITION_NOTIFIER);
 		break;
 	case DEVFREQ_GOV_STOP:
-		devm_devfreq_unregister_notifier(dev, parent, nb,
-					DEVFREQ_TRANSITION_NOTIFIER);
+		WARN_ON(devfreq_unregister_notifier(parent, nb,
+					DEVFREQ_TRANSITION_NOTIFIER));
 		break;
 	default:
 		break;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/dma/bcm2835-dma.c linux-libre-4.14.147-gnu/drivers/dma/bcm2835-dma.c
--- linux-libre-4.14.146-gnu/drivers/dma/bcm2835-dma.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/dma/bcm2835-dma.c	2019-10-05 06:48:14.000000000 -0400
@@ -891,8 +891,10 @@ static int bcm2835_dma_probe(struct plat
 		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
 
 	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
-	if (rc)
+	if (rc) {
+		dev_err(&pdev->dev, "Unable to set DMA mask\n");
 		return rc;
+	}
 
 	od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL);
 	if (!od)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/dma/edma.c linux-libre-4.14.147-gnu/drivers/dma/edma.c
--- linux-libre-4.14.146-gnu/drivers/dma/edma.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/dma/edma.c	2019-10-05 06:48:14.000000000 -0400
@@ -2268,9 +2268,6 @@ static int edma_probe(struct platform_de
 
 	ecc->default_queue = info->default_queue;
 
-	for (i = 0; i < ecc->num_slots; i++)
-		edma_write_slot(ecc, i, &dummy_paramset);
-
 	if (info->rsv) {
 		/* Set the reserved slots in inuse list */
 		rsv_slots = info->rsv->rsv_slots;
@@ -2283,6 +2280,12 @@ static int edma_probe(struct platform_de
 		}
 	}
 
+	for (i = 0; i < ecc->num_slots; i++) {
+		/* Reset only unused - not reserved - paRAM slots */
+		if (!test_bit(i, ecc->slot_inuse))
+			edma_write_slot(ecc, i, &dummy_paramset);
+	}
+
 	/* Clear the xbar mapped channels in unused list */
 	xbar_chans = info->xbar_chans;
 	if (xbar_chans) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/dma/iop-adma.c linux-libre-4.14.147-gnu/drivers/dma/iop-adma.c
--- linux-libre-4.14.146-gnu/drivers/dma/iop-adma.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/dma/iop-adma.c	2019-10-05 06:48:14.000000000 -0400
@@ -125,9 +125,9 @@ static void __iop_adma_slot_cleanup(stru
 	list_for_each_entry_safe(iter, _iter, &iop_chan->chain,
 					chain_node) {
 		pr_debug("\tcookie: %d slot: %d busy: %d "
-			"this_desc: %#x next_desc: %#x ack: %d\n",
+			"this_desc: %#x next_desc: %#llx ack: %d\n",
 			iter->async_tx.cookie, iter->idx, busy,
-			iter->async_tx.phys, iop_desc_get_next_desc(iter),
+			iter->async_tx.phys, (u64)iop_desc_get_next_desc(iter),
 			async_tx_test_ack(&iter->async_tx));
 		prefetch(_iter);
 		prefetch(&_iter->async_tx);
@@ -315,9 +315,9 @@ retry:
 				int i;
 				dev_dbg(iop_chan->device->common.dev,
 					"allocated slot: %d "
-					"(desc %p phys: %#x) slots_per_op %d\n",
+					"(desc %p phys: %#llx) slots_per_op %d\n",
 					iter->idx, iter->hw_desc,
-					iter->async_tx.phys, slots_per_op);
+					(u64)iter->async_tx.phys, slots_per_op);
 
 				/* pre-ack all but the last descriptor */
 				if (num_slots != slots_per_op)
@@ -525,7 +525,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan
 		return NULL;
 	BUG_ON(len > IOP_ADMA_MAX_BYTE_COUNT);
 
-	dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
+	dev_dbg(iop_chan->device->common.dev, "%s len: %zu\n",
 		__func__, len);
 
 	spin_lock_bh(&iop_chan->lock);
@@ -558,7 +558,7 @@ iop_adma_prep_dma_xor(struct dma_chan *c
 	BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
 
 	dev_dbg(iop_chan->device->common.dev,
-		"%s src_cnt: %d len: %u flags: %lx\n",
+		"%s src_cnt: %d len: %zu flags: %lx\n",
 		__func__, src_cnt, len, flags);
 
 	spin_lock_bh(&iop_chan->lock);
@@ -591,7 +591,7 @@ iop_adma_prep_dma_xor_val(struct dma_cha
 	if (unlikely(!len))
 		return NULL;
 
-	dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
+	dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %zu\n",
 		__func__, src_cnt, len);
 
 	spin_lock_bh(&iop_chan->lock);
@@ -629,7 +629,7 @@ iop_adma_prep_dma_pq(struct dma_chan *ch
 	BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
 
 	dev_dbg(iop_chan->device->common.dev,
-		"%s src_cnt: %d len: %u flags: %lx\n",
+		"%s src_cnt: %d len: %zu flags: %lx\n",
 		__func__, src_cnt, len, flags);
 
 	if (dmaf_p_disabled_continue(flags))
@@ -692,7 +692,7 @@ iop_adma_prep_dma_pq_val(struct dma_chan
 		return NULL;
 	BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
 
-	dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
+	dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %zu\n",
 		__func__, src_cnt, len);
 
 	spin_lock_bh(&iop_chan->lock);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/edac/altera_edac.c linux-libre-4.14.147-gnu/drivers/edac/altera_edac.c
--- linux-libre-4.14.146-gnu/drivers/edac/altera_edac.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/edac/altera_edac.c	2019-10-05 06:48:14.000000000 -0400
@@ -1646,6 +1646,7 @@ static void altr_edac_a10_irq_handler(st
 	struct altr_arria10_edac *edac = irq_desc_get_handler_data(desc);
 	struct irq_chip *chip = irq_desc_get_chip(desc);
 	int irq = irq_desc_get_irq(desc);
+	unsigned long bits;
 
 	dberr = (irq == edac->db_irq) ? 1 : 0;
 	sm_offset = dberr ? A10_SYSMGR_ECC_INTSTAT_DERR_OFST :
@@ -1655,7 +1656,8 @@ static void altr_edac_a10_irq_handler(st
 
 	regmap_read(edac->ecc_mgr_map, sm_offset, &irq_status);
 
-	for_each_set_bit(bit, (unsigned long *)&irq_status, 32) {
+	bits = irq_status;
+	for_each_set_bit(bit, &bits, 32) {
 		irq = irq_linear_revmap(edac->domain, dberr * 32 + bit);
 		if (irq)
 			generic_handle_irq(irq);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/edac/amd64_edac.c linux-libre-4.14.147-gnu/drivers/edac/amd64_edac.c
--- linux-libre-4.14.146-gnu/drivers/edac/amd64_edac.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/edac/amd64_edac.c	2019-10-05 06:48:14.000000000 -0400
@@ -2501,13 +2501,6 @@ static void decode_umc_error(int node_id
 		goto log_error;
 	}
 
-	if (umc_normaddr_to_sysaddr(m->addr, pvt->mc_node_id, err.channel, &sys_addr)) {
-		err.err_code = ERR_NORM_ADDR;
-		goto log_error;
-	}
-
-	error_address_to_page_and_offset(sys_addr, &err);
-
 	if (!(m->status & MCI_STATUS_SYNDV)) {
 		err.err_code = ERR_SYND;
 		goto log_error;
@@ -2524,6 +2517,13 @@ static void decode_umc_error(int node_id
 
 	err.csrow = m->synd & 0x7;
 
+	if (umc_normaddr_to_sysaddr(m->addr, pvt->mc_node_id, err.channel, &sys_addr)) {
+		err.err_code = ERR_NORM_ADDR;
+		goto log_error;
+	}
+
+	error_address_to_page_and_offset(sys_addr, &err);
+
 log_error:
 	__log_ecc_error(mci, &err, ecc_type);
 }
@@ -3101,12 +3101,15 @@ static bool ecc_enabled(struct pci_dev *
 static inline void
 f17h_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt)
 {
-	u8 i, ecc_en = 1, cpk_en = 1;
+	u8 i, ecc_en = 1, cpk_en = 1, dev_x4 = 1, dev_x16 = 1;
 
 	for (i = 0; i < NUM_UMCS; i++) {
 		if (pvt->umc[i].sdp_ctrl & UMC_SDP_INIT) {
 			ecc_en &= !!(pvt->umc[i].umc_cap_hi & UMC_ECC_ENABLED);
 			cpk_en &= !!(pvt->umc[i].umc_cap_hi & UMC_ECC_CHIPKILL_CAP);
+
+			dev_x4  &= !!(pvt->umc[i].dimm_cfg & BIT(6));
+			dev_x16 &= !!(pvt->umc[i].dimm_cfg & BIT(7));
 		}
 	}
 
@@ -3114,8 +3117,15 @@ f17h_determine_edac_ctl_cap(struct mem_c
 	if (ecc_en) {
 		mci->edac_ctl_cap |= EDAC_FLAG_SECDED;
 
-		if (cpk_en)
+		if (!cpk_en)
+			return;
+
+		if (dev_x4)
 			mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED;
+		else if (dev_x16)
+			mci->edac_ctl_cap |= EDAC_FLAG_S16ECD16ED;
+		else
+			mci->edac_ctl_cap |= EDAC_FLAG_S8ECD8ED;
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/edac/edac_mc.c linux-libre-4.14.147-gnu/drivers/edac/edac_mc.c
--- linux-libre-4.14.146-gnu/drivers/edac/edac_mc.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/edac/edac_mc.c	2019-10-05 06:48:14.000000000 -0400
@@ -1240,9 +1240,13 @@ void edac_mc_handle_error(const enum hw_
 	if (p > e->location)
 		*(p - 1) = '\0';
 
-	/* Report the error via the trace interface */
-	grain_bits = fls_long(e->grain) + 1;
+	/* Sanity-check driver-supplied grain value. */
+	if (WARN_ON_ONCE(!e->grain))
+		e->grain = 1;
+
+	grain_bits = fls_long(e->grain - 1);
 
+	/* Report the error via the trace interface */
 	if (IS_ENABLED(CONFIG_RAS))
 		trace_mc_event(type, e->msg, e->label, e->error_count,
 			       mci->mc_idx, e->top_layer, e->mid_layer,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/edac/pnd2_edac.c linux-libre-4.14.147-gnu/drivers/edac/pnd2_edac.c
--- linux-libre-4.14.146-gnu/drivers/edac/pnd2_edac.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/edac/pnd2_edac.c	2019-10-05 06:48:14.000000000 -0400
@@ -266,11 +266,14 @@ static u64 get_sideband_reg_base_addr(vo
 	}
 }
 
+#define DNV_MCHBAR_SIZE  0x8000
+#define DNV_SB_PORT_SIZE 0x10000
 static int dnv_rd_reg(int port, int off, int op, void *data, size_t sz, char *name)
 {
 	struct pci_dev *pdev;
 	char *base;
 	u64 addr;
+	unsigned long size;
 
 	if (op == 4) {
 		pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x1980, NULL);
@@ -285,15 +288,17 @@ static int dnv_rd_reg(int port, int off,
 			addr = get_mem_ctrl_hub_base_addr();
 			if (!addr)
 				return -ENODEV;
+			size = DNV_MCHBAR_SIZE;
 		} else {
 			/* MMIO via sideband register base address */
 			addr = get_sideband_reg_base_addr();
 			if (!addr)
 				return -ENODEV;
 			addr += (port << 16);
+			size = DNV_SB_PORT_SIZE;
 		}
 
-		base = ioremap((resource_size_t)addr, 0x10000);
+		base = ioremap((resource_size_t)addr, size);
 		if (!base)
 			return -ENODEV;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/firmware/efi/cper.c linux-libre-4.14.147-gnu/drivers/firmware/efi/cper.c
--- linux-libre-4.14.146-gnu/drivers/firmware/efi/cper.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/firmware/efi/cper.c	2019-10-05 06:48:14.000000000 -0400
@@ -507,6 +507,21 @@ static void cper_print_pcie(const char *
 		printk(
 	"%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n",
 	pfx, pcie->bridge.secondary_status, pcie->bridge.control);
+
+	/* Fatal errors call __ghes_panic() before AER handler prints this */
+	if ((pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) &&
+	    (gdata->error_severity & CPER_SEV_FATAL)) {
+		struct aer_capability_regs *aer;
+
+		aer = (struct aer_capability_regs *)pcie->aer_info;
+		printk("%saer_uncor_status: 0x%08x, aer_uncor_mask: 0x%08x\n",
+		       pfx, aer->uncor_status, aer->uncor_mask);
+		printk("%saer_uncor_severity: 0x%08x\n",
+		       pfx, aer->uncor_severity);
+		printk("%sTLP Header: %08x %08x %08x %08x\n", pfx,
+		       aer->header_log.dw0, aer->header_log.dw1,
+		       aer->header_log.dw2, aer->header_log.dw3);
+	}
 }
 
 static void cper_print_tstamp(const char *pfx,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c linux-libre-4.14.147-gnu/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
--- linux-libre-4.14.146-gnu/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c	2019-10-05 06:48:14.000000000 -0400
@@ -3972,6 +3972,11 @@ static int smu7_program_display_gap(stru
 
 	data->frame_time_x2 = frame_time_in_us * 2 / 100;
 
+	if (data->frame_time_x2 < 280) {
+		pr_debug("%s: enforce minimal VBITimeout: %d -> 280\n", __func__, data->frame_time_x2);
+		data->frame_time_x2 = 280;
+	}
+
 	display_gap2 = pre_vbi_time_in_us * (ref_clock / 100);
 
 	cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL2, display_gap2);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/gpu/drm/drm_probe_helper.c linux-libre-4.14.147-gnu/drivers/gpu/drm/drm_probe_helper.c
--- linux-libre-4.14.146-gnu/drivers/gpu/drm/drm_probe_helper.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/gpu/drm/drm_probe_helper.c	2019-10-05 06:48:14.000000000 -0400
@@ -593,6 +593,9 @@ static void output_poll_execute(struct w
 	enum drm_connector_status old_status;
 	bool repoll = false, changed;
 
+	if (!dev->mode_config.poll_enabled)
+		return;
+
 	/* Pick up any changes detected by the probe functions. */
 	changed = dev->mode_config.delayed_event;
 	dev->mode_config.delayed_event = false;
@@ -747,7 +750,11 @@ EXPORT_SYMBOL(drm_kms_helper_poll_init);
  */
 void drm_kms_helper_poll_fini(struct drm_device *dev)
 {
-	drm_kms_helper_poll_disable(dev);
+	if (!dev->mode_config.poll_enabled)
+		return;
+
+	dev->mode_config.poll_enabled = false;
+	cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_fini);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/hid/hid-lg4ff.c linux-libre-4.14.147-gnu/drivers/hid/hid-lg4ff.c
--- linux-libre-4.14.146-gnu/drivers/hid/hid-lg4ff.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/hid/hid-lg4ff.c	2019-10-05 06:48:14.000000000 -0400
@@ -1485,7 +1485,6 @@ int lg4ff_deinit(struct hid_device *hid)
 		}
 	}
 #endif
-	hid_hw_stop(hid);
 	drv_data->device_props = NULL;
 
 	kfree(entry);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/hid/hid-lg.c linux-libre-4.14.147-gnu/drivers/hid/hid-lg.c
--- linux-libre-4.14.146-gnu/drivers/hid/hid-lg.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/hid/hid-lg.c	2019-10-05 06:48:14.000000000 -0400
@@ -761,7 +761,7 @@ static int lg_probe(struct hid_device *h
 
 		if (!buf) {
 			ret = -ENOMEM;
-			goto err_free;
+			goto err_stop;
 		}
 
 		ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
@@ -793,9 +793,12 @@ static int lg_probe(struct hid_device *h
 		ret = lg4ff_init(hdev);
 
 	if (ret)
-		goto err_free;
+		goto err_stop;
 
 	return 0;
+
+err_stop:
+	hid_hw_stop(hdev);
 err_free:
 	kfree(drv_data);
 	return ret;
@@ -806,8 +809,7 @@ static void lg_remove(struct hid_device
 	struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
 	if (drv_data->quirks & LG_FF4)
 		lg4ff_deinit(hdev);
-	else
-		hid_hw_stop(hdev);
+	hid_hw_stop(hdev);
 	kfree(drv_data);
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/hid/hid-prodikeys.c linux-libre-4.14.147-gnu/drivers/hid/hid-prodikeys.c
--- linux-libre-4.14.146-gnu/drivers/hid/hid-prodikeys.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/hid/hid-prodikeys.c	2019-10-05 06:48:14.000000000 -0400
@@ -556,10 +556,14 @@ static void pcmidi_setup_extra_keys(
 
 static int pcmidi_set_operational(struct pcmidi_snd *pm)
 {
+	int rc;
+
 	if (pm->ifnum != 1)
 		return 0; /* only set up ONCE for interace 1 */
 
-	pcmidi_get_output_report(pm);
+	rc = pcmidi_get_output_report(pm);
+	if (rc < 0)
+		return rc;
 	pcmidi_submit_output_report(pm, 0xc1);
 	return 0;
 }
@@ -688,7 +692,11 @@ static int pcmidi_snd_initialise(struct
 	spin_lock_init(&pm->rawmidi_in_lock);
 
 	init_sustain_timers(pm);
-	pcmidi_set_operational(pm);
+	err = pcmidi_set_operational(pm);
+	if (err < 0) {
+		pk_error("failed to find output report\n");
+		goto fail_register;
+	}
 
 	/* register it */
 	err = snd_card_register(card);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/hid/hidraw.c linux-libre-4.14.147-gnu/drivers/hid/hidraw.c
--- linux-libre-4.14.146-gnu/drivers/hid/hidraw.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/hid/hidraw.c	2019-10-05 06:48:14.000000000 -0400
@@ -378,7 +378,7 @@ static long hidraw_ioctl(struct file *fi
 
 	mutex_lock(&minors_lock);
 	dev = hidraw_table[minor];
-	if (!dev) {
+	if (!dev || !dev->exist) {
 		ret = -ENODEV;
 		goto out;
 	}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/hid/hid-sony.c linux-libre-4.14.147-gnu/drivers/hid/hid-sony.c
--- linux-libre-4.14.146-gnu/drivers/hid/hid-sony.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/hid/hid-sony.c	2019-10-05 06:48:14.000000000 -0400
@@ -2710,7 +2710,6 @@ err_stop:
 	kfree(sc->output_report_dmabuf);
 	sony_remove_dev_list(sc);
 	sony_release_device_id(sc);
-	hid_hw_stop(hdev);
 	return ret;
 }
 
@@ -2772,6 +2771,7 @@ static int sony_probe(struct hid_device
 	 */
 	if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
 		hid_err(hdev, "failed to claim input\n");
+		hid_hw_stop(hdev);
 		return -ENODEV;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/hwmon/acpi_power_meter.c linux-libre-4.14.147-gnu/drivers/hwmon/acpi_power_meter.c
--- linux-libre-4.14.146-gnu/drivers/hwmon/acpi_power_meter.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/hwmon/acpi_power_meter.c	2019-10-05 06:48:14.000000000 -0400
@@ -693,8 +693,8 @@ static int setup_attrs(struct acpi_power
 
 	if (resource->caps.flags & POWER_METER_CAN_CAP) {
 		if (!can_cap_in_hardware()) {
-			dev_err(&resource->acpi_dev->dev,
-				"Ignoring unsafe software power cap!\n");
+			dev_warn(&resource->acpi_dev->dev,
+				 "Ignoring unsafe software power cap!\n");
 			goto skip_unsafe_cap;
 		}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/i2c/busses/i2c-riic.c linux-libre-4.14.147-gnu/drivers/i2c/busses/i2c-riic.c
--- linux-libre-4.14.146-gnu/drivers/i2c/busses/i2c-riic.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/i2c/busses/i2c-riic.c	2019-10-05 06:48:14.000000000 -0400
@@ -212,6 +212,7 @@ static irqreturn_t riic_tend_isr(int irq
 	if (readb(riic->base + RIIC_ICSR2) & ICSR2_NACKF) {
 		/* We got a NACKIE */
 		readb(riic->base + RIIC_ICDRR);	/* dummy read */
+		riic_clear_set_bit(riic, ICSR2_NACKF, 0, RIIC_ICSR2);
 		riic->err = -ENXIO;
 	} else if (riic->bytes_left) {
 		return IRQ_NONE;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/infiniband/core/cq.c linux-libre-4.14.147-gnu/drivers/infiniband/core/cq.c
--- linux-libre-4.14.146-gnu/drivers/infiniband/core/cq.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/infiniband/core/cq.c	2019-10-05 06:48:14.000000000 -0400
@@ -112,12 +112,12 @@ static void ib_cq_poll_work(struct work_
 				    IB_POLL_BATCH);
 	if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
 	    ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
-		queue_work(ib_comp_wq, &cq->work);
+		queue_work(cq->comp_wq, &cq->work);
 }
 
 static void ib_cq_completion_workqueue(struct ib_cq *cq, void *private)
 {
-	queue_work(ib_comp_wq, &cq->work);
+	queue_work(cq->comp_wq, &cq->work);
 }
 
 /**
@@ -169,9 +169,12 @@ struct ib_cq *ib_alloc_cq(struct ib_devi
 		ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
 		break;
 	case IB_POLL_WORKQUEUE:
+	case IB_POLL_UNBOUND_WORKQUEUE:
 		cq->comp_handler = ib_cq_completion_workqueue;
 		INIT_WORK(&cq->work, ib_cq_poll_work);
 		ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
+		cq->comp_wq = (cq->poll_ctx == IB_POLL_WORKQUEUE) ?
+				ib_comp_wq : ib_comp_unbound_wq;
 		break;
 	default:
 		ret = -EINVAL;
@@ -206,6 +209,7 @@ void ib_free_cq(struct ib_cq *cq)
 		irq_poll_disable(&cq->iop);
 		break;
 	case IB_POLL_WORKQUEUE:
+	case IB_POLL_UNBOUND_WORKQUEUE:
 		cancel_work_sync(&cq->work);
 		break;
 	default:
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/infiniband/core/device.c linux-libre-4.14.147-gnu/drivers/infiniband/core/device.c
--- linux-libre-4.14.146-gnu/drivers/infiniband/core/device.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/infiniband/core/device.c	2019-10-05 06:48:14.000000000 -0400
@@ -61,6 +61,7 @@ struct ib_client_data {
 };
 
 struct workqueue_struct *ib_comp_wq;
+struct workqueue_struct *ib_comp_unbound_wq;
 struct workqueue_struct *ib_wq;
 EXPORT_SYMBOL_GPL(ib_wq);
 
@@ -1202,10 +1203,19 @@ static int __init ib_core_init(void)
 		goto err;
 	}
 
+	ib_comp_unbound_wq =
+		alloc_workqueue("ib-comp-unb-wq",
+				WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM |
+				WQ_SYSFS, WQ_UNBOUND_MAX_ACTIVE);
+	if (!ib_comp_unbound_wq) {
+		ret = -ENOMEM;
+		goto err_comp;
+	}
+
 	ret = class_register(&ib_class);
 	if (ret) {
 		pr_warn("Couldn't create InfiniBand device class\n");
-		goto err_comp;
+		goto err_comp_unbound;
 	}
 
 	ret = rdma_nl_init();
@@ -1254,6 +1264,8 @@ err_ibnl:
 	rdma_nl_exit();
 err_sysfs:
 	class_unregister(&ib_class);
+err_comp_unbound:
+	destroy_workqueue(ib_comp_unbound_wq);
 err_comp:
 	destroy_workqueue(ib_comp_wq);
 err:
@@ -1272,6 +1284,7 @@ static void __exit ib_core_cleanup(void)
 	addr_cleanup();
 	rdma_nl_exit();
 	class_unregister(&ib_class);
+	destroy_workqueue(ib_comp_unbound_wq);
 	destroy_workqueue(ib_comp_wq);
 	/* Make sure that any pending umem accounting work is done. */
 	destroy_workqueue(ib_wq);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/infiniband/core/mad.c linux-libre-4.14.147-gnu/drivers/infiniband/core/mad.c
--- linux-libre-4.14.146-gnu/drivers/infiniband/core/mad.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/infiniband/core/mad.c	2019-10-05 06:48:14.000000000 -0400
@@ -3178,7 +3178,7 @@ static int ib_mad_port_open(struct ib_de
 	}
 
 	port_priv->cq = ib_alloc_cq(port_priv->device, port_priv, cq_size, 0,
-			IB_POLL_WORKQUEUE);
+			IB_POLL_UNBOUND_WORKQUEUE);
 	if (IS_ERR(port_priv->cq)) {
 		dev_err(&device->dev, "Couldn't create ib_mad CQ\n");
 		ret = PTR_ERR(port_priv->cq);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/infiniband/hw/hfi1/mad.c linux-libre-4.14.147-gnu/drivers/infiniband/hw/hfi1/mad.c
--- linux-libre-4.14.146-gnu/drivers/infiniband/hw/hfi1/mad.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/infiniband/hw/hfi1/mad.c	2019-10-05 06:48:14.000000000 -0400
@@ -2311,7 +2311,7 @@ struct opa_port_status_req {
 	__be32 vl_select_mask;
 };
 
-#define VL_MASK_ALL		0x000080ff
+#define VL_MASK_ALL		0x00000000000080ffUL
 
 struct opa_port_status_rsp {
 	__u8 port_num;
@@ -2610,15 +2610,14 @@ static int pma_get_opa_classportinfo(str
 }
 
 static void a0_portstatus(struct hfi1_pportdata *ppd,
-			  struct opa_port_status_rsp *rsp, u32 vl_select_mask)
+			  struct opa_port_status_rsp *rsp)
 {
 	if (!is_bx(ppd->dd)) {
 		unsigned long vl;
 		u64 sum_vl_xmit_wait = 0;
-		u32 vl_all_mask = VL_MASK_ALL;
+		unsigned long vl_all_mask = VL_MASK_ALL;
 
-		for_each_set_bit(vl, (unsigned long *)&(vl_all_mask),
-				 8 * sizeof(vl_all_mask)) {
+		for_each_set_bit(vl, &vl_all_mask, BITS_PER_LONG) {
 			u64 tmp = sum_vl_xmit_wait +
 				  read_port_cntr(ppd, C_TX_WAIT_VL,
 						 idx_from_vl(vl));
@@ -2642,12 +2641,12 @@ static int pma_get_opa_portstatus(struct
 		(struct opa_port_status_req *)pmp->data;
 	struct hfi1_devdata *dd = dd_from_ibdev(ibdev);
 	struct opa_port_status_rsp *rsp;
-	u32 vl_select_mask = be32_to_cpu(req->vl_select_mask);
+	unsigned long vl_select_mask = be32_to_cpu(req->vl_select_mask);
 	unsigned long vl;
 	size_t response_data_size;
 	u32 nports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
 	u8 port_num = req->port_num;
-	u8 num_vls = hweight32(vl_select_mask);
+	u8 num_vls = hweight64(vl_select_mask);
 	struct _vls_pctrs *vlinfo;
 	struct hfi1_ibport *ibp = to_iport(ibdev, port);
 	struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
@@ -2681,7 +2680,7 @@ static int pma_get_opa_portstatus(struct
 
 	hfi1_read_link_quality(dd, &rsp->link_quality_indicator);
 
-	rsp->vl_select_mask = cpu_to_be32(vl_select_mask);
+	rsp->vl_select_mask = cpu_to_be32((u32)vl_select_mask);
 	rsp->port_xmit_data = cpu_to_be64(read_dev_cntr(dd, C_DC_XMIT_FLITS,
 					  CNTR_INVALID_VL));
 	rsp->port_rcv_data = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FLITS,
@@ -2744,8 +2743,7 @@ static int pma_get_opa_portstatus(struct
 	 * So in the for_each_set_bit() loop below, we don't need
 	 * any additional checks for vl.
 	 */
-	for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
-			 8 * sizeof(vl_select_mask)) {
+	for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
 		memset(vlinfo, 0, sizeof(*vlinfo));
 
 		tmp = read_dev_cntr(dd, C_DC_RX_FLIT_VL, idx_from_vl(vl));
@@ -2782,7 +2780,7 @@ static int pma_get_opa_portstatus(struct
 		vfi++;
 	}
 
-	a0_portstatus(ppd, rsp, vl_select_mask);
+	a0_portstatus(ppd, rsp);
 
 	if (resp_len)
 		*resp_len += response_data_size;
@@ -2829,16 +2827,14 @@ static u64 get_error_counter_summary(str
 	return error_counter_summary;
 }
 
-static void a0_datacounters(struct hfi1_pportdata *ppd, struct _port_dctrs *rsp,
-			    u32 vl_select_mask)
+static void a0_datacounters(struct hfi1_pportdata *ppd, struct _port_dctrs *rsp)
 {
 	if (!is_bx(ppd->dd)) {
 		unsigned long vl;
 		u64 sum_vl_xmit_wait = 0;
-		u32 vl_all_mask = VL_MASK_ALL;
+		unsigned long vl_all_mask = VL_MASK_ALL;
 
-		for_each_set_bit(vl, (unsigned long *)&(vl_all_mask),
-				 8 * sizeof(vl_all_mask)) {
+		for_each_set_bit(vl, &vl_all_mask, BITS_PER_LONG) {
 			u64 tmp = sum_vl_xmit_wait +
 				  read_port_cntr(ppd, C_TX_WAIT_VL,
 						 idx_from_vl(vl));
@@ -2894,7 +2890,7 @@ static int pma_get_opa_datacounters(stru
 	u64 port_mask;
 	u8 port_num;
 	unsigned long vl;
-	u32 vl_select_mask;
+	unsigned long vl_select_mask;
 	int vfi;
 
 	num_ports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
@@ -2963,8 +2959,7 @@ static int pma_get_opa_datacounters(stru
 	 * So in the for_each_set_bit() loop below, we don't need
 	 * any additional checks for vl.
 	 */
-	for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
-			 8 * sizeof(req->vl_select_mask)) {
+	for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
 		memset(vlinfo, 0, sizeof(*vlinfo));
 
 		rsp->vls[vfi].port_vl_xmit_data =
@@ -3007,7 +3002,7 @@ static int pma_get_opa_datacounters(stru
 		vfi++;
 	}
 
-	a0_datacounters(ppd, rsp, vl_select_mask);
+	a0_datacounters(ppd, rsp);
 
 	if (resp_len)
 		*resp_len += response_data_size;
@@ -3102,7 +3097,7 @@ static int pma_get_opa_porterrors(struct
 	struct _vls_ectrs *vlinfo;
 	unsigned long vl;
 	u64 port_mask, tmp;
-	u32 vl_select_mask;
+	unsigned long vl_select_mask;
 	int vfi;
 
 	req = (struct opa_port_error_counters64_msg *)pmp->data;
@@ -3161,8 +3156,7 @@ static int pma_get_opa_porterrors(struct
 	vlinfo = &rsp->vls[0];
 	vfi = 0;
 	vl_select_mask = be32_to_cpu(req->vl_select_mask);
-	for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
-			 8 * sizeof(req->vl_select_mask)) {
+	for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
 		memset(vlinfo, 0, sizeof(*vlinfo));
 		rsp->vls[vfi].port_vl_xmit_discards =
 			cpu_to_be64(read_port_cntr(ppd, C_SW_XMIT_DSCD_VL,
@@ -3372,7 +3366,7 @@ static int pma_set_opa_portstatus(struct
 	u32 nports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
 	u64 portn = be64_to_cpu(req->port_select_mask[3]);
 	u32 counter_select = be32_to_cpu(req->counter_select_mask);
-	u32 vl_select_mask = VL_MASK_ALL; /* clear all per-vl cnts */
+	unsigned long vl_select_mask = VL_MASK_ALL; /* clear all per-vl cnts */
 	unsigned long vl;
 
 	if ((nports != 1) || (portn != 1 << port)) {
@@ -3464,8 +3458,7 @@ static int pma_set_opa_portstatus(struct
 	if (counter_select & CS_UNCORRECTABLE_ERRORS)
 		write_dev_cntr(dd, C_DC_UNC_ERR, CNTR_INVALID_VL, 0);
 
-	for_each_set_bit(vl, (unsigned long *)&(vl_select_mask),
-			 8 * sizeof(vl_select_mask)) {
+	for_each_set_bit(vl, &vl_select_mask, BITS_PER_LONG) {
 		if (counter_select & CS_PORT_XMIT_DATA)
 			write_port_cntr(ppd, C_TX_FLIT_VL, idx_from_vl(vl), 0);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/iommu/amd_iommu.c linux-libre-4.14.147-gnu/drivers/iommu/amd_iommu.c
--- linux-libre-4.14.146-gnu/drivers/iommu/amd_iommu.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/iommu/amd_iommu.c	2019-10-05 06:48:14.000000000 -0400
@@ -2568,7 +2568,9 @@ static int map_sg(struct device *dev, st
 
 			bus_addr  = address + s->dma_address + (j << PAGE_SHIFT);
 			phys_addr = (sg_phys(s) & PAGE_MASK) + (j << PAGE_SHIFT);
-			ret = iommu_map_page(domain, bus_addr, phys_addr, PAGE_SIZE, prot, GFP_ATOMIC);
+			ret = iommu_map_page(domain, bus_addr, phys_addr,
+					     PAGE_SIZE, prot,
+					     GFP_ATOMIC | __GFP_NOWARN);
 			if (ret)
 				goto out_unmap;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/iommu/iova.c linux-libre-4.14.147-gnu/drivers/iommu/iova.c
--- linux-libre-4.14.146-gnu/drivers/iommu/iova.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/iommu/iova.c	2019-10-05 06:48:14.000000000 -0400
@@ -607,7 +607,9 @@ void queue_iova(struct iova_domain *iova
 
 	spin_unlock_irqrestore(&fq->lock, flags);
 
-	if (atomic_cmpxchg(&iovad->fq_timer_on, 0, 1) == 0)
+	/* Avoid false sharing as much as possible. */
+	if (!atomic_read(&iovad->fq_timer_on) &&
+	    !atomic_cmpxchg(&iovad->fq_timer_on, 0, 1))
 		mod_timer(&iovad->fq_timer,
 			  jiffies + msecs_to_jiffies(IOVA_FQ_TIMEOUT));
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/irqchip/irq-gic-v3-its.c linux-libre-4.14.147-gnu/drivers/irqchip/irq-gic-v3-its.c
--- linux-libre-4.14.146-gnu/drivers/irqchip/irq-gic-v3-its.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/irqchip/irq-gic-v3-its.c	2019-10-05 06:48:14.000000000 -0400
@@ -2269,14 +2269,13 @@ static void its_irq_domain_free(struct i
 	struct its_node *its = its_dev->its;
 	int i;
 
+	bitmap_release_region(its_dev->event_map.lpi_map,
+			      its_get_event_id(irq_domain_get_irq_data(domain, virq)),
+			      get_count_order(nr_irqs));
+
 	for (i = 0; i < nr_irqs; i++) {
 		struct irq_data *data = irq_domain_get_irq_data(domain,
 								virq + i);
-		u32 event = its_get_event_id(data);
-
-		/* Mark interrupt index as unused */
-		clear_bit(event, its_dev->event_map.lpi_map);
-
 		/* Nuke the entry in the domain */
 		irq_domain_reset_irq_data(data);
 	}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/isdn/mISDN/socket.c linux-libre-4.14.147-gnu/drivers/isdn/mISDN/socket.c
--- linux-libre-4.14.146-gnu/drivers/isdn/mISDN/socket.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/isdn/mISDN/socket.c	2019-10-05 06:48:14.000000000 -0400
@@ -766,6 +766,8 @@ base_sock_create(struct net *net, struct
 
 	if (sock->type != SOCK_RAW)
 		return -ESOCKTNOSUPPORT;
+	if (!capable(CAP_NET_RAW))
+		return -EPERM;
 
 	sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
 	if (!sk)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/leds/leds-lp5562.c linux-libre-4.14.147-gnu/drivers/leds/leds-lp5562.c
--- linux-libre-4.14.146-gnu/drivers/leds/leds-lp5562.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/leds/leds-lp5562.c	2019-10-05 06:48:14.000000000 -0400
@@ -263,7 +263,11 @@ static void lp5562_firmware_loaded(struc
 {
 	const struct firmware *fw = chip->fw;
 
-	if (fw->size > LP5562_PROGRAM_LENGTH) {
+	/*
+	 * the firmware is encoded in ascii hex character, with 2 chars
+	 * per byte
+	 */
+	if (fw->size > (LP5562_PROGRAM_LENGTH * 2)) {
 		dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
 			fw->size);
 		return;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/dm-zoned-target.c linux-libre-4.14.147-gnu/drivers/md/dm-zoned-target.c
--- linux-libre-4.14.146-gnu/drivers/md/dm-zoned-target.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/dm-zoned-target.c	2019-10-05 06:48:14.000000000 -0400
@@ -133,8 +133,6 @@ static int dmz_submit_bio(struct dmz_tar
 
 	atomic_inc(&bioctx->ref);
 	generic_make_request(clone);
-	if (clone->bi_status == BLK_STS_IOERR)
-		return -EIO;
 
 	if (bio_op(bio) == REQ_OP_WRITE && dmz_is_seq(zone))
 		zone->wp_block += nr_blocks;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/md.c linux-libre-4.14.147-gnu/drivers/md/md.c
--- linux-libre-4.14.146-gnu/drivers/md/md.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/md.c	2019-10-05 06:48:14.000000000 -0400
@@ -1763,8 +1763,15 @@ static int super_1_validate(struct mddev
 				if (!(le32_to_cpu(sb->feature_map) &
 				      MD_FEATURE_RECOVERY_BITMAP))
 					rdev->saved_raid_disk = -1;
-			} else
-				set_bit(In_sync, &rdev->flags);
+			} else {
+				/*
+				 * If the array is FROZEN, then the device can't
+				 * be in_sync with rest of array.
+				 */
+				if (!test_bit(MD_RECOVERY_FROZEN,
+					      &mddev->recovery))
+					set_bit(In_sync, &rdev->flags);
+			}
 			rdev->raid_disk = role;
 			break;
 		}
@@ -4101,7 +4108,7 @@ array_state_show(struct mddev *mddev, ch
 {
 	enum array_state st = inactive;
 
-	if (mddev->pers)
+	if (mddev->pers && !test_bit(MD_NOT_READY, &mddev->flags))
 		switch(mddev->ro) {
 		case 1:
 			st = readonly;
@@ -5662,9 +5669,6 @@ int md_run(struct mddev *mddev)
 		md_update_sb(mddev, 0);
 
 	md_new_event(mddev);
-	sysfs_notify_dirent_safe(mddev->sysfs_state);
-	sysfs_notify_dirent_safe(mddev->sysfs_action);
-	sysfs_notify(&mddev->kobj, NULL, "degraded");
 	return 0;
 
 abort:
@@ -5685,6 +5689,7 @@ static int do_md_run(struct mddev *mddev
 {
 	int err;
 
+	set_bit(MD_NOT_READY, &mddev->flags);
 	err = md_run(mddev);
 	if (err)
 		goto out;
@@ -5702,9 +5707,14 @@ static int do_md_run(struct mddev *mddev
 
 	set_capacity(mddev->gendisk, mddev->array_sectors);
 	revalidate_disk(mddev->gendisk);
+	clear_bit(MD_NOT_READY, &mddev->flags);
 	mddev->changed = 1;
 	kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
+	sysfs_notify_dirent_safe(mddev->sysfs_state);
+	sysfs_notify_dirent_safe(mddev->sysfs_action);
+	sysfs_notify(&mddev->kobj, NULL, "degraded");
 out:
+	clear_bit(MD_NOT_READY, &mddev->flags);
 	return err;
 }
 
@@ -8755,6 +8765,7 @@ void md_check_recovery(struct mddev *mdd
 
 	if (mddev_trylock(mddev)) {
 		int spares = 0;
+		bool try_set_sync = mddev->safemode != 0;
 
 		if (!mddev->external && mddev->safemode == 1)
 			mddev->safemode = 0;
@@ -8800,7 +8811,7 @@ void md_check_recovery(struct mddev *mdd
 			}
 		}
 
-		if (!mddev->external && !mddev->in_sync) {
+		if (try_set_sync && !mddev->external && !mddev->in_sync) {
 			spin_lock(&mddev->lock);
 			set_in_sync(mddev);
 			spin_unlock(&mddev->lock);
@@ -8906,7 +8917,8 @@ void md_reap_sync_thread(struct mddev *m
 	/* resync has finished, collect result */
 	md_unregister_thread(&mddev->sync_thread);
 	if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
-	    !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
+	    !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) &&
+	    mddev->degraded != mddev->raid_disks) {
 		/* success...*/
 		/* activate any spares */
 		if (mddev->pers->spare_active(mddev)) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/md.h linux-libre-4.14.147-gnu/drivers/md/md.h
--- linux-libre-4.14.146-gnu/drivers/md/md.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/md.h	2019-10-05 06:48:14.000000000 -0400
@@ -243,6 +243,9 @@ enum mddev_flags {
 	MD_UPDATING_SB,		/* md_check_recovery is updating the metadata
 				 * without explicitly holding reconfig_mutex.
 				 */
+	MD_NOT_READY,		/* do_md_run() is active, so 'array_state'
+				 * must not report that array is ready yet
+				 */
 };
 
 enum mddev_sb_flags {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/raid0.c linux-libre-4.14.147-gnu/drivers/md/raid0.c
--- linux-libre-4.14.146-gnu/drivers/md/raid0.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/raid0.c	2019-10-05 06:48:14.000000000 -0400
@@ -26,6 +26,9 @@
 #include "raid0.h"
 #include "raid5.h"
 
+static int default_layout = 0;
+module_param(default_layout, int, 0644);
+
 #define UNSUPPORTED_MDDEV_FLAGS		\
 	((1L << MD_HAS_JOURNAL) |	\
 	 (1L << MD_JOURNAL_CLEAN) |	\
@@ -146,6 +149,19 @@ static int create_strip_zones(struct mdd
 	}
 	pr_debug("md/raid0:%s: FINAL %d zones\n",
 		 mdname(mddev), conf->nr_strip_zones);
+
+	if (conf->nr_strip_zones == 1) {
+		conf->layout = RAID0_ORIG_LAYOUT;
+	} else if (default_layout == RAID0_ORIG_LAYOUT ||
+		   default_layout == RAID0_ALT_MULTIZONE_LAYOUT) {
+		conf->layout = default_layout;
+	} else {
+		pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
+		       mdname(mddev));
+		pr_err("md/raid0: please set raid.default_layout to 1 or 2\n");
+		err = -ENOTSUPP;
+		goto abort;
+	}
 	/*
 	 * now since we have the hard sector sizes, we can make sure
 	 * chunk size is a multiple of that sector size
@@ -552,10 +568,12 @@ static void raid0_handle_discard(struct
 
 static bool raid0_make_request(struct mddev *mddev, struct bio *bio)
 {
+	struct r0conf *conf = mddev->private;
 	struct strip_zone *zone;
 	struct md_rdev *tmp_dev;
 	sector_t bio_sector;
 	sector_t sector;
+	sector_t orig_sector;
 	unsigned chunk_sects;
 	unsigned sectors;
 
@@ -588,8 +606,21 @@ static bool raid0_make_request(struct md
 		bio = split;
 	}
 
+	orig_sector = sector;
 	zone = find_zone(mddev->private, &sector);
-	tmp_dev = map_sector(mddev, zone, sector, &sector);
+	switch (conf->layout) {
+	case RAID0_ORIG_LAYOUT:
+		tmp_dev = map_sector(mddev, zone, orig_sector, &sector);
+		break;
+	case RAID0_ALT_MULTIZONE_LAYOUT:
+		tmp_dev = map_sector(mddev, zone, sector, &sector);
+		break;
+	default:
+		WARN("md/raid0:%s: Invalid layout\n", mdname(mddev));
+		bio_io_error(bio);
+		return true;
+	}
+
 	bio_set_dev(bio, tmp_dev->bdev);
 	bio->bi_iter.bi_sector = sector + zone->dev_start +
 		tmp_dev->data_offset;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/raid0.h linux-libre-4.14.147-gnu/drivers/md/raid0.h
--- linux-libre-4.14.146-gnu/drivers/md/raid0.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/raid0.h	2019-10-05 06:48:14.000000000 -0400
@@ -8,11 +8,25 @@ struct strip_zone {
 	int	 nb_dev;	/* # of devices attached to the zone */
 };
 
+/* Linux 3.14 (20d0189b101) made an unintended change to
+ * the RAID0 layout for multi-zone arrays (where devices aren't all
+ * the same size.
+ * RAID0_ORIG_LAYOUT restores the original layout
+ * RAID0_ALT_MULTIZONE_LAYOUT uses the altered layout
+ * The layouts are identical when there is only one zone (all
+ * devices the same size).
+ */
+
+enum r0layout {
+	RAID0_ORIG_LAYOUT = 1,
+	RAID0_ALT_MULTIZONE_LAYOUT = 2,
+};
 struct r0conf {
 	struct strip_zone	*strip_zone;
 	struct md_rdev		**devlist; /* lists of rdevs, pointed to
 					    * by strip_zone->dev */
 	int			nr_strip_zones;
+	enum r0layout		layout;
 };
 
 #endif
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/raid1.c linux-libre-4.14.147-gnu/drivers/md/raid1.c
--- linux-libre-4.14.146-gnu/drivers/md/raid1.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/raid1.c	2019-10-05 06:48:14.000000000 -0400
@@ -435,19 +435,21 @@ static void raid1_end_write_request(stru
 		    /* We never try FailFast to WriteMostly devices */
 		    !test_bit(WriteMostly, &rdev->flags)) {
 			md_error(r1_bio->mddev, rdev);
-			if (!test_bit(Faulty, &rdev->flags))
-				/* This is the only remaining device,
-				 * We need to retry the write without
-				 * FailFast
-				 */
-				set_bit(R1BIO_WriteError, &r1_bio->state);
-			else {
-				/* Finished with this branch */
-				r1_bio->bios[mirror] = NULL;
-				to_put = bio;
-			}
-		} else
+		}
+
+		/*
+		 * When the device is faulty, it is not necessary to
+		 * handle write error.
+		 * For failfast, this is the only remaining device,
+		 * We need to retry the write without FailFast.
+		 */
+		if (!test_bit(Faulty, &rdev->flags))
 			set_bit(R1BIO_WriteError, &r1_bio->state);
+		else {
+			/* Finished with this branch */
+			r1_bio->bios[mirror] = NULL;
+			to_put = bio;
+		}
 	} else {
 		/*
 		 * Set R1BIO_Uptodate in our master bio, so that we
@@ -3097,6 +3099,13 @@ static int raid1_run(struct mddev *mddev
 		    !test_bit(In_sync, &conf->mirrors[i].rdev->flags) ||
 		    test_bit(Faulty, &conf->mirrors[i].rdev->flags))
 			mddev->degraded++;
+	/*
+	 * RAID1 needs at least one disk in active
+	 */
+	if (conf->raid_disks - mddev->degraded < 1) {
+		ret = -EINVAL;
+		goto abort;
+	}
 
 	if (conf->raid_disks - mddev->degraded == 1)
 		mddev->recovery_cp = MaxSector;
@@ -3130,8 +3139,12 @@ static int raid1_run(struct mddev *mddev
 	ret =  md_integrity_register(mddev);
 	if (ret) {
 		md_unregister_thread(&mddev->thread);
-		raid1_free(mddev, conf);
+		goto abort;
 	}
+	return 0;
+
+abort:
+	raid1_free(mddev, conf);
 	return ret;
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/md/raid5.c linux-libre-4.14.147-gnu/drivers/md/raid5.c
--- linux-libre-4.14.146-gnu/drivers/md/raid5.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/md/raid5.c	2019-10-05 06:48:14.000000000 -0400
@@ -2538,7 +2538,8 @@ static void raid5_end_read_request(struc
 		int set_bad = 0;
 
 		clear_bit(R5_UPTODATE, &sh->dev[i].flags);
-		atomic_inc(&rdev->read_errors);
+		if (!(bi->bi_status == BLK_STS_PROTECTION))
+			atomic_inc(&rdev->read_errors);
 		if (test_bit(R5_ReadRepl, &sh->dev[i].flags))
 			pr_warn_ratelimited(
 				"md/raid:%s: read error on replacement device (sector %llu on %s).\n",
@@ -2570,7 +2571,9 @@ static void raid5_end_read_request(struc
 		    && !test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
 			retry = 1;
 		if (retry)
-			if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) {
+			if (sh->qd_idx >= 0 && sh->pd_idx == i)
+				set_bit(R5_ReadError, &sh->dev[i].flags);
+			else if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) {
 				set_bit(R5_ReadError, &sh->dev[i].flags);
 				clear_bit(R5_ReadNoMerge, &sh->dev[i].flags);
 			} else
@@ -5718,7 +5721,8 @@ static bool raid5_make_request(struct md
 				do_flush = false;
 			}
 
-			set_bit(STRIPE_HANDLE, &sh->state);
+			if (!sh->batch_head)
+				set_bit(STRIPE_HANDLE, &sh->state);
 			clear_bit(STRIPE_DELAYED, &sh->state);
 			if ((!sh->batch_head || sh == sh->batch_head) &&
 			    (bi->bi_opf & REQ_SYNC) &&
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/cec/cec-notifier.c linux-libre-4.14.147-gnu/drivers/media/cec/cec-notifier.c
--- linux-libre-4.14.146-gnu/drivers/media/cec/cec-notifier.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/cec/cec-notifier.c	2019-10-05 06:48:14.000000000 -0400
@@ -130,6 +130,8 @@ void cec_notifier_unregister(struct cec_
 {
 	mutex_lock(&n->lock);
 	n->callback = NULL;
+	n->cec_adap->notifier = NULL;
+	n->cec_adap = NULL;
 	mutex_unlock(&n->lock);
 	cec_notifier_put(n);
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/dvb-core/dvbdev.c linux-libre-4.14.147-gnu/drivers/media/dvb-core/dvbdev.c
--- linux-libre-4.14.146-gnu/drivers/media/dvb-core/dvbdev.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/dvb-core/dvbdev.c	2019-10-05 06:48:14.000000000 -0400
@@ -316,8 +316,10 @@ static int dvb_create_media_entity(struc
 	if (npads) {
 		dvbdev->pads = kcalloc(npads, sizeof(*dvbdev->pads),
 				       GFP_KERNEL);
-		if (!dvbdev->pads)
+		if (!dvbdev->pads) {
+			kfree(dvbdev->entity);
 			return -ENOMEM;
+		}
 	}
 
 	switch (type) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/i2c/ov5640.c linux-libre-4.14.147-gnu/drivers/media/i2c/ov5640.c
--- linux-libre-4.14.146-gnu/drivers/media/i2c/ov5640.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/i2c/ov5640.c	2019-10-05 06:48:14.000000000 -0400
@@ -2261,9 +2261,14 @@ static int ov5640_probe(struct i2c_clien
 	/* request optional power down pin */
 	sensor->pwdn_gpio = devm_gpiod_get_optional(dev, "powerdown",
 						    GPIOD_OUT_HIGH);
+	if (IS_ERR(sensor->pwdn_gpio))
+		return PTR_ERR(sensor->pwdn_gpio);
+
 	/* request optional reset pin */
 	sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset",
 						     GPIOD_OUT_HIGH);
+	if (IS_ERR(sensor->reset_gpio))
+		return PTR_ERR(sensor->reset_gpio);
 
 	v4l2_i2c_subdev_init(&sensor->sd, client, &ov5640_subdev_ops);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/i2c/ov5645.c linux-libre-4.14.147-gnu/drivers/media/i2c/ov5645.c
--- linux-libre-4.14.146-gnu/drivers/media/i2c/ov5645.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/i2c/ov5645.c	2019-10-05 06:48:14.000000000 -0400
@@ -53,6 +53,8 @@
 #define		OV5645_CHIP_ID_HIGH_BYTE	0x56
 #define OV5645_CHIP_ID_LOW		0x300b
 #define		OV5645_CHIP_ID_LOW_BYTE		0x45
+#define OV5645_IO_MIPI_CTRL00		0x300e
+#define OV5645_PAD_OUTPUT00		0x3019
 #define OV5645_AWB_MANUAL_CONTROL	0x3406
 #define		OV5645_AWB_MANUAL_ENABLE	BIT(0)
 #define OV5645_AEC_PK_MANUAL		0x3503
@@ -63,6 +65,7 @@
 #define		OV5645_ISP_VFLIP		BIT(2)
 #define OV5645_TIMING_TC_REG21		0x3821
 #define		OV5645_SENSOR_MIRROR		BIT(1)
+#define OV5645_MIPI_CTRL00		0x4800
 #define OV5645_PRE_ISP_TEST_SETTING_1	0x503d
 #define		OV5645_TEST_PATTERN_MASK	0x3
 #define		OV5645_SET_TEST_PATTERN(x)	((x) & OV5645_TEST_PATTERN_MASK)
@@ -129,7 +132,6 @@ static const struct reg_value ov5645_glo
 	{ 0x3503, 0x07 },
 	{ 0x3002, 0x1c },
 	{ 0x3006, 0xc3 },
-	{ 0x300e, 0x45 },
 	{ 0x3017, 0x00 },
 	{ 0x3018, 0x00 },
 	{ 0x302e, 0x0b },
@@ -358,7 +360,10 @@ static const struct reg_value ov5645_glo
 	{ 0x3a1f, 0x14 },
 	{ 0x0601, 0x02 },
 	{ 0x3008, 0x42 },
-	{ 0x3008, 0x02 }
+	{ 0x3008, 0x02 },
+	{ OV5645_IO_MIPI_CTRL00, 0x40 },
+	{ OV5645_MIPI_CTRL00, 0x24 },
+	{ OV5645_PAD_OUTPUT00, 0x70 }
 };
 
 static const struct reg_value ov5645_setting_sxga[] = {
@@ -743,13 +748,9 @@ static int ov5645_s_power(struct v4l2_su
 				goto exit;
 			}
 
-			ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
-					       OV5645_SYSTEM_CTRL0_STOP);
-			if (ret < 0) {
-				ov5645_set_power_off(ov5645);
-				goto exit;
-			}
+			usleep_range(500, 1000);
 		} else {
+			ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58);
 			ov5645_set_power_off(ov5645);
 		}
 	}
@@ -1069,11 +1070,20 @@ static int ov5645_s_stream(struct v4l2_s
 			dev_err(ov5645->dev, "could not sync v4l2 controls\n");
 			return ret;
 		}
+
+		ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x45);
+		if (ret < 0)
+			return ret;
+
 		ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
 				       OV5645_SYSTEM_CTRL0_START);
 		if (ret < 0)
 			return ret;
 	} else {
+		ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40);
+		if (ret < 0)
+			return ret;
+
 		ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
 				       OV5645_SYSTEM_CTRL0_STOP);
 		if (ret < 0)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/i2c/ov9650.c linux-libre-4.14.147-gnu/drivers/media/i2c/ov9650.c
--- linux-libre-4.14.146-gnu/drivers/media/i2c/ov9650.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/i2c/ov9650.c	2019-10-05 06:48:14.000000000 -0400
@@ -710,6 +710,11 @@ static int ov965x_set_gain(struct ov965x
 		for (m = 6; m >= 0; m--)
 			if (gain >= (1 << m) * 16)
 				break;
+
+		/* Sanity check: don't adjust the gain with a negative value */
+		if (m < 0)
+			return -EINVAL;
+
 		rgain = (gain - ((1 << m) * 16)) / (1 << m);
 		rgain |= (((1 << m) - 1) << 4);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/i2c/tvp5150.c linux-libre-4.14.147-gnu/drivers/media/i2c/tvp5150.c
--- linux-libre-4.14.146-gnu/drivers/media/i2c/tvp5150.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/i2c/tvp5150.c	2019-10-05 06:48:14.000000000 -0400
@@ -827,7 +827,7 @@ static int tvp5150_s_ctrl(struct v4l2_ct
 		return 0;
 	case V4L2_CID_HUE:
 		tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val);
-		break;
+		return 0;
 	case V4L2_CID_TEST_PATTERN:
 		decoder->enable = ctrl->val ? false : true;
 		tvp5150_selmux(sd);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/pci/saa7134/saa7134-i2c.c linux-libre-4.14.147-gnu/drivers/media/pci/saa7134/saa7134-i2c.c
--- linux-libre-4.14.146-gnu/drivers/media/pci/saa7134/saa7134-i2c.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/pci/saa7134/saa7134-i2c.c	2019-10-05 06:48:14.000000000 -0400
@@ -351,7 +351,11 @@ static struct i2c_client saa7134_client_
 
 /* ----------------------------------------------------------- */
 
-/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
+/*
+ * On Medion 7134 reading the SAA7134 chip config EEPROM needs DVB-T
+ * demod i2c gate closed due to an address clash between this EEPROM
+ * and the demod one.
+ */
 static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
 {
 	u8 subaddr = 0x7, dmdregval;
@@ -368,14 +372,14 @@ static void saa7134_i2c_eeprom_md7134_ga
 
 	ret = i2c_transfer(&dev->i2c_adap, i2cgatemsg_r, 2);
 	if ((ret == 2) && (dmdregval & 0x2)) {
-		pr_debug("%s: DVB-T demod i2c gate was left closed\n",
+		pr_debug("%s: DVB-T demod i2c gate was left open\n",
 			 dev->name);
 
 		data[0] = subaddr;
 		data[1] = (dmdregval & ~0x2);
 		if (i2c_transfer(&dev->i2c_adap, i2cgatemsg_w, 1) != 1)
-			pr_err("%s: EEPROM i2c gate open failure\n",
-			  dev->name);
+			pr_err("%s: EEPROM i2c gate close failure\n",
+			       dev->name);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/pci/saa7146/hexium_gemini.c linux-libre-4.14.147-gnu/drivers/media/pci/saa7146/hexium_gemini.c
--- linux-libre-4.14.146-gnu/drivers/media/pci/saa7146/hexium_gemini.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/pci/saa7146/hexium_gemini.c	2019-10-05 06:48:14.000000000 -0400
@@ -304,6 +304,9 @@ static int hexium_attach(struct saa7146_
 	ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
 	if (ret < 0) {
 		pr_err("cannot register capture v4l2 device. skipping.\n");
+		saa7146_vv_release(dev);
+		i2c_del_adapter(&hexium->i2c_adapter);
+		kfree(hexium);
 		return ret;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/exynos4-is/fimc-is.c linux-libre-4.14.147-gnu/drivers/media/platform/exynos4-is/fimc-is.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/exynos4-is/fimc-is.c	2019-09-21 06:13:31.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/exynos4-is/fimc-is.c	2019-10-05 11:48:09.000000000 -0400
@@ -819,6 +819,7 @@ static int fimc_is_probe(struct platform
 		return -ENODEV;
 
 	is->pmu_regs = of_iomap(node, 0);
+	of_node_put(node);
 	if (!is->pmu_regs)
 		return -ENOMEM;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/exynos4-is/media-dev.c linux-libre-4.14.147-gnu/drivers/media/platform/exynos4-is/media-dev.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/exynos4-is/media-dev.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/exynos4-is/media-dev.c	2019-10-05 06:48:14.000000000 -0400
@@ -496,6 +496,7 @@ static int fimc_md_register_sensor_entit
 			continue;
 
 		ret = fimc_md_parse_port_node(fmd, port, index);
+		of_node_put(port);
 		if (ret < 0) {
 			of_node_put(node);
 			goto rpm_put;
@@ -529,6 +530,7 @@ static int __of_get_csis_id(struct devic
 	if (!np)
 		return -EINVAL;
 	of_property_read_u32(np, "reg", &reg);
+	of_node_put(np);
 	return reg - FIMC_INPUT_MIPI_CSI2_0;
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/mtk-mdp/mtk_mdp_core.c linux-libre-4.14.147-gnu/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/mtk-mdp/mtk_mdp_core.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/mtk-mdp/mtk_mdp_core.c	2019-10-05 06:48:14.000000000 -0400
@@ -118,7 +118,9 @@ static int mtk_mdp_probe(struct platform
 	mutex_init(&mdp->vpulock);
 
 	/* Old dts had the components as child nodes */
-	if (of_get_next_child(dev->of_node, NULL)) {
+	node = of_get_next_child(dev->of_node, NULL);
+	if (node) {
+		of_node_put(node);
 		parent = dev->of_node;
 		dev_warn(dev, "device tree is out of date\n");
 	} else {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/isp.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/isp.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/isp.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/isp.c	2019-10-05 06:48:14.000000000 -0400
@@ -727,6 +727,10 @@ static int isp_pipeline_enable(struct is
 					s_stream, mode);
 			pipe->do_propagation = true;
 		}
+
+		/* Stop at the first external sub-device. */
+		if (subdev->dev != isp->dev)
+			break;
 	}
 
 	return 0;
@@ -841,6 +845,10 @@ static int isp_pipeline_disable(struct i
 						      &subdev->entity);
 			failure = -ETIMEDOUT;
 		}
+
+		/* Stop at the first external sub-device. */
+		if (subdev->dev != isp->dev)
+			break;
 	}
 
 	return failure;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispccdc.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispccdc.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispccdc.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispccdc.c	2019-10-05 06:48:14.000000000 -0400
@@ -2605,6 +2605,7 @@ int omap3isp_ccdc_register_entities(stru
 	int ret;
 
 	/* Register the subdev and video node. */
+	ccdc->subdev.dev = vdev->mdev->dev;
 	ret = v4l2_device_register_subdev(vdev, &ccdc->subdev);
 	if (ret < 0)
 		goto error;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispccp2.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispccp2.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispccp2.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispccp2.c	2019-10-05 06:48:14.000000000 -0400
@@ -1034,6 +1034,7 @@ int omap3isp_ccp2_register_entities(stru
 	int ret;
 
 	/* Register the subdev and video nodes. */
+	ccp2->subdev.dev = vdev->mdev->dev;
 	ret = v4l2_device_register_subdev(vdev, &ccp2->subdev);
 	if (ret < 0)
 		goto error;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispcsi2.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispcsi2.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispcsi2.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispcsi2.c	2019-10-05 06:48:14.000000000 -0400
@@ -1201,6 +1201,7 @@ int omap3isp_csi2_register_entities(stru
 	int ret;
 
 	/* Register the subdev and video nodes. */
+	csi2->subdev.dev = vdev->mdev->dev;
 	ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
 	if (ret < 0)
 		goto error;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/isppreview.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/isppreview.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/isppreview.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/isppreview.c	2019-10-05 06:48:14.000000000 -0400
@@ -2228,6 +2228,7 @@ int omap3isp_preview_register_entities(s
 	int ret;
 
 	/* Register the subdev and video nodes. */
+	prev->subdev.dev = vdev->mdev->dev;
 	ret = v4l2_device_register_subdev(vdev, &prev->subdev);
 	if (ret < 0)
 		goto error;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispresizer.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispresizer.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispresizer.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispresizer.c	2019-10-05 06:48:14.000000000 -0400
@@ -1684,6 +1684,7 @@ int omap3isp_resizer_register_entities(s
 	int ret;
 
 	/* Register the subdev and video nodes. */
+	res->subdev.dev = vdev->mdev->dev;
 	ret = v4l2_device_register_subdev(vdev, &res->subdev);
 	if (ret < 0)
 		goto error;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispstat.c linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispstat.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/omap3isp/ispstat.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/omap3isp/ispstat.c	2019-10-05 06:48:14.000000000 -0400
@@ -1018,6 +1018,8 @@ void omap3isp_stat_unregister_entities(s
 int omap3isp_stat_register_entities(struct ispstat *stat,
 				    struct v4l2_device *vdev)
 {
+	stat->subdev.dev = vdev->mdev->dev;
+
 	return v4l2_device_register_subdev(vdev, &stat->subdev);
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/platform/rcar_fdp1.c linux-libre-4.14.147-gnu/drivers/media/platform/rcar_fdp1.c
--- linux-libre-4.14.146-gnu/drivers/media/platform/rcar_fdp1.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/platform/rcar_fdp1.c	2019-10-05 06:48:14.000000000 -0400
@@ -2310,7 +2310,7 @@ static int fdp1_probe(struct platform_de
 		fdp1->fcp = rcar_fcp_get(fcp_node);
 		of_node_put(fcp_node);
 		if (IS_ERR(fdp1->fcp)) {
-			dev_err(&pdev->dev, "FCP not found (%ld)\n",
+			dev_dbg(&pdev->dev, "FCP not found (%ld)\n",
 				PTR_ERR(fdp1->fcp));
 			return PTR_ERR(fdp1->fcp);
 		}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/radio/si470x/radio-si470x-usb.c linux-libre-4.14.147-gnu/drivers/media/radio/si470x/radio-si470x-usb.c
--- linux-libre-4.14.146-gnu/drivers/media/radio/si470x/radio-si470x-usb.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/radio/si470x/radio-si470x-usb.c	2019-10-05 06:48:14.000000000 -0400
@@ -737,7 +737,7 @@ static int si470x_usb_driver_probe(struc
 	/* start radio */
 	retval = si470x_start_usb(radio);
 	if (retval < 0)
-		goto err_all;
+		goto err_buf;
 
 	/* set initial frequency */
 	si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
@@ -752,6 +752,8 @@ static int si470x_usb_driver_probe(struc
 
 	return 0;
 err_all:
+	usb_kill_urb(radio->int_in_urb);
+err_buf:
 	kfree(radio->buffer);
 err_ctrl:
 	v4l2_ctrl_handler_free(&radio->hdl);
@@ -825,6 +827,7 @@ static void si470x_usb_driver_disconnect
 	mutex_lock(&radio->lock);
 	v4l2_device_disconnect(&radio->v4l2_dev);
 	video_unregister_device(&radio->videodev);
+	usb_kill_urb(radio->int_in_urb);
 	usb_set_intfdata(intf, NULL);
 	mutex_unlock(&radio->lock);
 	v4l2_device_put(&radio->v4l2_dev);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/rc/iguanair.c linux-libre-4.14.147-gnu/drivers/media/rc/iguanair.c
--- linux-libre-4.14.146-gnu/drivers/media/rc/iguanair.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/rc/iguanair.c	2019-10-05 06:48:14.000000000 -0400
@@ -427,6 +427,10 @@ static int iguanair_probe(struct usb_int
 	int ret, pipein, pipeout;
 	struct usb_host_interface *idesc;
 
+	idesc = intf->altsetting;
+	if (idesc->desc.bNumEndpoints < 2)
+		return -ENODEV;
+
 	ir = kzalloc(sizeof(*ir), GFP_KERNEL);
 	rc = rc_allocate_device(RC_DRIVER_IR_RAW);
 	if (!ir || !rc) {
@@ -441,18 +445,13 @@ static int iguanair_probe(struct usb_int
 	ir->urb_in = usb_alloc_urb(0, GFP_KERNEL);
 	ir->urb_out = usb_alloc_urb(0, GFP_KERNEL);
 
-	if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out) {
+	if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out ||
+	    !usb_endpoint_is_int_in(&idesc->endpoint[0].desc) ||
+	    !usb_endpoint_is_int_out(&idesc->endpoint[1].desc)) {
 		ret = -ENOMEM;
 		goto out;
 	}
 
-	idesc = intf->altsetting;
-
-	if (idesc->desc.bNumEndpoints < 2) {
-		ret = -ENODEV;
-		goto out;
-	}
-
 	ir->rc = rc;
 	ir->dev = &intf->dev;
 	ir->udev = udev;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/rc/imon.c linux-libre-4.14.147-gnu/drivers/media/rc/imon.c
--- linux-libre-4.14.146-gnu/drivers/media/rc/imon.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/rc/imon.c	2019-10-05 06:48:14.000000000 -0400
@@ -1963,12 +1963,17 @@ static void imon_get_ffdc_type(struct im
 		break;
 	/* iMON VFD, MCE IR */
 	case 0x46:
-	case 0x7e:
 	case 0x9e:
 		dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
 		detected_display_type = IMON_DISPLAY_TYPE_VFD;
 		allowed_protos = RC_PROTO_BIT_RC6_MCE;
 		break;
+	/* iMON VFD, iMON or MCE IR */
+	case 0x7e:
+		dev_info(ictx->dev, "0xffdc iMON VFD, iMON or MCE IR");
+		detected_display_type = IMON_DISPLAY_TYPE_VFD;
+		allowed_protos |= RC_PROTO_BIT_RC6_MCE;
+		break;
 	/* iMON LCD, MCE IR */
 	case 0x9f:
 		dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/rc/mtk-cir.c linux-libre-4.14.147-gnu/drivers/media/rc/mtk-cir.c
--- linux-libre-4.14.146-gnu/drivers/media/rc/mtk-cir.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/rc/mtk-cir.c	2019-10-05 06:48:14.000000000 -0400
@@ -44,6 +44,11 @@
 /* Fields containing pulse width data */
 #define MTK_WIDTH_MASK		  (GENMASK(7, 0))
 
+/* IR threshold */
+#define MTK_IRTHD		 0x14
+#define MTK_DG_CNT_MASK		 (GENMASK(12, 8))
+#define MTK_DG_CNT(x)		 ((x) << 8)
+
 /* Bit to enable interrupt */
 #define MTK_IRINT_EN		  BIT(0)
 
@@ -411,6 +416,9 @@ static int mtk_ir_probe(struct platform_
 	mtk_w32_mask(ir, val, ir->data->fields[MTK_HW_PERIOD].mask,
 		     ir->data->fields[MTK_HW_PERIOD].reg);
 
+	/* Set de-glitch counter */
+	mtk_w32_mask(ir, MTK_DG_CNT(1), MTK_DG_CNT_MASK, MTK_IRTHD);
+
 	/* Enable IR and PWM */
 	val = mtk_r32(ir, MTK_CONFIG_HIGH_REG);
 	val |= MTK_OK_COUNT(ir->data->ok_count) |  MTK_PWM_EN | MTK_IR_EN;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/cpia2/cpia2_usb.c linux-libre-4.14.147-gnu/drivers/media/usb/cpia2/cpia2_usb.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/cpia2/cpia2_usb.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/cpia2/cpia2_usb.c	2019-10-05 06:48:14.000000000 -0400
@@ -684,6 +684,10 @@ static int submit_urbs(struct camera_dat
 		if (!urb) {
 			for (j = 0; j < i; j++)
 				usb_free_urb(cam->sbuf[j].urb);
+			for (j = 0; j < NUM_SBUF; j++) {
+				kfree(cam->sbuf[j].data);
+				cam->sbuf[j].data = NULL;
+			}
 			return -ENOMEM;
 		}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/dvb-usb/dib0700_devices.c linux-libre-4.14.147-gnu/drivers/media/usb/dvb-usb/dib0700_devices.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/dvb-usb/dib0700_devices.c	2019-09-21 06:09:32.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/dvb-usb/dib0700_devices.c	2019-10-05 11:42:22.000000000 -0400
@@ -2438,9 +2438,13 @@ static int dib9090_tuner_attach(struct d
 		8, 0x0486,
 	};
 
+	if (!IS_ENABLED(CONFIG_DVB_DIB9000))
+		return -ENODEV;
 	if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
 		return -ENODEV;
 	i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
+	if (!i2c)
+		return -ENODEV;
 	if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
 		return -ENODEV;
 	dib0700_set_i2c_speed(adap->dev, 1500);
@@ -2516,10 +2520,14 @@ static int nim9090md_tuner_attach(struct
 		0, 0x00ef,
 		8, 0x0406,
 	};
+	if (!IS_ENABLED(CONFIG_DVB_DIB9000))
+		return -ENODEV;
 	i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
 	if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
 		return -ENODEV;
 	i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
+	if (!i2c)
+		return -ENODEV;
 	if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
 		return -ENODEV;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/konica.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/konica.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/konica.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/konica.c	2019-10-05 06:48:14.000000000 -0400
@@ -123,6 +123,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, 2);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/nw80x.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/nw80x.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/nw80x.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/nw80x.c	2019-10-05 06:48:14.000000000 -0400
@@ -1580,6 +1580,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 		return;
 	}
 	if (len == 1)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/ov519.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/ov519.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/ov519.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/ov519.c	2019-10-05 06:48:14.000000000 -0400
@@ -2083,6 +2083,11 @@ static int reg_r(struct sd *sd, u16 inde
 	} else {
 		PERR("reg_r %02x failed %d\n", index, ret);
 		sd->gspca_dev.usb_err = ret;
+		/*
+		 * Make sure the result is zeroed to avoid uninitialized
+		 * values.
+		 */
+		gspca_dev->usb_buf[0] = 0;
 	}
 
 	return ret;
@@ -2111,6 +2116,11 @@ static int reg_r8(struct sd *sd,
 	} else {
 		PERR("reg_r8 %02x failed %d\n", index, ret);
 		sd->gspca_dev.usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, 8);
 	}
 
 	return ret;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/ov534_9.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/ov534_9.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/ov534_9.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/ov534_9.c	2019-10-05 06:48:14.000000000 -0400
@@ -1153,6 +1153,7 @@ static u8 reg_r(struct gspca_dev *gspca_
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		return 0;
 	}
 	return gspca_dev->usb_buf[0];
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/ov534.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/ov534.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/ov534.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/ov534.c	2019-10-05 06:48:14.000000000 -0400
@@ -641,6 +641,11 @@ static u8 ov534_reg_read(struct gspca_de
 	if (ret < 0) {
 		pr_err("read failed %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the result is zeroed to avoid uninitialized
+		 * values.
+		 */
+		gspca_dev->usb_buf[0] = 0;
 	}
 	return gspca_dev->usb_buf[0];
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/se401.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/se401.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/se401.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/se401.c	2019-10-05 06:48:14.000000000 -0400
@@ -111,6 +111,11 @@ static void se401_read_req(struct gspca_
 			pr_err("read req failed req %#04x error %d\n",
 			       req, err);
 		gspca_dev->usb_err = err;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, READ_REQ_SIZE);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sn9c20x.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sn9c20x.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sn9c20x.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sn9c20x.c	2019-10-05 06:48:14.000000000 -0400
@@ -133,6 +133,13 @@ static const struct dmi_system_id flip_d
 		}
 	},
 	{
+		.ident = "MSI MS-1039",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MS-1039"),
+		}
+	},
+	{
 		.ident = "MSI MS-1632",
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "MSI"),
@@ -918,6 +925,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (unlikely(result < 0 || result != length)) {
 		pr_err("Read register %02x failed %d\n", reg, result);
 		gspca_dev->usb_err = result;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sonixb.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sonixb.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sonixb.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sonixb.c	2019-10-05 06:48:14.000000000 -0400
@@ -462,6 +462,11 @@ static void reg_r(struct gspca_dev *gspc
 		dev_err(gspca_dev->v4l2_dev.dev,
 			"Error reading register %02x: %d\n", value, res);
 		gspca_dev->usb_err = res;
+		/*
+		 * Make sure the result is zeroed to avoid uninitialized
+		 * values.
+		 */
+		gspca_dev->usb_buf[0] = 0;
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sonixj.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sonixj.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sonixj.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sonixj.c	2019-10-05 06:48:14.000000000 -0400
@@ -1170,6 +1170,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/spca1528.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/spca1528.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/spca1528.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/spca1528.c	2019-10-05 06:48:14.000000000 -0400
@@ -80,6 +80,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sq930x.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sq930x.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sq930x.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sq930x.c	2019-10-05 06:48:14.000000000 -0400
@@ -434,6 +434,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (ret < 0) {
 		pr_err("reg_r %04x failed %d\n", value, ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sunplus.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sunplus.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/sunplus.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/sunplus.c	2019-10-05 06:48:14.000000000 -0400
@@ -264,6 +264,11 @@ static void reg_r(struct gspca_dev *gspc
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/vc032x.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/vc032x.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/vc032x.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/vc032x.c	2019-10-05 06:48:14.000000000 -0400
@@ -2915,6 +2915,11 @@ static void reg_r_i(struct gspca_dev *gs
 	if (ret < 0) {
 		pr_err("reg_r err %d\n", ret);
 		gspca_dev->usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
 	}
 }
 static void reg_r(struct gspca_dev *gspca_dev,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/gspca/w996Xcf.c linux-libre-4.14.147-gnu/drivers/media/usb/gspca/w996Xcf.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/gspca/w996Xcf.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/gspca/w996Xcf.c	2019-10-05 06:48:14.000000000 -0400
@@ -143,6 +143,11 @@ static int w9968cf_read_sb(struct sd *sd
 	} else {
 		pr_err("Read SB reg [01] failed\n");
 		sd->gspca_dev.usb_err = ret;
+		/*
+		 * Make sure the buffer is zeroed to avoid uninitialized
+		 * values.
+		 */
+		memset(sd->gspca_dev.usb_buf, 0, 2);
 	}
 
 	udelay(W9968CF_I2C_BUS_DELAY);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/hdpvr/hdpvr-core.c linux-libre-4.14.147-gnu/drivers/media/usb/hdpvr/hdpvr-core.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/hdpvr/hdpvr-core.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/hdpvr/hdpvr-core.c	2019-10-05 06:48:14.000000000 -0400
@@ -141,6 +141,7 @@ static int device_authorization(struct h
 
 	dev->fw_ver = dev->usbc_buf[1];
 
+	dev->usbc_buf[46] = '\0';
 	v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n",
 			  dev->fw_ver, &dev->usbc_buf[2]);
 
@@ -275,6 +276,7 @@ static int hdpvr_probe(struct usb_interf
 #endif
 	size_t buffer_size;
 	int i;
+	int dev_num;
 	int retval = -ENOMEM;
 
 	/* allocate memory for our device state and initialize it */
@@ -379,8 +381,17 @@ static int hdpvr_probe(struct usb_interf
 	}
 #endif
 
+	dev_num = atomic_inc_return(&dev_nr);
+	if (dev_num >= HDPVR_MAX) {
+		v4l2_err(&dev->v4l2_dev,
+			 "max device number reached, device register failed\n");
+		atomic_dec(&dev_nr);
+		retval = -ENODEV;
+		goto reg_fail;
+	}
+
 	retval = hdpvr_register_videodev(dev, &interface->dev,
-				    video_nr[atomic_inc_return(&dev_nr)]);
+				    video_nr[dev_num]);
 	if (retval < 0) {
 		v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
 		goto reg_fail;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/media/usb/ttusb-dec/ttusb_dec.c linux-libre-4.14.147-gnu/drivers/media/usb/ttusb-dec/ttusb_dec.c
--- linux-libre-4.14.146-gnu/drivers/media/usb/ttusb-dec/ttusb_dec.c	2019-09-21 06:12:22.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/media/usb/ttusb-dec/ttusb_dec.c	2019-10-05 11:46:32.000000000 -0400
@@ -330,7 +330,7 @@ static int ttusb_dec_send_command(struct
 
 	dprintk("%s\n", __func__);
 
-	b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
+	b = kzalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
 	if (!b)
 		return -ENOMEM;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/mmc/core/sdio_irq.c linux-libre-4.14.147-gnu/drivers/mmc/core/sdio_irq.c
--- linux-libre-4.14.146-gnu/drivers/mmc/core/sdio_irq.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/mmc/core/sdio_irq.c	2019-10-05 06:48:14.000000000 -0400
@@ -35,6 +35,7 @@ static int process_sdio_pending_irqs(str
 {
 	struct mmc_card *card = host->card;
 	int i, ret, count;
+	bool sdio_irq_pending = host->sdio_irq_pending;
 	unsigned char pending;
 	struct sdio_func *func;
 
@@ -42,13 +43,16 @@ static int process_sdio_pending_irqs(str
 	if (mmc_card_suspended(card))
 		return 0;
 
+	/* Clear the flag to indicate that we have processed the IRQ. */
+	host->sdio_irq_pending = false;
+
 	/*
 	 * Optimization, if there is only 1 function interrupt registered
 	 * and we know an IRQ was signaled then call irq handler directly.
 	 * Otherwise do the full probe.
 	 */
 	func = card->sdio_single_irq;
-	if (func && host->sdio_irq_pending) {
+	if (func && sdio_irq_pending) {
 		func->irq_handler(func);
 		return 1;
 	}
@@ -100,7 +104,6 @@ void sdio_run_irqs(struct mmc_host *host
 {
 	mmc_claim_host(host);
 	if (host->sdio_irqs) {
-		host->sdio_irq_pending = true;
 		process_sdio_pending_irqs(host);
 		if (host->ops->ack_sdio_irq)
 			host->ops->ack_sdio_irq(host);
@@ -119,6 +122,7 @@ void sdio_irq_work(struct work_struct *w
 
 void sdio_signal_irq(struct mmc_host *host)
 {
+	host->sdio_irq_pending = true;
 	queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
 }
 EXPORT_SYMBOL_GPL(sdio_signal_irq);
@@ -163,7 +167,6 @@ static int sdio_irq_thread(void *_host)
 		if (ret)
 			break;
 		ret = process_sdio_pending_irqs(host);
-		host->sdio_irq_pending = false;
 		mmc_release_host(host);
 
 		/*
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/mmc/host/sdhci.c linux-libre-4.14.147-gnu/drivers/mmc/host/sdhci.c
--- linux-libre-4.14.146-gnu/drivers/mmc/host/sdhci.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/mmc/host/sdhci.c	2019-10-05 06:48:14.000000000 -0400
@@ -1635,7 +1635,9 @@ void sdhci_set_uhs_signaling(struct sdhc
 		ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
 	else if (timing == MMC_TIMING_UHS_SDR12)
 		ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
-	else if (timing == MMC_TIMING_UHS_SDR25)
+	else if (timing == MMC_TIMING_SD_HS ||
+		 timing == MMC_TIMING_MMC_HS ||
+		 timing == MMC_TIMING_UHS_SDR25)
 		ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
 	else if (timing == MMC_TIMING_UHS_SDR50)
 		ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/mtd/chips/cfi_cmdset_0002.c linux-libre-4.14.147-gnu/drivers/mtd/chips/cfi_cmdset_0002.c
--- linux-libre-4.14.146-gnu/drivers/mtd/chips/cfi_cmdset_0002.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/mtd/chips/cfi_cmdset_0002.c	2019-10-05 06:48:14.000000000 -0400
@@ -1628,29 +1628,35 @@ static int __xipram do_write_oneword(str
 			continue;
 		}
 
-		if (time_after(jiffies, timeo) && !chip_ready(map, adr)){
+		/*
+		 * We check "time_after" and "!chip_good" before checking
+		 * "chip_good" to avoid the failure due to scheduling.
+		 */
+		if (time_after(jiffies, timeo) && !chip_good(map, adr, datum)) {
 			xip_enable(map, chip, adr);
 			printk(KERN_WARNING "MTD %s(): software timeout\n", __func__);
 			xip_disable(map, chip, adr);
+			ret = -EIO;
 			break;
 		}
 
-		if (chip_ready(map, adr))
+		if (chip_good(map, adr, datum))
 			break;
 
 		/* Latency issues. Drop the lock, wait a while and retry */
 		UDELAY(map, chip, adr, 1);
 	}
+
 	/* Did we succeed? */
-	if (!chip_good(map, adr, datum)) {
+	if (ret) {
 		/* reset on all failures. */
 		map_write( map, CMD(0xF0), chip->start );
 		/* FIXME - should have reset delay before continuing */
 
-		if (++retry_cnt <= MAX_RETRIES)
+		if (++retry_cnt <= MAX_RETRIES) {
+			ret = 0;
 			goto retry;
-
-		ret = -EIO;
+		}
 	}
 	xip_enable(map, chip, adr);
  op_done:
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/arcnet/arcnet.c linux-libre-4.14.147-gnu/drivers/net/arcnet/arcnet.c
--- linux-libre-4.14.146-gnu/drivers/net/arcnet/arcnet.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/arcnet/arcnet.c	2019-10-05 06:48:14.000000000 -0400
@@ -1064,31 +1064,34 @@ EXPORT_SYMBOL(arcnet_interrupt);
 static void arcnet_rx(struct net_device *dev, int bufnum)
 {
 	struct arcnet_local *lp = netdev_priv(dev);
-	struct archdr pkt;
+	union {
+		struct archdr pkt;
+		char buf[512];
+	} rxdata;
 	struct arc_rfc1201 *soft;
 	int length, ofs;
 
-	soft = &pkt.soft.rfc1201;
+	soft = &rxdata.pkt.soft.rfc1201;
 
-	lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE);
-	if (pkt.hard.offset[0]) {
-		ofs = pkt.hard.offset[0];
+	lp->hw.copy_from_card(dev, bufnum, 0, &rxdata.pkt, ARC_HDR_SIZE);
+	if (rxdata.pkt.hard.offset[0]) {
+		ofs = rxdata.pkt.hard.offset[0];
 		length = 256 - ofs;
 	} else {
-		ofs = pkt.hard.offset[1];
+		ofs = rxdata.pkt.hard.offset[1];
 		length = 512 - ofs;
 	}
 
 	/* get the full header, if possible */
-	if (sizeof(pkt.soft) <= length) {
-		lp->hw.copy_from_card(dev, bufnum, ofs, soft, sizeof(pkt.soft));
+	if (sizeof(rxdata.pkt.soft) <= length) {
+		lp->hw.copy_from_card(dev, bufnum, ofs, soft, sizeof(rxdata.pkt.soft));
 	} else {
-		memset(&pkt.soft, 0, sizeof(pkt.soft));
+		memset(&rxdata.pkt.soft, 0, sizeof(rxdata.pkt.soft));
 		lp->hw.copy_from_card(dev, bufnum, ofs, soft, length);
 	}
 
 	arc_printk(D_DURING, dev, "Buffer #%d: received packet from %02Xh to %02Xh (%d+4 bytes)\n",
-		   bufnum, pkt.hard.source, pkt.hard.dest, length);
+		   bufnum, rxdata.pkt.hard.source, rxdata.pkt.hard.dest, length);
 
 	dev->stats.rx_packets++;
 	dev->stats.rx_bytes += length + ARC_HDR_SIZE;
@@ -1097,13 +1100,13 @@ static void arcnet_rx(struct net_device
 	if (arc_proto_map[soft->proto]->is_ip) {
 		if (BUGLVL(D_PROTO)) {
 			struct ArcProto
-			*oldp = arc_proto_map[lp->default_proto[pkt.hard.source]],
+			*oldp = arc_proto_map[lp->default_proto[rxdata.pkt.hard.source]],
 			*newp = arc_proto_map[soft->proto];
 
 			if (oldp != newp) {
 				arc_printk(D_PROTO, dev,
 					   "got protocol %02Xh; encap for host %02Xh is now '%c' (was '%c')\n",
-					   soft->proto, pkt.hard.source,
+					   soft->proto, rxdata.pkt.hard.source,
 					   newp->suffix, oldp->suffix);
 			}
 		}
@@ -1112,10 +1115,10 @@ static void arcnet_rx(struct net_device
 		lp->default_proto[0] = soft->proto;
 
 		/* in striking contrast, the following isn't a hack. */
-		lp->default_proto[pkt.hard.source] = soft->proto;
+		lp->default_proto[rxdata.pkt.hard.source] = soft->proto;
 	}
 	/* call the protocol-specific receiver. */
-	arc_proto_map[soft->proto]->rx(dev, bufnum, &pkt, length);
+	arc_proto_map[soft->proto]->rx(dev, bufnum, &rxdata.pkt, length);
 }
 
 static void null_rx(struct net_device *dev, int bufnum,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c linux-libre-4.14.147-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c
--- linux-libre-4.14.146-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.c	2019-10-05 06:48:14.000000000 -0400
@@ -1447,6 +1447,16 @@ static s32 e1000_check_for_copper_link_i
 			else
 				phy_reg |= 0xFA;
 			e1e_wphy_locked(hw, I217_PLL_CLOCK_GATE_REG, phy_reg);
+
+			if (speed == SPEED_1000) {
+				hw->phy.ops.read_reg_locked(hw, HV_PM_CTRL,
+							    &phy_reg);
+
+				phy_reg |= HV_PM_CTRL_K1_CLK_REQ;
+
+				hw->phy.ops.write_reg_locked(hw, HV_PM_CTRL,
+							     phy_reg);
+			}
 		}
 		hw->phy.ops.release(hw);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.h linux-libre-4.14.147-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.h
--- linux-libre-4.14.146-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/ethernet/intel/e1000e/ich8lan.h	2019-10-05 06:48:14.000000000 -0400
@@ -228,7 +228,7 @@
 
 /* PHY Power Management Control */
 #define HV_PM_CTRL		PHY_REG(770, 17)
-#define HV_PM_CTRL_PLL_STOP_IN_K1_GIGA	0x100
+#define HV_PM_CTRL_K1_CLK_REQ		0x200
 #define HV_PM_CTRL_K1_ENABLE		0x4000
 
 #define I217_PLL_CLOCK_GATE_REG	PHY_REG(772, 28)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/ethernet/marvell/skge.c linux-libre-4.14.147-gnu/drivers/net/ethernet/marvell/skge.c
--- linux-libre-4.14.146-gnu/drivers/net/ethernet/marvell/skge.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/ethernet/marvell/skge.c	2019-10-05 06:48:14.000000000 -0400
@@ -3122,7 +3122,7 @@ static struct sk_buff *skge_rx_get(struc
 	skb_put(skb, len);
 
 	if (dev->features & NETIF_F_RXCSUM) {
-		skb->csum = csum;
+		skb->csum = le16_to_cpu(csum);
 		skb->ip_summed = CHECKSUM_COMPLETE;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-libre-4.14.147-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c
--- linux-libre-4.14.146-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2019-10-05 06:48:14.000000000 -0400
@@ -1574,6 +1574,7 @@ static const struct pci_device_id mlx5_c
 	{ PCI_VDEVICE(MELLANOX, 0x101c), MLX5_PCI_DEV_IS_VF},	/* ConnectX-6 VF */
 	{ PCI_VDEVICE(MELLANOX, 0xa2d2) },			/* BlueField integrated ConnectX-5 network controller */
 	{ PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF},	/* BlueField integrated ConnectX-5 network controller VF */
+	{ PCI_VDEVICE(MELLANOX, 0xa2d6) },			/* BlueField-2 integrated ConnectX-6 Dx network controller */
 	{ 0, }
 };
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/ethernet/nxp/lpc_eth.c linux-libre-4.14.147-gnu/drivers/net/ethernet/nxp/lpc_eth.c
--- linux-libre-4.14.146-gnu/drivers/net/ethernet/nxp/lpc_eth.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/ethernet/nxp/lpc_eth.c	2019-10-05 06:48:14.000000000 -0400
@@ -1371,13 +1371,14 @@ static int lpc_eth_drv_probe(struct plat
 	pldat->dma_buff_base_p = dma_handle;
 
 	netdev_dbg(ndev, "IO address space     :%pR\n", res);
-	netdev_dbg(ndev, "IO address size      :%d\n", resource_size(res));
+	netdev_dbg(ndev, "IO address size      :%zd\n",
+			(size_t)resource_size(res));
 	netdev_dbg(ndev, "IO address (mapped)  :0x%p\n",
 			pldat->net_base);
 	netdev_dbg(ndev, "IRQ number           :%d\n", ndev->irq);
-	netdev_dbg(ndev, "DMA buffer size      :%d\n", pldat->dma_buff_size);
-	netdev_dbg(ndev, "DMA buffer P address :0x%08x\n",
-			pldat->dma_buff_base_p);
+	netdev_dbg(ndev, "DMA buffer size      :%zd\n", pldat->dma_buff_size);
+	netdev_dbg(ndev, "DMA buffer P address :%pad\n",
+			&pldat->dma_buff_base_p);
 	netdev_dbg(ndev, "DMA buffer V address :0x%p\n",
 			pldat->dma_buff_base_v);
 
@@ -1424,8 +1425,8 @@ static int lpc_eth_drv_probe(struct plat
 	if (ret)
 		goto err_out_unregister_netdev;
 
-	netdev_info(ndev, "LPC mac at 0x%08x irq %d\n",
-	       res->start, ndev->irq);
+	netdev_info(ndev, "LPC mac at 0x%08lx irq %d\n",
+	       (unsigned long)res->start, ndev->irq);
 
 	phydev = ndev->phydev;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/macsec.c linux-libre-4.14.147-gnu/drivers/net/macsec.c
--- linux-libre-4.14.146-gnu/drivers/net/macsec.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/macsec.c	2019-10-05 06:48:14.000000000 -0400
@@ -1234,6 +1234,7 @@ deliver:
 		macsec_rxsa_put(rx_sa);
 	macsec_rxsc_put(rx_sc);
 
+	skb_orphan(skb);
 	ret = gro_cells_receive(&macsec->gro_cells, skb);
 	if (ret == NET_RX_SUCCESS)
 		count_rx(dev, skb->len);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/phy/national.c linux-libre-4.14.147-gnu/drivers/net/phy/national.c
--- linux-libre-4.14.146-gnu/drivers/net/phy/national.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/phy/national.c	2019-10-05 06:48:14.000000000 -0400
@@ -110,14 +110,17 @@ static void ns_giga_speed_fallback(struc
 
 static void ns_10_base_t_hdx_loopack(struct phy_device *phydev, int disable)
 {
+	u16 lb_dis = BIT(1);
+
 	if (disable)
-		ns_exp_write(phydev, 0x1c0, ns_exp_read(phydev, 0x1c0) | 1);
+		ns_exp_write(phydev, 0x1c0,
+			     ns_exp_read(phydev, 0x1c0) | lb_dis);
 	else
 		ns_exp_write(phydev, 0x1c0,
-			     ns_exp_read(phydev, 0x1c0) & 0xfffe);
+			     ns_exp_read(phydev, 0x1c0) & ~lb_dis);
 
 	pr_debug("10BASE-T HDX loopback %s\n",
-		 (ns_exp_read(phydev, 0x1c0) & 0x0001) ? "off" : "on");
+		 (ns_exp_read(phydev, 0x1c0) & lb_dis) ? "off" : "on");
 }
 
 static int ns_config_init(struct phy_device *phydev)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/ppp/ppp_generic.c linux-libre-4.14.147-gnu/drivers/net/ppp/ppp_generic.c
--- linux-libre-4.14.146-gnu/drivers/net/ppp/ppp_generic.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/ppp/ppp_generic.c	2019-10-05 06:48:14.000000000 -0400
@@ -1433,6 +1433,8 @@ static void __ppp_xmit_process(struct pp
 			netif_wake_queue(ppp->dev);
 		else
 			netif_stop_queue(ppp->dev);
+	} else {
+		kfree_skb(skb);
 	}
 	ppp_xmit_unlock(ppp);
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/usb/cdc_ncm.c linux-libre-4.14.147-gnu/drivers/net/usb/cdc_ncm.c
--- linux-libre-4.14.146-gnu/drivers/net/usb/cdc_ncm.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/usb/cdc_ncm.c	2019-10-05 06:48:14.000000000 -0400
@@ -681,8 +681,12 @@ cdc_ncm_find_endpoints(struct usbnet *de
 	u8 ep;
 
 	for (ep = 0; ep < intf->cur_altsetting->desc.bNumEndpoints; ep++) {
-
 		e = intf->cur_altsetting->endpoint + ep;
+
+		/* ignore endpoints which cannot transfer data */
+		if (!usb_endpoint_maxp(&e->desc))
+			continue;
+
 		switch (e->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
 		case USB_ENDPOINT_XFER_INT:
 			if (usb_endpoint_dir_in(&e->desc)) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/usb/usbnet.c linux-libre-4.14.147-gnu/drivers/net/usb/usbnet.c
--- linux-libre-4.14.146-gnu/drivers/net/usb/usbnet.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/usb/usbnet.c	2019-10-05 06:48:14.000000000 -0400
@@ -112,6 +112,11 @@ int usbnet_get_endpoints(struct usbnet *
 			int				intr = 0;
 
 			e = alt->endpoint + ep;
+
+			/* ignore endpoints which cannot transfer data */
+			if (!usb_endpoint_maxp(&e->desc))
+				continue;
+
 			switch (e->desc.bmAttributes) {
 			case USB_ENDPOINT_XFER_INT:
 				if (!usb_endpoint_dir_in(&e->desc))
@@ -351,6 +356,8 @@ void usbnet_update_max_qlen(struct usbne
 {
 	enum usb_device_speed speed = dev->udev->speed;
 
+	if (!dev->rx_urb_size || !dev->hard_mtu)
+		goto insanity;
 	switch (speed) {
 	case USB_SPEED_HIGH:
 		dev->rx_qlen = MAX_QUEUE_MEMORY / dev->rx_urb_size;
@@ -367,6 +374,7 @@ void usbnet_update_max_qlen(struct usbne
 		dev->tx_qlen = 5 * MAX_QUEUE_MEMORY / dev->hard_mtu;
 		break;
 	default:
+insanity:
 		dev->rx_qlen = dev->tx_qlen = 4;
 	}
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/wireless/intel/iwlwifi/mvm/tx.c linux-libre-4.14.147-gnu/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
--- linux-libre-4.14.146-gnu/drivers/net/wireless/intel/iwlwifi/mvm/tx.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/wireless/intel/iwlwifi/mvm/tx.c	2019-10-05 06:48:14.000000000 -0400
@@ -651,7 +651,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mv
 		if (info.control.vif->type == NL80211_IFTYPE_P2P_DEVICE ||
 		    info.control.vif->type == NL80211_IFTYPE_AP ||
 		    info.control.vif->type == NL80211_IFTYPE_ADHOC) {
-			if (info.control.vif->type == NL80211_IFTYPE_P2P_DEVICE)
+			if (!ieee80211_is_data(hdr->frame_control))
 				sta_id = mvmvif->bcast_sta.sta_id;
 			else
 				sta_id = mvmvif->mcast_sta.sta_id;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/net/wireless/marvell/libertas/if_usb.c linux-libre-4.14.147-gnu/drivers/net/wireless/marvell/libertas/if_usb.c
--- linux-libre-4.14.146-gnu/drivers/net/wireless/marvell/libertas/if_usb.c	2019-09-21 06:19:49.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/net/wireless/marvell/libertas/if_usb.c	2019-10-05 11:56:13.000000000 -0400
@@ -45,7 +45,8 @@ static const struct lbs_fw_table fw_tabl
 	{ MODEL_8388, "/*(DEBLOBBED)*/", NULL },
 	{ MODEL_8388, "/*(DEBLOBBED)*/", NULL },
 	{ MODEL_8388, "/*(DEBLOBBED)*/", NULL },
-	{ MODEL_8682, "/*(DEBLOBBED)*/", NULL }
+	{ MODEL_8682, "/*(DEBLOBBED)*/", NULL },
+	{ 0, NULL, NULL }
 };
 
 static const struct usb_device_id if_usb_table[] = {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/nvme/target/admin-cmd.c linux-libre-4.14.147-gnu/drivers/nvme/target/admin-cmd.c
--- linux-libre-4.14.146-gnu/drivers/nvme/target/admin-cmd.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/nvme/target/admin-cmd.c	2019-10-05 06:48:14.000000000 -0400
@@ -49,9 +49,11 @@ static u16 nvmet_get_smart_log_nsid(stru
 	}
 
 	host_reads = part_stat_read(ns->bdev->bd_part, ios[READ]);
-	data_units_read = part_stat_read(ns->bdev->bd_part, sectors[READ]);
+	data_units_read = DIV_ROUND_UP(part_stat_read(ns->bdev->bd_part,
+		sectors[READ]), 1000);
 	host_writes = part_stat_read(ns->bdev->bd_part, ios[WRITE]);
-	data_units_written = part_stat_read(ns->bdev->bd_part, sectors[WRITE]);
+	data_units_written = DIV_ROUND_UP(part_stat_read(ns->bdev->bd_part,
+		sectors[WRITE]), 1000);
 
 	put_unaligned_le64(host_reads, &slog->host_reads[0]);
 	put_unaligned_le64(data_units_read, &slog->data_units_read[0]);
@@ -77,11 +79,11 @@ static u16 nvmet_get_smart_log_all(struc
 	rcu_read_lock();
 	list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link) {
 		host_reads += part_stat_read(ns->bdev->bd_part, ios[READ]);
-		data_units_read +=
-			part_stat_read(ns->bdev->bd_part, sectors[READ]);
+		data_units_read += DIV_ROUND_UP(
+			part_stat_read(ns->bdev->bd_part, sectors[READ]), 1000);
 		host_writes += part_stat_read(ns->bdev->bd_part, ios[WRITE]);
-		data_units_written +=
-			part_stat_read(ns->bdev->bd_part, sectors[WRITE]);
+		data_units_written += DIV_ROUND_UP(
+			part_stat_read(ns->bdev->bd_part, sectors[WRITE]), 1000);
 
 	}
 	rcu_read_unlock();
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/parisc/dino.c linux-libre-4.14.147-gnu/drivers/parisc/dino.c
--- linux-libre-4.14.146-gnu/drivers/parisc/dino.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/parisc/dino.c	2019-10-05 06:48:14.000000000 -0400
@@ -160,6 +160,15 @@ struct dino_device
 	(struct dino_device *)__pdata; })
 
 
+/* Check if PCI device is behind a Card-mode Dino. */
+static int pci_dev_is_behind_card_dino(struct pci_dev *dev)
+{
+	struct dino_device *dino_dev;
+
+	dino_dev = DINO_DEV(parisc_walk_tree(dev->bus->bridge));
+	return is_card_dino(&dino_dev->hba.dev->id);
+}
+
 /*
  * Dino Configuration Space Accessor Functions
  */
@@ -442,6 +451,21 @@ static void quirk_cirrus_cardbus(struct
 }
 DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_6832, quirk_cirrus_cardbus );
 
+#ifdef CONFIG_TULIP
+static void pci_fixup_tulip(struct pci_dev *dev)
+{
+	if (!pci_dev_is_behind_card_dino(dev))
+		return;
+	if (!(pci_resource_flags(dev, 1) & IORESOURCE_MEM))
+		return;
+	pr_warn("%s: HP HSC-PCI Cards with card-mode Dino not yet supported.\n",
+		pci_name(dev));
+	/* Disable this card by zeroing the PCI resources */
+	memset(&dev->resource[0], 0, sizeof(dev->resource[0]));
+	memset(&dev->resource[1], 0, sizeof(dev->resource[1]));
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_DEC, PCI_ANY_ID, pci_fixup_tulip);
+#endif /* CONFIG_TULIP */
 
 static void __init
 dino_bios_init(void)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/pci/host/pci-hyperv.c linux-libre-4.14.147-gnu/drivers/pci/host/pci-hyperv.c
--- linux-libre-4.14.146-gnu/drivers/pci/host/pci-hyperv.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/pci/host/pci-hyperv.c	2019-10-05 06:48:14.000000000 -0400
@@ -2740,8 +2740,8 @@ static int hv_pci_remove(struct hv_devic
 		/* Remove the bus from PCI's point of view. */
 		pci_lock_rescan_remove();
 		pci_stop_root_bus(hbus->pci_bus);
-		pci_remove_root_bus(hbus->pci_bus);
 		hv_pci_remove_slots(hbus);
+		pci_remove_root_bus(hbus->pci_bus);
 		pci_unlock_rescan_remove();
 		hbus->state = hv_pcibus_removed;
 	}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/pinctrl/sprd/pinctrl-sprd.c linux-libre-4.14.147-gnu/drivers/pinctrl/sprd/pinctrl-sprd.c
--- linux-libre-4.14.146-gnu/drivers/pinctrl/sprd/pinctrl-sprd.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/pinctrl/sprd/pinctrl-sprd.c	2019-10-05 06:48:14.000000000 -0400
@@ -159,10 +159,8 @@ struct sprd_pinctrl {
 	struct sprd_pinctrl_soc_info *info;
 };
 
-enum sprd_pinconf_params {
-	SPRD_PIN_CONFIG_CONTROL = PIN_CONFIG_END + 1,
-	SPRD_PIN_CONFIG_SLEEP_MODE = PIN_CONFIG_END + 2,
-};
+#define SPRD_PIN_CONFIG_CONTROL		(PIN_CONFIG_END + 1)
+#define SPRD_PIN_CONFIG_SLEEP_MODE	(PIN_CONFIG_END + 2)
 
 static int sprd_pinctrl_get_id_by_name(struct sprd_pinctrl *sprd_pctl,
 				       const char *name)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/power/supply/power_supply_sysfs.c linux-libre-4.14.147-gnu/drivers/power/supply/power_supply_sysfs.c
--- linux-libre-4.14.146-gnu/drivers/power/supply/power_supply_sysfs.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/power/supply/power_supply_sysfs.c	2019-10-05 06:48:14.000000000 -0400
@@ -91,7 +91,8 @@ static ssize_t power_supply_show_propert
 				dev_dbg(dev, "driver has no data for `%s' property\n",
 					attr->attr.name);
 			else if (ret != -ENODEV && ret != -EAGAIN)
-				dev_err(dev, "driver failed to report `%s' property: %zd\n",
+				dev_err_ratelimited(dev,
+					"driver failed to report `%s' property: %zd\n",
 					attr->attr.name, ret);
 			return ret;
 		}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/regulator/core.c linux-libre-4.14.147-gnu/drivers/regulator/core.c
--- linux-libre-4.14.146-gnu/drivers/regulator/core.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/regulator/core.c	2019-10-05 06:48:14.000000000 -0400
@@ -4503,7 +4503,7 @@ static int __init regulator_init(void)
 /* init early to allow our consumers to complete system booting */
 core_initcall(regulator_init);
 
-static int __init regulator_late_cleanup(struct device *dev, void *data)
+static int regulator_late_cleanup(struct device *dev, void *data)
 {
 	struct regulator_dev *rdev = dev_to_rdev(dev);
 	const struct regulator_ops *ops = rdev->desc->ops;
@@ -4552,18 +4552,9 @@ unlock:
 	return 0;
 }
 
-static int __init regulator_init_complete(void)
+static void regulator_init_complete_work_function(struct work_struct *work)
 {
 	/*
-	 * Since DT doesn't provide an idiomatic mechanism for
-	 * enabling full constraints and since it's much more natural
-	 * with DT to provide them just assume that a DT enabled
-	 * system has full constraints.
-	 */
-	if (of_have_populated_dt())
-		has_full_constraints = true;
-
-	/*
 	 * Regulators may had failed to resolve their input supplies
 	 * when were registered, either because the input supply was
 	 * not registered yet or because its parent device was not
@@ -4580,6 +4571,35 @@ static int __init regulator_init_complet
 	 */
 	class_for_each_device(&regulator_class, NULL, NULL,
 			      regulator_late_cleanup);
+}
+
+static DECLARE_DELAYED_WORK(regulator_init_complete_work,
+			    regulator_init_complete_work_function);
+
+static int __init regulator_init_complete(void)
+{
+	/*
+	 * Since DT doesn't provide an idiomatic mechanism for
+	 * enabling full constraints and since it's much more natural
+	 * with DT to provide them just assume that a DT enabled
+	 * system has full constraints.
+	 */
+	if (of_have_populated_dt())
+		has_full_constraints = true;
+
+	/*
+	 * We punt completion for an arbitrary amount of time since
+	 * systems like distros will load many drivers from userspace
+	 * so consumers might not always be ready yet, this is
+	 * particularly an issue with laptops where this might bounce
+	 * the display off then on.  Ideally we'd get a notification
+	 * from userspace when this happens but we don't so just wait
+	 * a bit and hope we waited long enough.  It'd be better if
+	 * we'd only do this on systems that need it, and a kernel
+	 * command line option might be useful.
+	 */
+	schedule_delayed_work(&regulator_init_complete_work,
+			      msecs_to_jiffies(30000));
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/regulator/lm363x-regulator.c linux-libre-4.14.147-gnu/drivers/regulator/lm363x-regulator.c
--- linux-libre-4.14.146-gnu/drivers/regulator/lm363x-regulator.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/regulator/lm363x-regulator.c	2019-10-05 06:48:14.000000000 -0400
@@ -33,7 +33,7 @@
 
 /* LM3632 */
 #define LM3632_BOOST_VSEL_MAX		0x26
-#define LM3632_LDO_VSEL_MAX		0x29
+#define LM3632_LDO_VSEL_MAX		0x28
 #define LM3632_VBOOST_MIN		4500000
 #define LM3632_VLDO_MIN			4000000
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/scsi/device_handler/scsi_dh_rdac.c linux-libre-4.14.147-gnu/drivers/scsi/device_handler/scsi_dh_rdac.c
--- linux-libre-4.14.146-gnu/drivers/scsi/device_handler/scsi_dh_rdac.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/scsi/device_handler/scsi_dh_rdac.c	2019-10-05 06:48:14.000000000 -0400
@@ -546,6 +546,8 @@ static void send_mode_select(struct work
 	spin_unlock(&ctlr->ms_lock);
 
  retry:
+	memset(cdb, 0, sizeof(cdb));
+
 	data_size = rdac_failover_get(ctlr, &list, cdb);
 
 	RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
diff -druNp --no-dereference linux-libre-4.14.146-gnu/drivers/staging/media/imx/imx6-mipi-csi2.c linux-libre-4.14.147-gnu/drivers/staging/media/imx/imx6-mipi-csi2.c
--- linux-libre-4.14.146-gnu/drivers/staging/media/imx/imx6-mipi-csi2.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/drivers/staging/media/imx/imx6-mipi-csi2.c	2019-10-05 06:48:14.000000000 -0400
@@ -247,7 +247,7 @@ static int __maybe_unused csi2_dphy_wait
 }
 
 /* Waits for low-power LP-11 state on data and clock lanes. */
-static int csi2_dphy_wait_stopstate(struct csi2_dev *csi2)
+static void csi2_dphy_wait_stopstate(struct csi2_dev *csi2)
 {
 	u32 mask, reg;
 	int ret;
@@ -258,11 +258,9 @@ static int csi2_dphy_wait_stopstate(stru
 	ret = readl_poll_timeout(csi2->base + CSI2_PHY_STATE, reg,
 				 (reg & mask) == mask, 0, 500000);
 	if (ret) {
-		v4l2_err(&csi2->sd, "LP-11 timeout, phy_state = 0x%08x\n", reg);
-		return ret;
+		v4l2_warn(&csi2->sd, "LP-11 wait timeout, likely a sensor driver bug, expect capture failures.\n");
+		v4l2_warn(&csi2->sd, "phy_state = 0x%08x\n", reg);
 	}
-
-	return 0;
 }
 
 /* Wait for active clock on the clock lane. */
@@ -320,9 +318,7 @@ static int csi2_start(struct csi2_dev *c
 	csi2_enable(csi2, true);
 
 	/* Step 5 */
-	ret = csi2_dphy_wait_stopstate(csi2);
-	if (ret)
-		goto err_assert_reset;
+	csi2_dphy_wait_stopstate(csi2);
 
 	/* Step 6 */
 	ret = v4l2_subdev_call(csi2->src_sd, video, s_stream, 1);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/binfmt_elf.c linux-libre-4.14.147-gnu/fs/binfmt_elf.c
--- linux-libre-4.14.146-gnu/fs/binfmt_elf.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/binfmt_elf.c	2019-10-05 06:48:14.000000000 -0400
@@ -1123,7 +1123,8 @@ static int load_elf_binary(struct linux_
 		 * (since it grows up, and may collide early with the stack
 		 * growing down), and into the unused ELF_ET_DYN_BASE region.
 		 */
-		if (IS_ENABLED(CONFIG_ARCH_HAS_ELF_RANDOMIZE) && !interpreter)
+		if (IS_ENABLED(CONFIG_ARCH_HAS_ELF_RANDOMIZE) &&
+		    loc->elf_ex.e_type == ET_DYN && !interpreter)
 			current->mm->brk = current->mm->start_brk =
 				ELF_ET_DYN_BASE;
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/btrfs/ctree.c linux-libre-4.14.147-gnu/fs/btrfs/ctree.c
--- linux-libre-4.14.146-gnu/fs/btrfs/ctree.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/btrfs/ctree.c	2019-10-05 06:48:14.000000000 -0400
@@ -1414,6 +1414,7 @@ get_old_root(struct btrfs_root *root, u6
 	struct tree_mod_elem *tm;
 	struct extent_buffer *eb = NULL;
 	struct extent_buffer *eb_root;
+	u64 eb_root_owner = 0;
 	struct extent_buffer *old;
 	struct tree_mod_root *old_root = NULL;
 	u64 old_generation = 0;
@@ -1448,6 +1449,7 @@ get_old_root(struct btrfs_root *root, u6
 			free_extent_buffer(old);
 		}
 	} else if (old_root) {
+		eb_root_owner = btrfs_header_owner(eb_root);
 		btrfs_tree_read_unlock(eb_root);
 		free_extent_buffer(eb_root);
 		eb = alloc_dummy_extent_buffer(fs_info, logical);
@@ -1465,7 +1467,7 @@ get_old_root(struct btrfs_root *root, u6
 	if (old_root) {
 		btrfs_set_header_bytenr(eb, eb->start);
 		btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV);
-		btrfs_set_header_owner(eb, btrfs_header_owner(eb_root));
+		btrfs_set_header_owner(eb, eb_root_owner);
 		btrfs_set_header_level(eb, old_root->level);
 		btrfs_set_header_generation(eb, old_generation);
 	}
@@ -5492,6 +5494,7 @@ int btrfs_compare_trees(struct btrfs_roo
 	advance_left = advance_right = 0;
 
 	while (1) {
+		cond_resched();
 		if (advance_left && !left_end_reached) {
 			ret = tree_advance(fs_info, left_path, &left_level,
 					left_root_level,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/btrfs/extent-tree.c linux-libre-4.14.147-gnu/fs/btrfs/extent-tree.c
--- linux-libre-4.14.146-gnu/fs/btrfs/extent-tree.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/btrfs/extent-tree.c	2019-10-05 06:48:14.000000000 -0400
@@ -7706,6 +7706,14 @@ search:
 			 */
 			if ((flags & extra) && !(block_group->flags & extra))
 				goto loop;
+
+			/*
+			 * This block group has different flags than we want.
+			 * It's possible that we have MIXED_GROUP flag but no
+			 * block group is mixed.  Just skip such block group.
+			 */
+			btrfs_release_block_group(block_group, delalloc);
+			continue;
 		}
 
 have_block_group:
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/btrfs/qgroup.c linux-libre-4.14.147-gnu/fs/btrfs/qgroup.c
--- linux-libre-4.14.146-gnu/fs/btrfs/qgroup.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/btrfs/qgroup.c	2019-10-05 06:48:14.000000000 -0400
@@ -722,10 +722,10 @@ out:
 	return ret;
 }
 
-static int update_qgroup_status_item(struct btrfs_trans_handle *trans,
-				     struct btrfs_fs_info *fs_info,
-				    struct btrfs_root *root)
+static int update_qgroup_status_item(struct btrfs_trans_handle *trans)
 {
+	struct btrfs_fs_info *fs_info = trans->fs_info;
+	struct btrfs_root *quota_root = fs_info->quota_root;
 	struct btrfs_path *path;
 	struct btrfs_key key;
 	struct extent_buffer *l;
@@ -741,7 +741,7 @@ static int update_qgroup_status_item(str
 	if (!path)
 		return -ENOMEM;
 
-	ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
+	ret = btrfs_search_slot(trans, quota_root, &key, path, 0, 1);
 	if (ret > 0)
 		ret = -ENOENT;
 
@@ -2110,7 +2110,7 @@ int btrfs_run_qgroups(struct btrfs_trans
 		fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON;
 	spin_unlock(&fs_info->qgroup_lock);
 
-	ret = update_qgroup_status_item(trans, fs_info, quota_root);
+	ret = update_qgroup_status_item(trans);
 	if (ret)
 		fs_info->qgroup_flags |= BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
 
@@ -2645,9 +2645,6 @@ out:
 	btrfs_free_path(path);
 
 	mutex_lock(&fs_info->qgroup_rescan_lock);
-	if (!btrfs_fs_closing(fs_info))
-		fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;
-
 	if (err > 0 &&
 	    fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT) {
 		fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
@@ -2663,16 +2660,30 @@ out:
 	trans = btrfs_start_transaction(fs_info->quota_root, 1);
 	if (IS_ERR(trans)) {
 		err = PTR_ERR(trans);
+		trans = NULL;
 		btrfs_err(fs_info,
 			  "fail to start transaction for status update: %d",
 			  err);
-		goto done;
 	}
-	ret = update_qgroup_status_item(trans, fs_info, fs_info->quota_root);
-	if (ret < 0) {
-		err = ret;
-		btrfs_err(fs_info, "fail to update qgroup status: %d", err);
+
+	mutex_lock(&fs_info->qgroup_rescan_lock);
+	if (!btrfs_fs_closing(fs_info))
+		fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_RESCAN;
+	if (trans) {
+		ret = update_qgroup_status_item(trans);
+		if (ret < 0) {
+			err = ret;
+			btrfs_err(fs_info, "fail to update qgroup status: %d",
+				  err);
+		}
 	}
+	fs_info->qgroup_rescan_running = false;
+	complete_all(&fs_info->qgroup_rescan_completion);
+	mutex_unlock(&fs_info->qgroup_rescan_lock);
+
+	if (!trans)
+		return;
+
 	btrfs_end_transaction(trans);
 
 	if (btrfs_fs_closing(fs_info)) {
@@ -2683,12 +2694,6 @@ out:
 	} else {
 		btrfs_err(fs_info, "qgroup scan failed with %d", err);
 	}
-
-done:
-	mutex_lock(&fs_info->qgroup_rescan_lock);
-	fs_info->qgroup_rescan_running = false;
-	mutex_unlock(&fs_info->qgroup_rescan_lock);
-	complete_all(&fs_info->qgroup_rescan_completion);
 }
 
 /*
@@ -2951,7 +2956,7 @@ static int qgroup_free_reserved_data(str
 		 * EXTENT_QGROUP_RESERVED, we won't double free.
 		 * So not need to rush.
 		 */
-		ret = clear_record_extent_bits(&BTRFS_I(inode)->io_failure_tree,
+		ret = clear_record_extent_bits(&BTRFS_I(inode)->io_tree,
 				free_start, free_start + free_len - 1,
 				EXTENT_QGROUP_RESERVED, &changeset);
 		if (ret < 0)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/cifs/smb2ops.c linux-libre-4.14.147-gnu/fs/cifs/smb2ops.c
--- linux-libre-4.14.146-gnu/fs/cifs/smb2ops.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/cifs/smb2ops.c	2019-10-05 06:48:14.000000000 -0400
@@ -1975,6 +1975,11 @@ smb21_set_oplock_level(struct cifsInodeI
 	if (oplock == SMB2_OPLOCK_LEVEL_NOCHANGE)
 		return;
 
+	/* Check if the server granted an oplock rather than a lease */
+	if (oplock & SMB2_OPLOCK_LEVEL_EXCLUSIVE)
+		return smb2_set_oplock_level(cinode, oplock, epoch,
+					     purge_cache);
+
 	if (oplock & SMB2_LEASE_READ_CACHING_HE) {
 		new_oplock |= CIFS_CACHE_READ_FLG;
 		strcat(message, "R");
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/cifs/xattr.c linux-libre-4.14.147-gnu/fs/cifs/xattr.c
--- linux-libre-4.14.146-gnu/fs/cifs/xattr.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/cifs/xattr.c	2019-10-05 06:48:14.000000000 -0400
@@ -31,7 +31,7 @@
 #include "cifs_fs_sb.h"
 #include "cifs_unicode.h"
 
-#define MAX_EA_VALUE_SIZE 65535
+#define MAX_EA_VALUE_SIZE CIFSMaxBufSize
 #define CIFS_XATTR_CIFS_ACL "system.cifs_acl"
 #define CIFS_XATTR_ATTRIB "cifs.dosattrib"  /* full name: user.cifs.dosattrib */
 #define CIFS_XATTR_CREATETIME "cifs.creationtime"  /* user.cifs.creationtime */
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/ext4/extents.c linux-libre-4.14.147-gnu/fs/ext4/extents.c
--- linux-libre-4.14.146-gnu/fs/ext4/extents.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/ext4/extents.c	2019-10-05 06:48:14.000000000 -0400
@@ -3756,8 +3756,8 @@ static int ext4_convert_unwritten_extent
 	 * illegal.
 	 */
 	if (ee_block != map->m_lblk || ee_len > map->m_len) {
-#ifdef EXT4_DEBUG
-		ext4_warning("Inode (%ld) finished: extent logical block %llu,"
+#ifdef CONFIG_EXT4_DEBUG
+		ext4_warning(inode->i_sb, "Inode (%ld) finished: extent logical block %llu,"
 			     " len %u; IO logical block %llu, len %u",
 			     inode->i_ino, (unsigned long long)ee_block, ee_len,
 			     (unsigned long long)map->m_lblk, map->m_len);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/ext4/inode.c linux-libre-4.14.147-gnu/fs/ext4/inode.c
--- linux-libre-4.14.146-gnu/fs/ext4/inode.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/ext4/inode.c	2019-10-05 06:48:14.000000000 -0400
@@ -4177,6 +4177,15 @@ int ext4_punch_hole(struct inode *inode,
 
 	trace_ext4_punch_hole(inode, offset, length, 0);
 
+	ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
+	if (ext4_has_inline_data(inode)) {
+		down_write(&EXT4_I(inode)->i_mmap_sem);
+		ret = ext4_convert_inline_data(inode);
+		up_write(&EXT4_I(inode)->i_mmap_sem);
+		if (ret)
+			return ret;
+	}
+
 	/*
 	 * Write out all dirty pages to avoid race conditions
 	 * Then release them.
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/checkpoint.c linux-libre-4.14.147-gnu/fs/f2fs/checkpoint.c
--- linux-libre-4.14.146-gnu/fs/f2fs/checkpoint.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/checkpoint.c	2019-10-05 06:48:14.000000000 -0400
@@ -793,6 +793,7 @@ int get_valid_checkpoint(struct f2fs_sb_
 	unsigned int cp_blks = 1 + __cp_payload(sbi);
 	block_t cp_blk_no;
 	int i;
+	int err;
 
 	sbi->ckpt = kzalloc(cp_blks * blk_size, GFP_KERNEL);
 	if (!sbi->ckpt)
@@ -819,6 +820,7 @@ int get_valid_checkpoint(struct f2fs_sb_
 	} else if (cp2) {
 		cur_page = cp2;
 	} else {
+		err = -EFSCORRUPTED;
 		goto fail_no_cp;
 	}
 
@@ -831,8 +833,10 @@ int get_valid_checkpoint(struct f2fs_sb_
 		sbi->cur_cp_pack = 2;
 
 	/* Sanity checking of checkpoint */
-	if (sanity_check_ckpt(sbi))
+	if (sanity_check_ckpt(sbi)) {
+		err = -EFSCORRUPTED;
 		goto free_fail_no_cp;
+	}
 
 	if (cp_blks <= 1)
 		goto done;
@@ -860,7 +864,7 @@ free_fail_no_cp:
 	f2fs_put_page(cp2, 1);
 fail_no_cp:
 	kfree(sbi->ckpt);
-	return -EINVAL;
+	return err;
 }
 
 static void __add_dirty_inode(struct inode *inode, enum inode_type type)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/data.c linux-libre-4.14.147-gnu/fs/f2fs/data.c
--- linux-libre-4.14.146-gnu/fs/f2fs/data.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/data.c	2019-10-05 06:48:14.000000000 -0400
@@ -376,7 +376,7 @@ int f2fs_submit_page_bio(struct f2fs_io_
 
 	if (!f2fs_is_valid_blkaddr(fio->sbi, fio->new_blkaddr,
 			__is_meta_io(fio) ? META_GENERIC : DATA_GENERIC))
-		return -EFAULT;
+		return -EFSCORRUPTED;
 
 	trace_f2fs_submit_page_bio(page, fio);
 	f2fs_trace_ios(fio, 0);
@@ -959,7 +959,7 @@ next_block:
 
 	if (__is_valid_data_blkaddr(blkaddr) &&
 		!f2fs_is_valid_blkaddr(sbi, blkaddr, DATA_GENERIC)) {
-		err = -EFAULT;
+		err = -EFSCORRUPTED;
 		goto sync_out;
 	}
 
@@ -1425,7 +1425,7 @@ int do_write_data_page(struct f2fs_io_in
 
 		if (!f2fs_is_valid_blkaddr(fio->sbi, fio->old_blkaddr,
 							DATA_GENERIC))
-			return -EFAULT;
+			return -EFSCORRUPTED;
 
 		ipu_force = true;
 		fio->need_lock = LOCK_DONE;
@@ -1451,7 +1451,7 @@ got_it:
 	if (__is_valid_data_blkaddr(fio->old_blkaddr) &&
 		!f2fs_is_valid_blkaddr(fio->sbi, fio->old_blkaddr,
 							DATA_GENERIC)) {
-		err = -EFAULT;
+		err = -EFSCORRUPTED;
 		goto out_writepage;
 	}
 	/*
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/f2fs.h linux-libre-4.14.147-gnu/fs/f2fs/f2fs.h
--- linux-libre-4.14.146-gnu/fs/f2fs/f2fs.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/f2fs.h	2019-10-05 06:48:14.000000000 -0400
@@ -3089,3 +3089,7 @@ static inline bool f2fs_may_encrypt(stru
 }
 
 #endif
+
+#define EFSBADCRC	EBADMSG		/* Bad CRC detected */
+#define EFSCORRUPTED	EUCLEAN		/* Filesystem is corrupted */
+
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/inline.c linux-libre-4.14.147-gnu/fs/f2fs/inline.c
--- linux-libre-4.14.146-gnu/fs/f2fs/inline.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/inline.c	2019-10-05 06:48:14.000000000 -0400
@@ -135,7 +135,7 @@ int f2fs_convert_inline_page(struct dnod
 			"%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, "
 			"run fsck to fix.",
 			__func__, dn->inode->i_ino, dn->data_blkaddr);
-		return -EINVAL;
+		return -EFSCORRUPTED;
 	}
 
 	f2fs_bug_on(F2FS_P_SB(page), PageWriteback(page));
@@ -382,7 +382,7 @@ static int f2fs_move_inline_dirents(stru
 			"%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, "
 			"run fsck to fix.",
 			__func__, dir->i_ino, dn.data_blkaddr);
-		err = -EINVAL;
+		err = -EFSCORRUPTED;
 		goto out;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/inode.c linux-libre-4.14.147-gnu/fs/f2fs/inode.c
--- linux-libre-4.14.146-gnu/fs/f2fs/inode.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/inode.c	2019-10-05 06:48:14.000000000 -0400
@@ -70,7 +70,7 @@ static int __written_first_block(struct
 	if (!__is_valid_data_blkaddr(addr))
 		return 1;
 	if (!f2fs_is_valid_blkaddr(sbi, addr, DATA_GENERIC))
-		return -EFAULT;
+		return -EFSCORRUPTED;
 	return 0;
 }
 
@@ -300,7 +300,7 @@ static int do_read_inode(struct inode *i
 
 	if (!sanity_check_inode(inode, node_page)) {
 		f2fs_put_page(node_page, 1);
-		return -EINVAL;
+		return -EFSCORRUPTED;
 	}
 
 	/* check data exist */
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/node.c linux-libre-4.14.147-gnu/fs/f2fs/node.c
--- linux-libre-4.14.146-gnu/fs/f2fs/node.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/node.c	2019-10-05 06:48:14.000000000 -0400
@@ -39,7 +39,7 @@ int check_nid_range(struct f2fs_sb_info
 		f2fs_msg(sbi->sb, KERN_WARNING,
 				"%s: out-of-range nid=%x, run fsck to fix.",
 				__func__, nid);
-		return -EINVAL;
+		return -EFSCORRUPTED;
 	}
 	return 0;
 }
@@ -1195,7 +1195,7 @@ repeat:
 	}
 
 	if (!f2fs_inode_chksum_verify(sbi, page)) {
-		err = -EBADMSG;
+		err = -EFSBADCRC;
 		goto out_err;
 	}
 page_hit:
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/recovery.c linux-libre-4.14.147-gnu/fs/f2fs/recovery.c
--- linux-libre-4.14.146-gnu/fs/f2fs/recovery.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/recovery.c	2019-10-05 06:48:14.000000000 -0400
@@ -451,7 +451,7 @@ retry_dn:
 			"Inconsistent ofs_of_node, ino:%lu, ofs:%u, %u",
 			inode->i_ino, ofs_of_node(dn.node_page),
 			ofs_of_node(page));
-		err = -EFAULT;
+		err = -EFSCORRUPTED;
 		goto err;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/segment.c linux-libre-4.14.147-gnu/fs/f2fs/segment.c
--- linux-libre-4.14.146-gnu/fs/f2fs/segment.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/segment.c	2019-10-05 06:48:14.000000000 -0400
@@ -2216,6 +2216,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sb
 	if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
 		f2fs_msg(sbi->sb, KERN_WARNING,
 			"Found FS corruption, run fsck to fix.");
+		err = -EFSCORRUPTED;
 		goto out;
 	}
 
@@ -2612,11 +2613,6 @@ static int read_compacted_summaries(stru
 		seg_i = CURSEG_I(sbi, i);
 		segno = le32_to_cpu(ckpt->cur_data_segno[i]);
 		blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]);
-		if (blk_off > ENTRIES_IN_SUM) {
-			f2fs_bug_on(sbi, 1);
-			f2fs_put_page(page, 1);
-			return -EFAULT;
-		}
 		seg_i->next_segno = segno;
 		reset_curseg(sbi, i, 0);
 		seg_i->alloc_type = ckpt->alloc_type[i];
@@ -3314,7 +3310,7 @@ static int build_sit_entries(struct f2fs
 					"Wrong journal entry on segno %u",
 					start);
 			set_sbi_flag(sbi, SBI_NEED_FSCK);
-			err = -EINVAL;
+			err = -EFSCORRUPTED;
 			break;
 		}
 
@@ -3355,7 +3351,7 @@ static int build_sit_entries(struct f2fs
 			"SIT is corrupted node# %u vs %u",
 			total_node_blocks, valid_node_count(sbi));
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		err = -EINVAL;
+		err = -EFSCORRUPTED;
 	}
 
 	return err;
@@ -3444,6 +3440,41 @@ static int build_dirty_segmap(struct f2f
 	return init_victim_secmap(sbi);
 }
 
+static int sanity_check_curseg(struct f2fs_sb_info *sbi)
+{
+	int i;
+
+	/*
+	 * In LFS/SSR curseg, .next_blkoff should point to an unused blkaddr;
+	 * In LFS curseg, all blkaddr after .next_blkoff should be unused.
+	 */
+	for (i = 0; i < NO_CHECK_TYPE; i++) {
+		struct curseg_info *curseg = CURSEG_I(sbi, i);
+		struct seg_entry *se = get_seg_entry(sbi, curseg->segno);
+		unsigned int blkofs = curseg->next_blkoff;
+
+		if (f2fs_test_bit(blkofs, se->cur_valid_map))
+			goto out;
+
+		if (curseg->alloc_type == SSR)
+			continue;
+
+		for (blkofs += 1; blkofs < sbi->blocks_per_seg; blkofs++) {
+			if (!f2fs_test_bit(blkofs, se->cur_valid_map))
+				continue;
+out:
+			f2fs_msg(sbi->sb, KERN_ERR,
+				"Current segment's next free block offset is "
+				"inconsistent with bitmap, logtype:%u, "
+				"segno:%u, type:%u, next_blkoff:%u, blkofs:%u",
+				i, curseg->segno, curseg->alloc_type,
+				curseg->next_blkoff, blkofs);
+			return -EFSCORRUPTED;
+		}
+	}
+	return 0;
+}
+
 /*
  * Update min, max modified time for cost-benefit GC algorithm
  */
@@ -3537,6 +3568,10 @@ int build_segment_manager(struct f2fs_sb
 	if (err)
 		return err;
 
+	err = sanity_check_curseg(sbi);
+	if (err)
+		return err;
+
 	init_min_max_mtime(sbi);
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/segment.h linux-libre-4.14.147-gnu/fs/f2fs/segment.h
--- linux-libre-4.14.146-gnu/fs/f2fs/segment.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/segment.h	2019-10-05 06:48:14.000000000 -0400
@@ -665,7 +665,7 @@ static inline int check_block_count(stru
 				"Mismatch valid blocks %d vs. %d",
 					GET_SIT_VBLOCKS(raw_sit), valid_blocks);
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		return -EINVAL;
+		return -EFSCORRUPTED;
 	}
 
 	/* check segment usage, and check boundary of a given segment number */
@@ -675,7 +675,7 @@ static inline int check_block_count(stru
 				"Wrong valid blocks %d or segno %u",
 					GET_SIT_VBLOCKS(raw_sit), segno);
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
-		return -EINVAL;
+		return -EFSCORRUPTED;
 	}
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/f2fs/super.c linux-libre-4.14.147-gnu/fs/f2fs/super.c
--- linux-libre-4.14.146-gnu/fs/f2fs/super.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/f2fs/super.c	2019-10-05 06:48:14.000000000 -0400
@@ -2027,11 +2027,11 @@ int sanity_check_ckpt(struct f2fs_sb_inf
 		}
 	}
 	for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) {
-		for (j = i; j < NR_CURSEG_DATA_TYPE; j++) {
+		for (j = 0; j < NR_CURSEG_DATA_TYPE; j++) {
 			if (le32_to_cpu(ckpt->cur_node_segno[i]) ==
 				le32_to_cpu(ckpt->cur_data_segno[j])) {
 				f2fs_msg(sbi->sb, KERN_ERR,
-					"Data segment (%u) and Data segment (%u)"
+					"Node segment (%u) and Data segment (%u)"
 					" has the same segno: %u", i, j,
 					le32_to_cpu(ckpt->cur_node_segno[i]));
 				return 1;
@@ -2220,7 +2220,7 @@ static int read_raw_super_block(struct f
 			f2fs_msg(sb, KERN_ERR,
 				"Can't find valid F2FS filesystem in %dth superblock",
 				block + 1);
-			err = -EINVAL;
+			err = -EFSCORRUPTED;
 			brelse(bh);
 			continue;
 		}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/fuse/file.c linux-libre-4.14.147-gnu/fs/fuse/file.c
--- linux-libre-4.14.146-gnu/fs/fuse/file.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/fuse/file.c	2019-10-05 06:48:14.000000000 -0400
@@ -1699,6 +1699,7 @@ static int fuse_writepage(struct page *p
 		WARN_ON(wbc->sync_mode == WB_SYNC_ALL);
 
 		redirty_page_for_writepage(wbc, page);
+		unlock_page(page);
 		return 0;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/gfs2/bmap.c linux-libre-4.14.147-gnu/fs/gfs2/bmap.c
--- linux-libre-4.14.146-gnu/fs/gfs2/bmap.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/gfs2/bmap.c	2019-10-05 06:48:14.000000000 -0400
@@ -1078,6 +1078,7 @@ out_unlock:
 			gfs2_dinode_out(ip, dibh->b_data);
 			up_write(&ip->i_rw_mutex);
 			gfs2_trans_end(sdp);
+			buf_in_tr = false;
 		}
 		gfs2_glock_dq_uninit(rd_gh);
 		cond_resched();
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/overlayfs/inode.c linux-libre-4.14.147-gnu/fs/overlayfs/inode.c
--- linux-libre-4.14.146-gnu/fs/overlayfs/inode.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/overlayfs/inode.c	2019-10-05 06:48:14.000000000 -0400
@@ -265,7 +265,8 @@ static bool ovl_can_list(const char *s)
 		return true;
 
 	/* Never list trusted.overlay, list other trusted for superuser only */
-	return !ovl_is_private_xattr(s) && capable(CAP_SYS_ADMIN);
+	return !ovl_is_private_xattr(s) &&
+	       ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
 }
 
 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/fs/xfs/libxfs/xfs_bmap.c linux-libre-4.14.147-gnu/fs/xfs/libxfs/xfs_bmap.c
--- linux-libre-4.14.146-gnu/fs/xfs/libxfs/xfs_bmap.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/fs/xfs/libxfs/xfs_bmap.c	2019-10-05 06:48:14.000000000 -0400
@@ -4006,15 +4006,28 @@ xfs_bmapi_read(
 	XFS_STATS_INC(mp, xs_blk_mapr);
 
 	ifp = XFS_IFORK_PTR(ip, whichfork);
+	if (!ifp) {
+		/* No CoW fork?  Return a hole. */
+		if (whichfork == XFS_COW_FORK) {
+			mval->br_startoff = bno;
+			mval->br_startblock = HOLESTARTBLOCK;
+			mval->br_blockcount = len;
+			mval->br_state = XFS_EXT_NORM;
+			*nmap = 1;
+			return 0;
+		}
 
-	/* No CoW fork?  Return a hole. */
-	if (whichfork == XFS_COW_FORK && !ifp) {
-		mval->br_startoff = bno;
-		mval->br_startblock = HOLESTARTBLOCK;
-		mval->br_blockcount = len;
-		mval->br_state = XFS_EXT_NORM;
-		*nmap = 1;
-		return 0;
+		/*
+		 * A missing attr ifork implies that the inode says we're in
+		 * extents or btree format but failed to pass the inode fork
+		 * verifier while trying to load it.  Treat that as a file
+		 * corruption too.
+		 */
+#ifdef DEBUG
+		xfs_alert(mp, "%s: inode %llu missing fork %d",
+				__func__, ip->i_ino, whichfork);
+#endif /* DEBUG */
+		return -EFSCORRUPTED;
 	}
 
 	if (!(ifp->if_flags & XFS_IFEXTENTS)) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/include/linux/bug.h linux-libre-4.14.147-gnu/include/linux/bug.h
--- linux-libre-4.14.146-gnu/include/linux/bug.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/include/linux/bug.h	2019-10-05 06:48:14.000000000 -0400
@@ -45,6 +45,11 @@ int is_valid_bugaddr(unsigned long addr)
 
 #else	/* !CONFIG_GENERIC_BUG */
 
+static inline void *find_bug(unsigned long bugaddr)
+{
+	return NULL;
+}
+
 static inline enum bug_trap_type report_bug(unsigned long bug_addr,
 					    struct pt_regs *regs)
 {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/include/linux/quotaops.h linux-libre-4.14.147-gnu/include/linux/quotaops.h
--- linux-libre-4.14.146-gnu/include/linux/quotaops.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/include/linux/quotaops.h	2019-10-05 06:48:14.000000000 -0400
@@ -22,7 +22,7 @@ static inline struct quota_info *sb_dqop
 /* i_mutex must being held */
 static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
 {
-	return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
+	return (ia->ia_valid & ATTR_SIZE) ||
 		(ia->ia_valid & ATTR_UID && !uid_eq(ia->ia_uid, inode->i_uid)) ||
 		(ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/include/rdma/ib_verbs.h linux-libre-4.14.147-gnu/include/rdma/ib_verbs.h
--- linux-libre-4.14.146-gnu/include/rdma/ib_verbs.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/include/rdma/ib_verbs.h	2019-10-05 06:48:14.000000000 -0400
@@ -68,6 +68,7 @@
 
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
+extern struct workqueue_struct *ib_comp_unbound_wq;
 
 union ib_gid {
 	u8	raw[16];
@@ -1544,9 +1545,10 @@ struct ib_ah {
 typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
 
 enum ib_poll_context {
-	IB_POLL_DIRECT,		/* caller context, no hw completions */
-	IB_POLL_SOFTIRQ,	/* poll from softirq context */
-	IB_POLL_WORKQUEUE,	/* poll from workqueue */
+	IB_POLL_DIRECT,		   /* caller context, no hw completions */
+	IB_POLL_SOFTIRQ,	   /* poll from softirq context */
+	IB_POLL_WORKQUEUE,	   /* poll from workqueue */
+	IB_POLL_UNBOUND_WORKQUEUE, /* poll from unbound workqueue */
 };
 
 struct ib_cq {
@@ -1563,6 +1565,7 @@ struct ib_cq {
 		struct irq_poll		iop;
 		struct work_struct	work;
 	};
+	struct workqueue_struct *comp_wq;
 };
 
 struct ib_srq {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/kernel/kprobes.c linux-libre-4.14.147-gnu/kernel/kprobes.c
--- linux-libre-4.14.146-gnu/kernel/kprobes.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/kernel/kprobes.c	2019-10-05 06:48:14.000000000 -0400
@@ -1501,7 +1501,8 @@ static int check_kprobe_address_safe(str
 	/* Ensure it is not in reserved area nor out of text */
 	if (!kernel_text_address((unsigned long) p->addr) ||
 	    within_kprobe_blacklist((unsigned long) p->addr) ||
-	    jump_label_text_reserved(p->addr, p->addr)) {
+	    jump_label_text_reserved(p->addr, p->addr) ||
+	    find_bug((unsigned long)p->addr)) {
 		ret = -EINVAL;
 		goto out;
 	}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/kernel/locking/lockdep.c linux-libre-4.14.147-gnu/kernel/locking/lockdep.c
--- linux-libre-4.14.146-gnu/kernel/locking/lockdep.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/kernel/locking/lockdep.c	2019-10-05 06:48:14.000000000 -0400
@@ -3688,6 +3688,9 @@ static int __lock_downgrade(struct lockd
 	unsigned int depth;
 	int i;
 
+	if (unlikely(!debug_locks))
+		return 0;
+
 	depth = curr->lockdep_depth;
 	/*
 	 * This function is about (re)setting the class of a held lock,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/kernel/printk/printk.c linux-libre-4.14.147-gnu/kernel/printk/printk.c
--- linux-libre-4.14.146-gnu/kernel/printk/printk.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/kernel/printk/printk.c	2019-10-05 06:48:14.000000000 -0400
@@ -3189,7 +3189,7 @@ bool kmsg_dump_get_buffer(struct kmsg_du
 	/* move first record forward until length fits into the buffer */
 	seq = dumper->cur_seq;
 	idx = dumper->cur_idx;
-	while (l > size && seq < dumper->next_seq) {
+	while (l >= size && seq < dumper->next_seq) {
 		struct printk_log *msg = log_from_idx(idx);
 
 		l -= msg_print_text(msg, true, NULL, 0);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/kernel/sched/core.c linux-libre-4.14.147-gnu/kernel/sched/core.c
--- linux-libre-4.14.146-gnu/kernel/sched/core.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/kernel/sched/core.c	2019-10-05 06:48:14.000000000 -0400
@@ -6342,10 +6342,6 @@ static int cpu_cgroup_can_attach(struct
 #ifdef CONFIG_RT_GROUP_SCHED
 		if (!sched_rt_can_attach(css_tg(css), task))
 			return -EINVAL;
-#else
-		/* We don't support RT-tasks being in separate groups */
-		if (task->sched_class != &fair_sched_class)
-			return -EINVAL;
 #endif
 		/*
 		 * Serialize against wake_up_new_task() such that if its
diff -druNp --no-dereference linux-libre-4.14.146-gnu/kernel/sched/fair.c linux-libre-4.14.147-gnu/kernel/sched/fair.c
--- linux-libre-4.14.146-gnu/kernel/sched/fair.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/kernel/sched/fair.c	2019-10-05 06:48:14.000000000 -0400
@@ -8359,9 +8359,10 @@ more_balance:
 out_balanced:
 	/*
 	 * We reach balance although we may have faced some affinity
-	 * constraints. Clear the imbalance flag if it was set.
+	 * constraints. Clear the imbalance flag only if other tasks got
+	 * a chance to move and fix the imbalance.
 	 */
-	if (sd_parent) {
+	if (sd_parent && !(env.flags & LBF_ALL_PINNED)) {
 		int *group_imbalance = &sd_parent->groups->sgc->imbalance;
 
 		if (*group_imbalance)
@@ -9422,18 +9423,18 @@ err:
 void online_fair_sched_group(struct task_group *tg)
 {
 	struct sched_entity *se;
+	struct rq_flags rf;
 	struct rq *rq;
 	int i;
 
 	for_each_possible_cpu(i) {
 		rq = cpu_rq(i);
 		se = tg->se[i];
-
-		raw_spin_lock_irq(&rq->lock);
+		rq_lock_irq(rq, &rf);
 		update_rq_clock(rq);
 		attach_entity_cfs_rq(se);
 		sync_throttle(tg, i);
-		raw_spin_unlock_irq(&rq->lock);
+		rq_unlock_irq(rq, &rf);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/kernel/time/alarmtimer.c linux-libre-4.14.147-gnu/kernel/time/alarmtimer.c
--- linux-libre-4.14.146-gnu/kernel/time/alarmtimer.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/kernel/time/alarmtimer.c	2019-10-05 06:48:14.000000000 -0400
@@ -676,7 +676,7 @@ static int alarm_timer_create(struct k_i
 	enum  alarmtimer_type type;
 
 	if (!alarmtimer_get_rtcdev())
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	if (!capable(CAP_WAKE_ALARM))
 		return -EPERM;
@@ -794,7 +794,7 @@ static int alarm_timer_nsleep(const cloc
 	int ret = 0;
 
 	if (!alarmtimer_get_rtcdev())
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	if (flags & ~TIMER_ABSTIME)
 		return -EINVAL;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/Makefile linux-libre-4.14.147-gnu/Makefile
--- linux-libre-4.14.146-gnu/Makefile	2019-09-21 06:02:35.000000000 -0400
+++ linux-libre-4.14.147-gnu/Makefile	2019-10-05 11:32:19.000000000 -0400
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 146
+SUBLEVEL = 147
 EXTRAVERSION = -gnu
 NAME = Petit Gorille
 
@@ -949,9 +949,11 @@ mod_sign_cmd = true
 endif
 export mod_sign_cmd
 
+HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
+
 ifdef CONFIG_STACK_VALIDATION
   has_libelf := $(call try-run,\
-		echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
+		echo "int main() {}" | $(HOSTCC) -xc -o /dev/null $(HOST_LIBELF_LIBS) -,1,0)
   ifeq ($(has_libelf),1)
     objtool_target := tools/objtool FORCE
   else
diff -druNp --no-dereference linux-libre-4.14.146-gnu/mm/compaction.c linux-libre-4.14.147-gnu/mm/compaction.c
--- linux-libre-4.14.146-gnu/mm/compaction.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/mm/compaction.c	2019-10-05 06:48:14.000000000 -0400
@@ -1517,6 +1517,17 @@ static enum compact_result compact_zone(
 	unsigned long end_pfn = zone_end_pfn(zone);
 	const bool sync = cc->mode != MIGRATE_ASYNC;
 
+	/*
+	 * These counters track activities during zone compaction.  Initialize
+	 * them before compacting a new zone.
+	 */
+	cc->total_migrate_scanned = 0;
+	cc->total_free_scanned = 0;
+	cc->nr_migratepages = 0;
+	cc->nr_freepages = 0;
+	INIT_LIST_HEAD(&cc->freepages);
+	INIT_LIST_HEAD(&cc->migratepages);
+
 	cc->migratetype = gfpflags_to_migratetype(cc->gfp_mask);
 	ret = compaction_suitable(zone, cc->order, cc->alloc_flags,
 							cc->classzone_idx);
@@ -1680,10 +1691,6 @@ static enum compact_result compact_zone_
 {
 	enum compact_result ret;
 	struct compact_control cc = {
-		.nr_freepages = 0,
-		.nr_migratepages = 0,
-		.total_migrate_scanned = 0,
-		.total_free_scanned = 0,
 		.order = order,
 		.gfp_mask = gfp_mask,
 		.zone = zone,
@@ -1696,8 +1703,6 @@ static enum compact_result compact_zone_
 		.ignore_skip_hint = (prio == MIN_COMPACT_PRIORITY),
 		.ignore_block_suitable = (prio == MIN_COMPACT_PRIORITY)
 	};
-	INIT_LIST_HEAD(&cc.freepages);
-	INIT_LIST_HEAD(&cc.migratepages);
 
 	ret = compact_zone(zone, &cc);
 
@@ -1796,8 +1801,6 @@ static void compact_node(int nid)
 	struct zone *zone;
 	struct compact_control cc = {
 		.order = -1,
-		.total_migrate_scanned = 0,
-		.total_free_scanned = 0,
 		.mode = MIGRATE_SYNC,
 		.ignore_skip_hint = true,
 		.whole_zone = true,
@@ -1811,11 +1814,7 @@ static void compact_node(int nid)
 		if (!populated_zone(zone))
 			continue;
 
-		cc.nr_freepages = 0;
-		cc.nr_migratepages = 0;
 		cc.zone = zone;
-		INIT_LIST_HEAD(&cc.freepages);
-		INIT_LIST_HEAD(&cc.migratepages);
 
 		compact_zone(zone, &cc);
 
@@ -1924,8 +1923,6 @@ static void kcompactd_do_work(pg_data_t
 	struct zone *zone;
 	struct compact_control cc = {
 		.order = pgdat->kcompactd_max_order,
-		.total_migrate_scanned = 0,
-		.total_free_scanned = 0,
 		.classzone_idx = pgdat->kcompactd_classzone_idx,
 		.mode = MIGRATE_SYNC_LIGHT,
 		.ignore_skip_hint = true,
@@ -1950,16 +1947,10 @@ static void kcompactd_do_work(pg_data_t
 							COMPACT_CONTINUE)
 			continue;
 
-		cc.nr_freepages = 0;
-		cc.nr_migratepages = 0;
-		cc.total_migrate_scanned = 0;
-		cc.total_free_scanned = 0;
-		cc.zone = zone;
-		INIT_LIST_HEAD(&cc.freepages);
-		INIT_LIST_HEAD(&cc.migratepages);
-
 		if (kthread_should_stop())
 			return;
+
+		cc.zone = zone;
 		status = compact_zone(zone, &cc);
 
 		if (status == COMPACT_SUCCESS) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/mm/memcontrol.c linux-libre-4.14.147-gnu/mm/memcontrol.c
--- linux-libre-4.14.146-gnu/mm/memcontrol.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/mm/memcontrol.c	2019-10-05 06:48:14.000000000 -0400
@@ -2352,6 +2352,16 @@ int memcg_kmem_charge_memcg(struct page
 
 	if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) &&
 	    !page_counter_try_charge(&memcg->kmem, nr_pages, &counter)) {
+
+		/*
+		 * Enforce __GFP_NOFAIL allocation because callers are not
+		 * prepared to see failures and likely do not have any failure
+		 * handling code.
+		 */
+		if (gfp & __GFP_NOFAIL) {
+			page_counter_charge(&memcg->kmem, nr_pages);
+			return 0;
+		}
 		cancel_charge(memcg, nr_pages);
 		return -ENOMEM;
 	}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/mm/oom_kill.c linux-libre-4.14.147-gnu/mm/oom_kill.c
--- linux-libre-4.14.146-gnu/mm/oom_kill.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/mm/oom_kill.c	2019-10-05 06:48:14.000000000 -0400
@@ -1050,9 +1050,10 @@ bool out_of_memory(struct oom_control *o
 	 * The OOM killer does not compensate for IO-less reclaim.
 	 * pagefault_out_of_memory lost its gfp context so we have to
 	 * make sure exclude 0 mask - all other users should have at least
-	 * ___GFP_DIRECT_RECLAIM to get here.
+	 * ___GFP_DIRECT_RECLAIM to get here. But mem_cgroup_oom() has to
+	 * invoke the OOM killer even if it is a GFP_NOFS allocation.
 	 */
-	if (oc->gfp_mask && !(oc->gfp_mask & __GFP_FS))
+	if (oc->gfp_mask && !(oc->gfp_mask & __GFP_FS) && !is_memcg_oom(oc))
 		return true;
 
 	/*
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/appletalk/ddp.c linux-libre-4.14.147-gnu/net/appletalk/ddp.c
--- linux-libre-4.14.146-gnu/net/appletalk/ddp.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/appletalk/ddp.c	2019-10-05 06:48:14.000000000 -0400
@@ -1029,6 +1029,11 @@ static int atalk_create(struct net *net,
 	 */
 	if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
 		goto out;
+
+	rc = -EPERM;
+	if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
+		goto out;
+
 	rc = -ENOMEM;
 	sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern);
 	if (!sk)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/ax25/af_ax25.c linux-libre-4.14.147-gnu/net/ax25/af_ax25.c
--- linux-libre-4.14.146-gnu/net/ax25/af_ax25.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/ax25/af_ax25.c	2019-10-05 06:48:14.000000000 -0400
@@ -859,6 +859,8 @@ static int ax25_create(struct net *net,
 		break;
 
 	case SOCK_RAW:
+		if (!capable(CAP_NET_RAW))
+			return -EPERM;
 		break;
 	default:
 		return -ESOCKTNOSUPPORT;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/bluetooth/hci_event.c linux-libre-4.14.147-gnu/net/bluetooth/hci_event.c
--- linux-libre-4.14.146-gnu/net/bluetooth/hci_event.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/bluetooth/hci_event.c	2019-10-05 06:48:14.000000000 -0400
@@ -5089,11 +5089,6 @@ static void hci_le_remote_conn_param_req
 		return send_conn_param_neg_reply(hdev, handle,
 						 HCI_ERROR_UNKNOWN_CONN_ID);
 
-	if (min < hcon->le_conn_min_interval ||
-	    max > hcon->le_conn_max_interval)
-		return send_conn_param_neg_reply(hdev, handle,
-						 HCI_ERROR_INVALID_LL_PARAMS);
-
 	if (hci_check_conn_params(min, max, latency, timeout))
 		return send_conn_param_neg_reply(hdev, handle,
 						 HCI_ERROR_INVALID_LL_PARAMS);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/bluetooth/l2cap_core.c linux-libre-4.14.147-gnu/net/bluetooth/l2cap_core.c
--- linux-libre-4.14.146-gnu/net/bluetooth/l2cap_core.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/bluetooth/l2cap_core.c	2019-10-05 06:48:14.000000000 -0400
@@ -5287,14 +5287,7 @@ static inline int l2cap_conn_param_updat
 
 	memset(&rsp, 0, sizeof(rsp));
 
-	if (min < hcon->le_conn_min_interval ||
-	    max > hcon->le_conn_max_interval) {
-		BT_DBG("requested connection interval exceeds current bounds.");
-		err = -EINVAL;
-	} else {
-		err = hci_check_conn_params(min, max, latency, to_multiplier);
-	}
-
+	err = hci_check_conn_params(min, max, latency, to_multiplier);
 	if (err)
 		rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
 	else
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/ieee802154/socket.c linux-libre-4.14.147-gnu/net/ieee802154/socket.c
--- linux-libre-4.14.146-gnu/net/ieee802154/socket.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/ieee802154/socket.c	2019-10-05 06:48:14.000000000 -0400
@@ -1001,6 +1001,9 @@ static int ieee802154_create(struct net
 
 	switch (sock->type) {
 	case SOCK_RAW:
+		rc = -EPERM;
+		if (!capable(CAP_NET_RAW))
+			goto out;
 		proto = &ieee802154_raw_prot;
 		ops = &ieee802154_raw_ops;
 		break;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/ipv4/raw_diag.c linux-libre-4.14.147-gnu/net/ipv4/raw_diag.c
--- linux-libre-4.14.146-gnu/net/ipv4/raw_diag.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/ipv4/raw_diag.c	2019-10-05 06:48:14.000000000 -0400
@@ -23,9 +23,6 @@ raw_get_hashinfo(const struct inet_diag_
 		return &raw_v6_hashinfo;
 #endif
 	} else {
-		pr_warn_once("Unexpected inet family %d\n",
-			     r->sdiag_family);
-		WARN_ON_ONCE(1);
 		return ERR_PTR(-EINVAL);
 	}
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/nfc/llcp_sock.c linux-libre-4.14.147-gnu/net/nfc/llcp_sock.c
--- linux-libre-4.14.146-gnu/net/nfc/llcp_sock.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/nfc/llcp_sock.c	2019-10-05 06:48:14.000000000 -0400
@@ -1012,10 +1012,13 @@ static int llcp_sock_create(struct net *
 	    sock->type != SOCK_RAW)
 		return -ESOCKTNOSUPPORT;
 
-	if (sock->type == SOCK_RAW)
+	if (sock->type == SOCK_RAW) {
+		if (!capable(CAP_NET_RAW))
+			return -EPERM;
 		sock->ops = &llcp_rawsock_ops;
-	else
+	} else {
 		sock->ops = &llcp_sock_ops;
+	}
 
 	sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern);
 	if (sk == NULL)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/openvswitch/datapath.c linux-libre-4.14.147-gnu/net/openvswitch/datapath.c
--- linux-libre-4.14.146-gnu/net/openvswitch/datapath.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/openvswitch/datapath.c	2019-10-05 06:48:14.000000000 -0400
@@ -2240,7 +2240,7 @@ static const struct nla_policy vport_pol
 	[OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) },
 	[OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 },
 	[OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 },
-	[OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_U32 },
+	[OVS_VPORT_ATTR_UPCALL_PID] = { .type = NLA_UNSPEC },
 	[OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
 };
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/qrtr/qrtr.c linux-libre-4.14.147-gnu/net/qrtr/qrtr.c
--- linux-libre-4.14.146-gnu/net/qrtr/qrtr.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/qrtr/qrtr.c	2019-10-05 06:48:14.000000000 -0400
@@ -129,6 +129,7 @@ static void __qrtr_node_release(struct k
 	list_del(&node->item);
 	mutex_unlock(&qrtr_node_lock);
 
+	cancel_work_sync(&node->work);
 	skb_queue_purge(&node->rx_queue);
 	kfree(node);
 }
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/sched/act_sample.c linux-libre-4.14.147-gnu/net/sched/act_sample.c
--- linux-libre-4.14.146-gnu/net/sched/act_sample.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/sched/act_sample.c	2019-10-05 06:48:14.000000000 -0400
@@ -132,6 +132,7 @@ static bool tcf_sample_dev_ok_push(struc
 	case ARPHRD_TUNNEL6:
 	case ARPHRD_SIT:
 	case ARPHRD_IPGRE:
+	case ARPHRD_IP6GRE:
 	case ARPHRD_VOID:
 	case ARPHRD_NONE:
 		return false;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/sched/sch_api.c linux-libre-4.14.147-gnu/net/sched/sch_api.c
--- linux-libre-4.14.146-gnu/net/sched/sch_api.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/sched/sch_api.c	2019-10-05 06:48:14.000000000 -0400
@@ -1217,7 +1217,8 @@ check_loop_fn(struct Qdisc *q, unsigned
  */
 
 const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = {
-	[TCA_KIND]		= { .type = NLA_STRING },
+	[TCA_KIND]		= { .type = NLA_NUL_STRING,
+				    .len = IFNAMSIZ - 1 },
 	[TCA_RATE]		= { .type = NLA_BINARY,
 				    .len = sizeof(struct tc_estimator) },
 	[TCA_STAB]		= { .type = NLA_NESTED },
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/sched/sch_netem.c linux-libre-4.14.147-gnu/net/sched/sch_netem.c
--- linux-libre-4.14.146-gnu/net/sched/sch_netem.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/sched/sch_netem.c	2019-10-05 06:48:14.000000000 -0400
@@ -708,7 +708,7 @@ static int get_dist_table(struct Qdisc *
 	struct disttable *d;
 	int i;
 
-	if (n > NETEM_DIST_MAX)
+	if (!n || n > NETEM_DIST_MAX)
 		return -EINVAL;
 
 	d = kvmalloc(sizeof(struct disttable) + n * sizeof(s16), GFP_KERNEL);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/net/wireless/util.c linux-libre-4.14.147-gnu/net/wireless/util.c
--- linux-libre-4.14.146-gnu/net/wireless/util.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/net/wireless/util.c	2019-10-05 06:48:14.000000000 -0400
@@ -1042,6 +1042,7 @@ int cfg80211_change_iface(struct cfg8021
 		}
 
 		cfg80211_process_rdev_events(rdev);
+		cfg80211_mlme_purge_registrations(dev->ieee80211_ptr);
 	}
 
 	err = rdev_change_virtual_intf(rdev, dev, ntype, params);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/scripts/gcc-plugins/randomize_layout_plugin.c linux-libre-4.14.147-gnu/scripts/gcc-plugins/randomize_layout_plugin.c
--- linux-libre-4.14.146-gnu/scripts/gcc-plugins/randomize_layout_plugin.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/scripts/gcc-plugins/randomize_layout_plugin.c	2019-10-05 06:48:14.000000000 -0400
@@ -443,13 +443,13 @@ static int is_pure_ops_struct(const_tree
 		if (node == fieldtype)
 			continue;
 
-		if (!is_fptr(fieldtype))
-			return 0;
-
-		if (code != RECORD_TYPE && code != UNION_TYPE)
+		if (code == RECORD_TYPE || code == UNION_TYPE) {
+			if (!is_pure_ops_struct(fieldtype))
+				return 0;
 			continue;
+		}
 
-		if (!is_pure_ops_struct(fieldtype))
+		if (!is_fptr(fieldtype))
 			return 0;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/firewire/tascam/tascam-pcm.c linux-libre-4.14.147-gnu/sound/firewire/tascam/tascam-pcm.c
--- linux-libre-4.14.146-gnu/sound/firewire/tascam/tascam-pcm.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/firewire/tascam/tascam-pcm.c	2019-10-05 06:48:14.000000000 -0400
@@ -57,6 +57,9 @@ static int pcm_open(struct snd_pcm_subst
 		goto err_locked;
 
 	err = snd_tscm_stream_get_clock(tscm, &clock);
+	if (err < 0)
+		goto err_locked;
+
 	if (clock != SND_TSCM_CLOCK_INTERNAL ||
 	    amdtp_stream_pcm_running(&tscm->rx_stream) ||
 	    amdtp_stream_pcm_running(&tscm->tx_stream)) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/firewire/tascam/tascam-stream.c linux-libre-4.14.147-gnu/sound/firewire/tascam/tascam-stream.c
--- linux-libre-4.14.146-gnu/sound/firewire/tascam/tascam-stream.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/firewire/tascam/tascam-stream.c	2019-10-05 06:48:14.000000000 -0400
@@ -9,20 +9,37 @@
 #include <linux/delay.h>
 #include "tascam.h"
 
+#define CLOCK_STATUS_MASK      0xffff0000
+#define CLOCK_CONFIG_MASK      0x0000ffff
+
 #define CALLBACK_TIMEOUT 500
 
 static int get_clock(struct snd_tscm *tscm, u32 *data)
 {
+	int trial = 0;
 	__be32 reg;
 	int err;
 
-	err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
-				 TSCM_ADDR_BASE + TSCM_OFFSET_CLOCK_STATUS,
-				 &reg, sizeof(reg), 0);
-	if (err >= 0)
+	while (trial++ < 5) {
+		err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
+				TSCM_ADDR_BASE + TSCM_OFFSET_CLOCK_STATUS,
+				&reg, sizeof(reg), 0);
+		if (err < 0)
+			return err;
+
 		*data = be32_to_cpu(reg);
+		if (*data & CLOCK_STATUS_MASK)
+			break;
 
-	return err;
+		// In intermediate state after changing clock status.
+		msleep(50);
+	}
+
+	// Still in the intermediate state.
+	if (trial >= 5)
+		return -EAGAIN;
+
+	return 0;
 }
 
 static int set_clock(struct snd_tscm *tscm, unsigned int rate,
@@ -35,7 +52,7 @@ static int set_clock(struct snd_tscm *ts
 	err = get_clock(tscm, &data);
 	if (err < 0)
 		return err;
-	data &= 0x0000ffff;
+	data &= CLOCK_CONFIG_MASK;
 
 	if (rate > 0) {
 		data &= 0x000000ff;
@@ -80,17 +97,14 @@ static int set_clock(struct snd_tscm *ts
 
 int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate)
 {
-	u32 data = 0x0;
-	unsigned int trials = 0;
+	u32 data;
 	int err;
 
-	while (data == 0x0 || trials++ < 5) {
-		err = get_clock(tscm, &data);
-		if (err < 0)
-			return err;
+	err = get_clock(tscm, &data);
+	if (err < 0)
+		return err;
 
-		data = (data & 0xff000000) >> 24;
-	}
+	data = (data & 0xff000000) >> 24;
 
 	/* Check base rate. */
 	if ((data & 0x0f) == 0x01)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/hda/hdac_controller.c linux-libre-4.14.147-gnu/sound/hda/hdac_controller.c
--- linux-libre-4.14.146-gnu/sound/hda/hdac_controller.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/hda/hdac_controller.c	2019-10-05 06:48:14.000000000 -0400
@@ -442,6 +442,8 @@ static void azx_int_disable(struct hdac_
 	list_for_each_entry(azx_dev, &bus->stream_list, list)
 		snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_INT_MASK, 0);
 
+	synchronize_irq(bus->irq);
+
 	/* disable SIE for all streams */
 	snd_hdac_chip_writeb(bus, INTCTL, 0);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/i2c/other/ak4xxx-adda.c linux-libre-4.14.147-gnu/sound/i2c/other/ak4xxx-adda.c
--- linux-libre-4.14.146-gnu/sound/i2c/other/ak4xxx-adda.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/i2c/other/ak4xxx-adda.c	2019-10-05 06:48:14.000000000 -0400
@@ -789,11 +789,12 @@ static int build_adc_controls(struct snd
 				return err;
 
 			memset(&knew, 0, sizeof(knew));
-			knew.name = ak->adc_info[mixer_ch].selector_name;
-			if (!knew.name) {
+			if (!ak->adc_info ||
+				!ak->adc_info[mixer_ch].selector_name) {
 				knew.name = "Capture Channel";
 				knew.index = mixer_ch + ak->idx_offset * 2;
-			}
+			} else
+				knew.name = ak->adc_info[mixer_ch].selector_name;
 
 			knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
 			knew.info = ak4xxx_capture_source_info;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/pci/hda/hda_controller.c linux-libre-4.14.147-gnu/sound/pci/hda/hda_controller.c
--- linux-libre-4.14.146-gnu/sound/pci/hda/hda_controller.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/pci/hda/hda_controller.c	2019-10-05 06:48:14.000000000 -0400
@@ -877,10 +877,13 @@ static int azx_rirb_get_response(struct
 	 */
 	if (hbus->allow_bus_reset && !hbus->response_reset && !hbus->in_reset) {
 		hbus->response_reset = 1;
+		dev_err(chip->card->dev,
+			"No response from codec, resetting bus: last cmd=0x%08x\n",
+			bus->last_cmd[addr]);
 		return -EAGAIN; /* give a chance to retry */
 	}
 
-	dev_err(chip->card->dev,
+	dev_WARN(chip->card->dev,
 		"azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n",
 		bus->last_cmd[addr]);
 	chip->single_cmd = 1;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/pci/hda/hda_intel.c linux-libre-4.14.147-gnu/sound/pci/hda/hda_intel.c
--- linux-libre-4.14.146-gnu/sound/pci/hda/hda_intel.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/pci/hda/hda_intel.c	2019-10-05 06:48:14.000000000 -0400
@@ -1413,9 +1413,9 @@ static int azx_free(struct azx *chip)
 	}
 
 	if (bus->chip_init) {
+		azx_stop_chip(chip);
 		azx_clear_irq_pending(chip);
 		azx_stop_all_streams(chip);
-		azx_stop_chip(chip);
 	}
 
 	if (bus->irq >= 0)
@@ -2586,8 +2586,7 @@ static const struct pci_device_id azx_id
 			 AZX_DCAPS_PM_RUNTIME },
 	/* AMD Raven */
 	{ PCI_DEVICE(0x1022, 0x15e3),
-	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
-			 AZX_DCAPS_PM_RUNTIME },
+	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB },
 	/* ATI HDMI */
 	{ PCI_DEVICE(0x1002, 0x0002),
 	  .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/pci/hda/patch_analog.c linux-libre-4.14.147-gnu/sound/pci/hda/patch_analog.c
--- linux-libre-4.14.146-gnu/sound/pci/hda/patch_analog.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/pci/hda/patch_analog.c	2019-10-05 06:48:14.000000000 -0400
@@ -370,6 +370,7 @@ static const struct hda_fixup ad1986a_fi
 
 static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
+	SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC),
 	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
 	SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
 	SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/pci/hda/patch_hdmi.c linux-libre-4.14.147-gnu/sound/pci/hda/patch_hdmi.c
--- linux-libre-4.14.146-gnu/sound/pci/hda/patch_hdmi.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/pci/hda/patch_hdmi.c	2019-10-05 06:48:14.000000000 -0400
@@ -2555,13 +2555,20 @@ static void i915_pin_cvt_fixup(struct hd
 /* precondition and allocation for Intel codecs */
 static int alloc_intel_hdmi(struct hda_codec *codec)
 {
+	int err;
+
 	/* requires i915 binding */
 	if (!codec->bus->core.audio_component) {
 		codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n");
 		return -ENODEV;
 	}
 
-	return alloc_generic_hdmi(codec);
+	err = alloc_generic_hdmi(codec);
+	if (err < 0)
+		return err;
+	/* no need to handle unsol events */
+	codec->patch_ops.unsol_event = NULL;
+	return 0;
 }
 
 /* parse and post-process for Intel codecs */
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/pci/hda/patch_realtek.c linux-libre-4.14.147-gnu/sound/pci/hda/patch_realtek.c
--- linux-libre-4.14.146-gnu/sound/pci/hda/patch_realtek.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/pci/hda/patch_realtek.c	2019-10-05 06:48:14.000000000 -0400
@@ -977,6 +977,9 @@ static const struct snd_pci_quirk beep_w
 	SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
 	SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
 	SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
+	/* blacklist -- no beep available */
+	SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
+	SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
 	{}
 };
 
@@ -3608,6 +3611,19 @@ static void alc269_fixup_hp_mute_led_mic
 	}
 }
 
+static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
+				const struct hda_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+		spec->mute_led_polarity = 0;
+		spec->mute_led_nid = 0x1b;
+		spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
+		spec->gen.vmaster_mute_enum = 1;
+		codec->power_filter = led_power_filter;
+	}
+}
+
 /* update LED status via GPIO */
 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
 				bool enabled)
@@ -5382,6 +5398,7 @@ enum {
 	ALC269_FIXUP_HP_MUTE_LED,
 	ALC269_FIXUP_HP_MUTE_LED_MIC1,
 	ALC269_FIXUP_HP_MUTE_LED_MIC2,
+	ALC269_FIXUP_HP_MUTE_LED_MIC3,
 	ALC269_FIXUP_HP_GPIO_LED,
 	ALC269_FIXUP_HP_GPIO_MIC1_LED,
 	ALC269_FIXUP_HP_LINE1_MIC1_LED,
@@ -5645,6 +5662,10 @@ static const struct hda_fixup alc269_fix
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc269_fixup_hp_mute_led_mic2,
 	},
+	[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc269_fixup_hp_mute_led_mic3,
+	},
 	[ALC269_FIXUP_HP_GPIO_LED] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc269_fixup_hp_gpio_led,
@@ -6499,6 +6520,7 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
 	SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
 	SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
+	SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
 	SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/codecs/es8316.c linux-libre-4.14.147-gnu/sound/soc/codecs/es8316.c
--- linux-libre-4.14.146-gnu/sound/soc/codecs/es8316.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/codecs/es8316.c	2019-10-05 06:48:14.000000000 -0400
@@ -46,7 +46,10 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_S
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_max_gain_tlv, -650, 150, 0);
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_min_gain_tlv, -1200, 150, 0);
 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_target_tlv, -1650, 150, 0);
-static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(hpmixer_gain_tlv, -1200, 150, 0);
+static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpmixer_gain_tlv,
+	0, 4, TLV_DB_SCALE_ITEM(-1200, 150, 0),
+	8, 11, TLV_DB_SCALE_ITEM(-450, 150, 0),
+);
 
 static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv,
 	0, 0, TLV_DB_SCALE_ITEM(-350, 0, 0),
@@ -84,7 +87,7 @@ static const struct snd_kcontrol_new es8
 	SOC_DOUBLE_TLV("Headphone Playback Volume", ES8316_CPHP_ICAL_VOL,
 		       4, 0, 3, 1, hpout_vol_tlv),
 	SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
-		       0, 4, 7, 0, hpmixer_gain_tlv),
+		       0, 4, 11, 0, hpmixer_gain_tlv),
 
 	SOC_ENUM("Playback Polarity", dacpol),
 	SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/codecs/sgtl5000.c linux-libre-4.14.147-gnu/sound/soc/codecs/sgtl5000.c
--- linux-libre-4.14.146-gnu/sound/soc/codecs/sgtl5000.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/codecs/sgtl5000.c	2019-10-05 06:48:14.000000000 -0400
@@ -1084,12 +1084,17 @@ static int sgtl5000_set_power_regs(struc
 					SGTL5000_INT_OSC_EN);
 		/* Enable VDDC charge pump */
 		ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP;
-	} else if (vddio >= 3100 && vdda >= 3100) {
+	} else {
 		ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP;
-		/* VDDC use VDDIO rail */
-		lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
-		lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<
-			    SGTL5000_VDDC_MAN_ASSN_SHIFT;
+		/*
+		 * if vddio == vdda the source of charge pump should be
+		 * assigned manually to VDDIO
+		 */
+		if (vddio == vdda) {
+			lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
+			lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<
+				    SGTL5000_VDDC_MAN_ASSN_SHIFT;
+		}
 	}
 
 	snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, lreg_ctrl);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/fsl/fsl_ssi.c linux-libre-4.14.147-gnu/sound/soc/fsl/fsl_ssi.c
--- linux-libre-4.14.146-gnu/sound/soc/fsl/fsl_ssi.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/fsl/fsl_ssi.c	2019-10-05 06:48:14.000000000 -0400
@@ -1418,6 +1418,7 @@ static int fsl_ssi_probe(struct platform
 	struct fsl_ssi_private *ssi_private;
 	int ret = 0;
 	struct device_node *np = pdev->dev.of_node;
+	struct device_node *root;
 	const struct of_device_id *of_id;
 	const char *p, *sprop;
 	const uint32_t *iprop;
@@ -1605,7 +1606,9 @@ static int fsl_ssi_probe(struct platform
 	 * device tree.  We also pass the address of the CPU DAI driver
 	 * structure.
 	 */
-	sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL);
+	root = of_find_node_by_path("/");
+	sprop = of_get_property(root, "compatible", NULL);
+	of_node_put(root);
 	/* Sometimes the compatible name has a "fsl," prefix, so we strip it. */
 	p = strrchr(sprop, ',');
 	if (p)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/intel/common/sst-ipc.c linux-libre-4.14.147-gnu/sound/soc/intel/common/sst-ipc.c
--- linux-libre-4.14.146-gnu/sound/soc/intel/common/sst-ipc.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/intel/common/sst-ipc.c	2019-10-05 06:48:14.000000000 -0400
@@ -231,6 +231,8 @@ struct ipc_message *sst_ipc_reply_find_m
 
 	if (ipc->ops.reply_msg_match != NULL)
 		header = ipc->ops.reply_msg_match(header, &mask);
+	else
+		mask = (u64)-1;
 
 	if (list_empty(&ipc->rx_list)) {
 		dev_err(ipc->dev, "error: rx list empty but received 0x%llx\n",
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/intel/skylake/skl-debug.c linux-libre-4.14.147-gnu/sound/soc/intel/skylake/skl-debug.c
--- linux-libre-4.14.146-gnu/sound/soc/intel/skylake/skl-debug.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/intel/skylake/skl-debug.c	2019-10-05 06:48:14.000000000 -0400
@@ -196,7 +196,7 @@ static ssize_t fw_softreg_read(struct fi
 	memset(d->fw_read_buff, 0, FW_REG_BUF);
 
 	if (w0_stat_sz > 0)
-		__iowrite32_copy(d->fw_read_buff, fw_reg_addr, w0_stat_sz >> 2);
+		__ioread32_copy(d->fw_read_buff, fw_reg_addr, w0_stat_sz >> 2);
 
 	for (offset = 0; offset < FW_REG_SIZE; offset += 16) {
 		ret += snprintf(tmp + ret, FW_REG_BUF - ret, "%#.4x: ", offset);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/intel/skylake/skl-nhlt.c linux-libre-4.14.147-gnu/sound/soc/intel/skylake/skl-nhlt.c
--- linux-libre-4.14.146-gnu/sound/soc/intel/skylake/skl-nhlt.c	2019-09-21 06:31:25.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/intel/skylake/skl-nhlt.c	2019-10-05 12:12:47.000000000 -0400
@@ -215,7 +215,7 @@ int skl_nhlt_update_topology_bin(struct
 	struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
 	struct device *dev = bus->dev;
 
-	dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n",
+	dev_dbg(dev, "oem_id %.6s, oem_table_id %.8s oem_revision %d\n",
 		nhlt->header.oem_id, nhlt->header.oem_table_id,
 		nhlt->header.oem_revision);
 
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/sh/rcar/adg.c linux-libre-4.14.147-gnu/sound/soc/sh/rcar/adg.c
--- linux-libre-4.14.146-gnu/sound/soc/sh/rcar/adg.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/sh/rcar/adg.c	2019-10-05 06:48:14.000000000 -0400
@@ -33,6 +33,7 @@ struct rsnd_adg {
 	struct clk *clkout[CLKOUTMAX];
 	struct clk_onecell_data onecell;
 	struct rsnd_mod mod;
+	int clk_rate[CLKMAX];
 	u32 flags;
 	u32 ckr;
 	u32 rbga;
@@ -110,9 +111,9 @@ static void __rsnd_adg_get_timesel_ratio
 	unsigned int val, en;
 	unsigned int min, diff;
 	unsigned int sel_rate[] = {
-		clk_get_rate(adg->clk[CLKA]),	/* 0000: CLKA */
-		clk_get_rate(adg->clk[CLKB]),	/* 0001: CLKB */
-		clk_get_rate(adg->clk[CLKC]),	/* 0010: CLKC */
+		adg->clk_rate[CLKA],	/* 0000: CLKA */
+		adg->clk_rate[CLKB],	/* 0001: CLKB */
+		adg->clk_rate[CLKC],	/* 0010: CLKC */
 		adg->rbga_rate_for_441khz,	/* 0011: RBGA */
 		adg->rbgb_rate_for_48khz,	/* 0100: RBGB */
 	};
@@ -328,7 +329,7 @@ int rsnd_adg_clk_query(struct rsnd_priv
 	 * AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI.
 	 */
 	for_each_rsnd_clk(clk, adg, i) {
-		if (rate == clk_get_rate(clk))
+		if (rate == adg->clk_rate[i])
 			return sel_table[i];
 	}
 
@@ -394,10 +395,18 @@ void rsnd_adg_clk_control(struct rsnd_pr
 
 	for_each_rsnd_clk(clk, adg, i) {
 		ret = 0;
-		if (enable)
+		if (enable) {
 			ret = clk_prepare_enable(clk);
-		else
+
+			/*
+			 * We shouldn't use clk_get_rate() under
+			 * atomic context. Let's keep it when
+			 * rsnd_adg_clk_enable() was called
+			 */
+			adg->clk_rate[i] = clk_get_rate(adg->clk[i]);
+		} else {
 			clk_disable_unprepare(clk);
+		}
 
 		if (ret < 0)
 			dev_warn(dev, "can't use clk %d\n", i);
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/soc/soc-generic-dmaengine-pcm.c linux-libre-4.14.147-gnu/sound/soc/soc-generic-dmaengine-pcm.c
--- linux-libre-4.14.146-gnu/sound/soc/soc-generic-dmaengine-pcm.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/soc/soc-generic-dmaengine-pcm.c	2019-10-05 06:48:14.000000000 -0400
@@ -311,6 +311,12 @@ static int dmaengine_pcm_new(struct snd_
 
 		if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
 			pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
+
+		if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
+			strncpy(rtd->pcm->streams[i].pcm->name,
+				rtd->pcm->streams[i].pcm->id,
+				sizeof(rtd->pcm->streams[i].pcm->name));
+		}
 	}
 
 	return 0;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/sound/usb/pcm.c linux-libre-4.14.147-gnu/sound/usb/pcm.c
--- linux-libre-4.14.146-gnu/sound/usb/pcm.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/sound/usb/pcm.c	2019-10-05 06:48:14.000000000 -0400
@@ -470,6 +470,7 @@ static int set_sync_endpoint(struct snd_
 	}
 	ep = get_endpoint(alts, 1)->bEndpointAddress;
 	if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
+	    get_endpoint(alts, 0)->bSynchAddress != 0 &&
 	    ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
 	     (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
 		dev_err(&dev->dev,
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/lib/traceevent/event-plugin.c linux-libre-4.14.147-gnu/tools/lib/traceevent/event-plugin.c
--- linux-libre-4.14.146-gnu/tools/lib/traceevent/event-plugin.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/lib/traceevent/event-plugin.c	2019-10-05 06:48:14.000000000 -0400
@@ -30,7 +30,7 @@
 #include "event-parse.h"
 #include "event-utils.h"
 
-#define LOCAL_PLUGIN_DIR ".traceevent/plugins"
+#define LOCAL_PLUGIN_DIR ".local/lib/traceevent/plugins/"
 
 static struct registered_plugin_options {
 	struct registered_plugin_options	*next;
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/lib/traceevent/Makefile linux-libre-4.14.147-gnu/tools/lib/traceevent/Makefile
--- linux-libre-4.14.146-gnu/tools/lib/traceevent/Makefile	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/lib/traceevent/Makefile	2019-10-05 06:48:14.000000000 -0400
@@ -55,15 +55,15 @@ set_plugin_dir := 1
 
 # Set plugin_dir to preffered global plugin location
 # If we install under $HOME directory we go under
-# $(HOME)/.traceevent/plugins
+# $(HOME)/.local/lib/traceevent/plugins
 #
 # We dont set PLUGIN_DIR in case we install under $HOME
 # directory, because by default the code looks under:
-# $(HOME)/.traceevent/plugins by default.
+# $(HOME)/.local/lib/traceevent/plugins by default.
 #
 ifeq ($(plugin_dir),)
 ifeq ($(prefix),$(HOME))
-override plugin_dir = $(HOME)/.traceevent/plugins
+override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
 set_plugin_dir := 0
 else
 override plugin_dir = $(libdir)/traceevent/plugins
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/objtool/Makefile linux-libre-4.14.147-gnu/tools/objtool/Makefile
--- linux-libre-4.14.146-gnu/tools/objtool/Makefile	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/objtool/Makefile	2019-10-05 06:48:14.000000000 -0400
@@ -26,14 +26,17 @@ LIBSUBCMD		= $(LIBSUBCMD_OUTPUT)libsubcm
 OBJTOOL    := $(OUTPUT)objtool
 OBJTOOL_IN := $(OBJTOOL)-in.o
 
+LIBELF_FLAGS := $(shell pkg-config libelf --cflags 2>/dev/null)
+LIBELF_LIBS  := $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
+
 all: $(OBJTOOL)
 
 INCLUDES := -I$(srctree)/tools/include \
 	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
 	    -I$(srctree)/tools/objtool/arch/$(ARCH)/include
 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
-CFLAGS   += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
-LDFLAGS  += -lelf $(LIBSUBCMD)
+CFLAGS   := -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) $(LIBELF_FLAGS)
+LDFLAGS  += $(LIBELF_LIBS) $(LIBSUBCMD)
 
 # Allow old libelf to be used:
 elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr)
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/perf/tests/shell/trace+probe_vfs_getname.sh linux-libre-4.14.147-gnu/tools/perf/tests/shell/trace+probe_vfs_getname.sh
--- linux-libre-4.14.146-gnu/tools/perf/tests/shell/trace+probe_vfs_getname.sh	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/perf/tests/shell/trace+probe_vfs_getname.sh	2019-10-05 06:48:14.000000000 -0400
@@ -30,6 +30,10 @@ if [ $err -ne 0 ] ; then
 	exit $err
 fi
 
+# Do not use whatever ~/.perfconfig file, it may change the output
+# via trace.{show_timestamp,show_prefix,etc}
+export PERF_CONFIG=/dev/null
+
 trace_open_vfs_getname
 err=$?
 rm -f ${file}
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/perf/trace/beauty/ioctl.c linux-libre-4.14.147-gnu/tools/perf/trace/beauty/ioctl.c
--- linux-libre-4.14.146-gnu/tools/perf/trace/beauty/ioctl.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/perf/trace/beauty/ioctl.c	2019-10-05 06:48:14.000000000 -0400
@@ -22,7 +22,7 @@
 static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size)
 {
 	static const char *ioctl_tty_cmd[] = {
-	"TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
+	[_IOC_NR(TCGETS)] = "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
 	"TCSETAF", "TCSBRK", "TCXONC", "TCFLSH", "TIOCEXCL", "TIOCNXCL", "TIOCSCTTY",
 	"TIOCGPGRP", "TIOCSPGRP", "TIOCOUTQ", "TIOCSTI", "TIOCGWINSZ", "TIOCSWINSZ",
 	"TIOCMGET", "TIOCMBIS", "TIOCMBIC", "TIOCMSET", "TIOCGSOFTCAR", "TIOCSSOFTCAR",
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/perf/util/header.c linux-libre-4.14.147-gnu/tools/perf/util/header.c
--- linux-libre-4.14.146-gnu/tools/perf/util/header.c	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/perf/util/header.c	2019-10-05 06:48:14.000000000 -0400
@@ -1882,8 +1882,10 @@ static int process_cpu_topology(struct f
 	/* On s390 the socket_id number is not related to the numbers of cpus.
 	 * The socket_id number might be higher than the numbers of cpus.
 	 * This depends on the configuration.
+	 * AArch64 is the same.
 	 */
-	if (ph->env.arch && !strncmp(ph->env.arch, "s390", 4))
+	if (ph->env.arch && (!strncmp(ph->env.arch, "s390", 4)
+			  || !strncmp(ph->env.arch, "aarch64", 7)))
 		do_core_id_test = false;
 
 	for (i = 0; i < (u32)cpu_nr; i++) {
diff -druNp --no-dereference linux-libre-4.14.146-gnu/tools/perf/util/xyarray.h linux-libre-4.14.147-gnu/tools/perf/util/xyarray.h
--- linux-libre-4.14.146-gnu/tools/perf/util/xyarray.h	2019-09-21 01:15:48.000000000 -0400
+++ linux-libre-4.14.147-gnu/tools/perf/util/xyarray.h	2019-10-05 06:48:14.000000000 -0400
@@ -2,6 +2,7 @@
 #ifndef _PERF_XYARRAY_H_
 #define _PERF_XYARRAY_H_ 1
 
+#include <linux/compiler.h>
 #include <sys/types.h>
 
 struct xyarray {
@@ -10,7 +11,7 @@ struct xyarray {
 	size_t entries;
 	size_t max_x;
 	size_t max_y;
-	char contents[];
+	char contents[] __aligned(8);
 };
 
 struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size);
