diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/powerpc/kvm/book3s_64_vio.c linux-libre-4.14.142-gnu/arch/powerpc/kvm/book3s_64_vio.c
--- linux-libre-4.14.141-gnu/arch/powerpc/kvm/book3s_64_vio.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/powerpc/kvm/book3s_64_vio.c	2019-09-06 04:21:01.000000000 -0400
@@ -566,8 +566,10 @@ long kvmppc_h_put_tce_indirect(struct kv
 
 		if (kvmppc_gpa_to_ua(vcpu->kvm,
 				tce & ~(TCE_PCI_READ | TCE_PCI_WRITE),
-				&ua, NULL))
-			return H_PARAMETER;
+				&ua, NULL)) {
+			ret = H_PARAMETER;
+			goto unlock_exit;
+		}
 
 		list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
 			ret = kvmppc_tce_iommu_map(vcpu->kvm,
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/powerpc/kvm/book3s_64_vio_hv.c linux-libre-4.14.142-gnu/arch/powerpc/kvm/book3s_64_vio_hv.c
--- linux-libre-4.14.141-gnu/arch/powerpc/kvm/book3s_64_vio_hv.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/powerpc/kvm/book3s_64_vio_hv.c	2019-09-06 04:21:01.000000000 -0400
@@ -475,8 +475,10 @@ long kvmppc_rm_h_put_tce_indirect(struct
 		ua = 0;
 		if (kvmppc_gpa_to_ua(vcpu->kvm,
 				tce & ~(TCE_PCI_READ | TCE_PCI_WRITE),
-				&ua, NULL))
-			return H_PARAMETER;
+				&ua, NULL)) {
+			ret = H_PARAMETER;
+			goto unlock_exit;
+		}
 
 		list_for_each_entry_lockless(stit, &stt->iommu_tables, next) {
 			ret = kvmppc_rm_tce_iommu_map(vcpu->kvm,
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/x86/kernel/apic/apic.c linux-libre-4.14.142-gnu/arch/x86/kernel/apic/apic.c
--- linux-libre-4.14.141-gnu/arch/x86/kernel/apic/apic.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/x86/kernel/apic/apic.c	2019-09-06 04:21:01.000000000 -0400
@@ -1148,6 +1148,10 @@ void clear_local_APIC(void)
 	apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
 	v = apic_read(APIC_LVT1);
 	apic_write(APIC_LVT1, v | APIC_LVT_MASKED);
+	if (!x2apic_enabled()) {
+		v = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
+		apic_write(APIC_LDR, v);
+	}
 	if (maxlvt >= 4) {
 		v = apic_read(APIC_LVTPC);
 		apic_write(APIC_LVTPC, v | APIC_LVT_MASKED);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/x86/kernel/apic/bigsmp_32.c linux-libre-4.14.142-gnu/arch/x86/kernel/apic/bigsmp_32.c
--- linux-libre-4.14.141-gnu/arch/x86/kernel/apic/bigsmp_32.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/x86/kernel/apic/bigsmp_32.c	2019-09-06 04:21:01.000000000 -0400
@@ -38,32 +38,12 @@ static int bigsmp_early_logical_apicid(i
 	return early_per_cpu(x86_cpu_to_apicid, cpu);
 }
 
-static inline unsigned long calculate_ldr(int cpu)
-{
-	unsigned long val, id;
-
-	val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
-	id = per_cpu(x86_bios_cpu_apicid, cpu);
-	val |= SET_APIC_LOGICAL_ID(id);
-
-	return val;
-}
-
 /*
- * Set up the logical destination ID.
- *
- * Intel recommends to set DFR, LDR and TPR before enabling
- * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
- * document number 292116).  So here it goes...
+ * bigsmp enables physical destination mode
+ * and doesn't use LDR and DFR
  */
 static void bigsmp_init_apic_ldr(void)
 {
-	unsigned long val;
-	int cpu = smp_processor_id();
-
-	apic_write(APIC_DFR, APIC_DFR_FLAT);
-	val = calculate_ldr(cpu);
-	apic_write(APIC_LDR, val);
 }
 
 static void bigsmp_setup_apic_routing(void)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/x86/kernel/ptrace.c linux-libre-4.14.142-gnu/arch/x86/kernel/ptrace.c
--- linux-libre-4.14.141-gnu/arch/x86/kernel/ptrace.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/x86/kernel/ptrace.c	2019-09-06 04:21:01.000000000 -0400
@@ -652,11 +652,10 @@ static unsigned long ptrace_get_debugreg
 {
 	struct thread_struct *thread = &tsk->thread;
 	unsigned long val = 0;
-	int index = n;
 
 	if (n < HBP_NUM) {
+		int index = array_index_nospec(n, HBP_NUM);
 		struct perf_event *bp = thread->ptrace_bps[index];
-		index = array_index_nospec(index, HBP_NUM);
 
 		if (bp)
 			val = bp->hw.info.address;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/x86/kernel/uprobes.c linux-libre-4.14.142-gnu/arch/x86/kernel/uprobes.c
--- linux-libre-4.14.141-gnu/arch/x86/kernel/uprobes.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/x86/kernel/uprobes.c	2019-09-06 04:21:01.000000000 -0400
@@ -518,9 +518,12 @@ struct uprobe_xol_ops {
 	void	(*abort)(struct arch_uprobe *, struct pt_regs *);
 };
 
-static inline int sizeof_long(void)
+static inline int sizeof_long(struct pt_regs *regs)
 {
-	return in_ia32_syscall() ? 4 : 8;
+	/*
+	 * Check registers for mode as in_xxx_syscall() does not apply here.
+	 */
+	return user_64bit_mode(regs) ? 8 : 4;
 }
 
 static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs)
@@ -531,9 +534,9 @@ static int default_pre_xol_op(struct arc
 
 static int push_ret_address(struct pt_regs *regs, unsigned long ip)
 {
-	unsigned long new_sp = regs->sp - sizeof_long();
+	unsigned long new_sp = regs->sp - sizeof_long(regs);
 
-	if (copy_to_user((void __user *)new_sp, &ip, sizeof_long()))
+	if (copy_to_user((void __user *)new_sp, &ip, sizeof_long(regs)))
 		return -EFAULT;
 
 	regs->sp = new_sp;
@@ -566,7 +569,7 @@ static int default_post_xol_op(struct ar
 		long correction = utask->vaddr - utask->xol_vaddr;
 		regs->ip += correction;
 	} else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) {
-		regs->sp += sizeof_long(); /* Pop incorrect return address */
+		regs->sp += sizeof_long(regs); /* Pop incorrect return address */
 		if (push_ret_address(regs, utask->vaddr + auprobe->defparam.ilen))
 			return -ERESTART;
 	}
@@ -675,7 +678,7 @@ static int branch_post_xol_op(struct arc
 	 * "call" insn was executed out-of-line. Just restore ->sp and restart.
 	 * We could also restore ->ip and try to call branch_emulate_op() again.
 	 */
-	regs->sp += sizeof_long();
+	regs->sp += sizeof_long(regs);
 	return -ERESTART;
 }
 
@@ -966,7 +969,7 @@ bool arch_uprobe_skip_sstep(struct arch_
 unsigned long
 arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs)
 {
-	int rasize = sizeof_long(), nleft;
+	int rasize = sizeof_long(regs), nleft;
 	unsigned long orig_ret_vaddr = 0; /* clear high bits for 32-bit apps */
 
 	if (copy_from_user(&orig_ret_vaddr, (void __user *)regs->sp, rasize))
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/x86/kvm/lapic.c linux-libre-4.14.142-gnu/arch/x86/kvm/lapic.c
--- linux-libre-4.14.141-gnu/arch/x86/kvm/lapic.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/x86/kvm/lapic.c	2019-09-06 04:21:01.000000000 -0400
@@ -209,6 +209,9 @@ static void recalculate_apic_map(struct
 		if (!apic_x2apic_mode(apic) && !new->phys_map[xapic_id])
 			new->phys_map[xapic_id] = apic;
 
+		if (!kvm_apic_sw_enabled(apic))
+			continue;
+
 		ldr = kvm_lapic_get_reg(apic, APIC_LDR);
 
 		if (apic_x2apic_mode(apic)) {
@@ -252,6 +255,8 @@ static inline void apic_set_spiv(struct
 			recalculate_apic_map(apic->vcpu->kvm);
 		} else
 			static_key_slow_inc(&apic_sw_disabled.key);
+
+		recalculate_apic_map(apic->vcpu->kvm);
 	}
 }
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/arch/x86/kvm/x86.c linux-libre-4.14.142-gnu/arch/x86/kvm/x86.c
--- linux-libre-4.14.141-gnu/arch/x86/kvm/x86.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/arch/x86/kvm/x86.c	2019-09-06 04:21:01.000000000 -0400
@@ -5954,12 +5954,13 @@ restart:
 		unsigned long rflags = kvm_x86_ops->get_rflags(vcpu);
 		toggle_interruptibility(vcpu, ctxt->interruptibility);
 		vcpu->arch.emulate_regs_need_sync_to_vcpu = false;
-		kvm_rip_write(vcpu, ctxt->eip);
-		if (r == EMULATE_DONE && ctxt->tf)
-			kvm_vcpu_do_singlestep(vcpu, &r);
 		if (!ctxt->have_exception ||
-		    exception_type(ctxt->exception.vector) == EXCPT_TRAP)
+		    exception_type(ctxt->exception.vector) == EXCPT_TRAP) {
+			kvm_rip_write(vcpu, ctxt->eip);
+			if (r == EMULATE_DONE && ctxt->tf)
+				kvm_vcpu_do_singlestep(vcpu, &r);
 			__kvm_set_rflags(vcpu, ctxt->eflags);
+		}
 
 		/*
 		 * For STI, interrupts are shadowed; so KVM_REQ_EVENT will
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/auxdisplay/panel.c linux-libre-4.14.142-gnu/drivers/auxdisplay/panel.c
--- linux-libre-4.14.141-gnu/drivers/auxdisplay/panel.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/auxdisplay/panel.c	2019-09-06 04:21:01.000000000 -0400
@@ -1622,6 +1622,8 @@ static void panel_attach(struct parport
 	return;
 
 err_lcd_unreg:
+	if (scan_timer.function)
+		del_timer_sync(&scan_timer);
 	if (lcd.enabled)
 		charlcd_unregister(lcd.charlcd);
 err_unreg_device:
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/block/xen-blkback/xenbus.c linux-libre-4.14.142-gnu/drivers/block/xen-blkback/xenbus.c
--- linux-libre-4.14.141-gnu/drivers/block/xen-blkback/xenbus.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/block/xen-blkback/xenbus.c	2019-09-06 04:21:01.000000000 -0400
@@ -973,6 +973,7 @@ static int read_per_ring_refs(struct xen
 	}
 	blkif->nr_ring_pages = nr_grefs;
 
+	err = -ENOMEM;
 	for (i = 0; i < nr_grefs * XEN_BLKIF_REQS_PER_PAGE; i++) {
 		req = kzalloc(sizeof(*req), GFP_KERNEL);
 		if (!req)
@@ -995,7 +996,7 @@ static int read_per_ring_refs(struct xen
 	err = xen_blkif_map(ring, ring_ref, nr_grefs, evtchn);
 	if (err) {
 		xenbus_dev_fatal(dev, err, "mapping ring-ref port %u", evtchn);
-		return err;
+		goto fail;
 	}
 
 	return 0;
@@ -1015,8 +1016,7 @@ fail:
 		}
 		kfree(req);
 	}
-	return -ENOMEM;
-
+	return err;
 }
 
 static int connect_ring(struct backend_info *be)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/crypto/ccp/ccp-dev.c linux-libre-4.14.142-gnu/drivers/crypto/ccp/ccp-dev.c
--- linux-libre-4.14.141-gnu/drivers/crypto/ccp/ccp-dev.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/crypto/ccp/ccp-dev.c	2019-09-06 04:21:01.000000000 -0400
@@ -540,6 +540,10 @@ int ccp_dev_suspend(struct sp_device *sp
 	unsigned long flags;
 	unsigned int i;
 
+	/* If there's no device there's nothing to do */
+	if (!ccp)
+		return 0;
+
 	spin_lock_irqsave(&ccp->cmd_lock, flags);
 
 	ccp->suspending = 1;
@@ -564,6 +568,10 @@ int ccp_dev_resume(struct sp_device *sp)
 	unsigned long flags;
 	unsigned int i;
 
+	/* If there's no device there's nothing to do */
+	if (!ccp)
+		return 0;
+
 	spin_lock_irqsave(&ccp->cmd_lock, flags);
 
 	ccp->suspending = 0;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/dma/ste_dma40.c linux-libre-4.14.142-gnu/drivers/dma/ste_dma40.c
--- linux-libre-4.14.141-gnu/drivers/dma/ste_dma40.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/dma/ste_dma40.c	2019-09-06 04:21:01.000000000 -0400
@@ -142,7 +142,7 @@ enum d40_events {
  * when the DMA hw is powered off.
  * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works.
  */
-static u32 d40_backup_regs[] = {
+static __maybe_unused u32 d40_backup_regs[] = {
 	D40_DREG_LCPA,
 	D40_DREG_LCLA,
 	D40_DREG_PRMSE,
@@ -211,7 +211,7 @@ static u32 d40_backup_regs_v4b[] = {
 
 #define BACKUP_REGS_SZ_V4B ARRAY_SIZE(d40_backup_regs_v4b)
 
-static u32 d40_backup_regs_chan[] = {
+static __maybe_unused u32 d40_backup_regs_chan[] = {
 	D40_CHAN_REG_SSCFG,
 	D40_CHAN_REG_SSELT,
 	D40_CHAN_REG_SSPTR,
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/gpu/drm/ast/ast_main.c linux-libre-4.14.142-gnu/drivers/gpu/drm/ast/ast_main.c
--- linux-libre-4.14.141-gnu/drivers/gpu/drm/ast/ast_main.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/gpu/drm/ast/ast_main.c	2019-09-06 04:21:01.000000000 -0400
@@ -131,8 +131,8 @@ static int ast_detect_chip(struct drm_de
 
 
 	/* Enable extended register access */
-	ast_enable_mmio(dev);
 	ast_open_key(ast);
+	ast_enable_mmio(dev);
 
 	/* Find out whether P2A works or whether to use device-tree */
 	ast_detect_config_mode(dev, &scu_rev);
@@ -576,6 +576,9 @@ void ast_driver_unload(struct drm_device
 {
 	struct ast_private *ast = dev->dev_private;
 
+	/* enable standard VGA decode */
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
+
 	ast_release_firmware(dev);
 	kfree(ast->dp501_fw_addr);
 	ast_mode_fini(dev);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/gpu/drm/ast/ast_mode.c linux-libre-4.14.142-gnu/drivers/gpu/drm/ast/ast_mode.c
--- linux-libre-4.14.141-gnu/drivers/gpu/drm/ast/ast_mode.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/gpu/drm/ast/ast_mode.c	2019-09-06 04:21:01.000000000 -0400
@@ -600,7 +600,7 @@ static int ast_crtc_mode_set(struct drm_
 		return -EINVAL;
 	ast_open_key(ast);
 
-	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
 
 	ast_set_std_reg(crtc, adjusted_mode, &vbios_mode);
 	ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/gpu/drm/ast/ast_post.c linux-libre-4.14.142-gnu/drivers/gpu/drm/ast/ast_post.c
--- linux-libre-4.14.141-gnu/drivers/gpu/drm/ast/ast_post.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/gpu/drm/ast/ast_post.c	2019-09-06 04:21:01.000000000 -0400
@@ -46,7 +46,7 @@ void ast_enable_mmio(struct drm_device *
 {
 	struct ast_private *ast = dev->dev_private;
 
-	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
 }
 
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/gpu/drm/bridge/ti-tfp410.c linux-libre-4.14.142-gnu/drivers/gpu/drm/bridge/ti-tfp410.c
--- linux-libre-4.14.141-gnu/drivers/gpu/drm/bridge/ti-tfp410.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/gpu/drm/bridge/ti-tfp410.c	2019-09-06 04:21:01.000000000 -0400
@@ -64,7 +64,12 @@ static int tfp410_get_modes(struct drm_c
 
 	drm_mode_connector_update_edid_property(connector, edid);
 
-	return drm_add_edid_modes(connector, edid);
+	ret = drm_add_edid_modes(connector, edid);
+
+	kfree(edid);
+
+	return ret;
+
 fallback:
 	/* No EDID, fallback on the XGA standard modes */
 	ret = drm_add_modes_noedid(connector, 1920, 1200);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/gpu/drm/i915/i915_vgpu.c linux-libre-4.14.142-gnu/drivers/gpu/drm/i915/i915_vgpu.c
--- linux-libre-4.14.141-gnu/drivers/gpu/drm/i915/i915_vgpu.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/gpu/drm/i915/i915_vgpu.c	2019-09-06 04:21:01.000000000 -0400
@@ -100,6 +100,9 @@ static struct _balloon_info_ bl_info;
 static void vgt_deballoon_space(struct i915_ggtt *ggtt,
 				struct drm_mm_node *node)
 {
+	if (!drm_mm_node_allocated(node))
+		return;
+
 	DRM_DEBUG_DRIVER("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n",
 			 node->start,
 			 node->start + node->size,
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/gpu/drm/tilcdc/tilcdc_drv.c linux-libre-4.14.142-gnu/drivers/gpu/drm/tilcdc/tilcdc_drv.c
--- linux-libre-4.14.141-gnu/drivers/gpu/drm/tilcdc/tilcdc_drv.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/gpu/drm/tilcdc/tilcdc_drv.c	2019-09-06 04:21:01.000000000 -0400
@@ -189,6 +189,12 @@ static void tilcdc_fini(struct drm_devic
 {
 	struct tilcdc_drm_private *priv = dev->dev_private;
 
+#ifdef CONFIG_CPU_FREQ
+	if (priv->freq_transition.notifier_call)
+		cpufreq_unregister_notifier(&priv->freq_transition,
+					    CPUFREQ_TRANSITION_NOTIFIER);
+#endif
+
 	if (priv->crtc)
 		tilcdc_crtc_shutdown(priv->crtc);
 
@@ -204,12 +210,6 @@ static void tilcdc_fini(struct drm_devic
 	drm_mode_config_cleanup(dev);
 	tilcdc_remove_external_device(dev);
 
-#ifdef CONFIG_CPU_FREQ
-	if (priv->freq_transition.notifier_call)
-		cpufreq_unregister_notifier(&priv->freq_transition,
-					    CPUFREQ_TRANSITION_NOTIFIER);
-#endif
-
 	if (priv->clk)
 		clk_put(priv->clk);
 
@@ -282,17 +282,6 @@ static int tilcdc_init(struct drm_driver
 		goto init_failed;
 	}
 
-#ifdef CONFIG_CPU_FREQ
-	priv->freq_transition.notifier_call = cpufreq_transition;
-	ret = cpufreq_register_notifier(&priv->freq_transition,
-			CPUFREQ_TRANSITION_NOTIFIER);
-	if (ret) {
-		dev_err(dev, "failed to register cpufreq notifier\n");
-		priv->freq_transition.notifier_call = NULL;
-		goto init_failed;
-	}
-#endif
-
 	if (of_property_read_u32(node, "max-bandwidth", &priv->max_bandwidth))
 		priv->max_bandwidth = TILCDC_DEFAULT_MAX_BANDWIDTH;
 
@@ -369,6 +358,17 @@ static int tilcdc_init(struct drm_driver
 	}
 	modeset_init(ddev);
 
+#ifdef CONFIG_CPU_FREQ
+	priv->freq_transition.notifier_call = cpufreq_transition;
+	ret = cpufreq_register_notifier(&priv->freq_transition,
+			CPUFREQ_TRANSITION_NOTIFIER);
+	if (ret) {
+		dev_err(dev, "failed to register cpufreq notifier\n");
+		priv->freq_transition.notifier_call = NULL;
+		goto init_failed;
+	}
+#endif
+
 	if (priv->is_componentized) {
 		ret = component_bind_all(dev, ddev);
 		if (ret < 0)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/hwtracing/intel_th/pci.c linux-libre-4.14.142-gnu/drivers/hwtracing/intel_th/pci.c
--- linux-libre-4.14.141-gnu/drivers/hwtracing/intel_th/pci.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/hwtracing/intel_th/pci.c	2019-09-06 04:21:01.000000000 -0400
@@ -149,6 +149,11 @@ static const struct pci_device_id intel_
 		.driver_data = (kernel_ulong_t)0,
 	},
 	{
+		/* Lewisburg PCH */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa226),
+		.driver_data = (kernel_ulong_t)0,
+	},
+	{
 		/* Gemini Lake */
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
 		.driver_data = (kernel_ulong_t)&intel_th_2x,
@@ -183,6 +188,11 @@ static const struct pci_device_id intel_
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5),
 		.driver_data = (kernel_ulong_t)&intel_th_2x,
 	},
+	{
+		/* Tiger Lake PCH */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),
+		.driver_data = (kernel_ulong_t)&intel_th_2x,
+	},
 	{ 0 },
 };
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/hwtracing/stm/core.c linux-libre-4.14.142-gnu/drivers/hwtracing/stm/core.c
--- linux-libre-4.14.141-gnu/drivers/hwtracing/stm/core.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/hwtracing/stm/core.c	2019-09-06 04:21:01.000000000 -0400
@@ -1107,7 +1107,6 @@ int stm_source_register_device(struct de
 
 err:
 	put_device(&src->dev);
-	kfree(src);
 
 	return err;
 }
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/i2c/busses/i2c-emev2.c linux-libre-4.14.142-gnu/drivers/i2c/busses/i2c-emev2.c
--- linux-libre-4.14.141-gnu/drivers/i2c/busses/i2c-emev2.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/i2c/busses/i2c-emev2.c	2019-09-06 04:21:01.000000000 -0400
@@ -72,6 +72,7 @@ struct em_i2c_device {
 	struct completion msg_done;
 	struct clk *sclk;
 	struct i2c_client *slave;
+	int irq;
 };
 
 static inline void em_clear_set_bit(struct em_i2c_device *priv, u8 clear, u8 set, u8 reg)
@@ -342,6 +343,12 @@ static int em_i2c_unreg_slave(struct i2c
 
 	writeb(0, priv->base + I2C_OFS_SVA0);
 
+	/*
+	 * Wait for interrupt to finish. New slave irqs cannot happen because we
+	 * cleared the slave address and, thus, only extension codes will be
+	 * detected which do not use the slave ptr.
+	 */
+	synchronize_irq(priv->irq);
 	priv->slave = NULL;
 
 	return 0;
@@ -358,7 +365,7 @@ static int em_i2c_probe(struct platform_
 {
 	struct em_i2c_device *priv;
 	struct resource *r;
-	int irq, ret;
+	int ret;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -393,8 +400,8 @@ static int em_i2c_probe(struct platform_
 
 	em_i2c_reset(&priv->adap);
 
-	irq = platform_get_irq(pdev, 0);
-	ret = devm_request_irq(&pdev->dev, irq, em_i2c_irq_handler, 0,
+	priv->irq = platform_get_irq(pdev, 0);
+	ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0,
 				"em_i2c", priv);
 	if (ret)
 		goto err_clk;
@@ -404,7 +411,8 @@ static int em_i2c_probe(struct platform_
 	if (ret)
 		goto err_clk;
 
-	dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, irq);
+	dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr,
+		 priv->irq);
 
 	return 0;
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/i2c/busses/i2c-piix4.c linux-libre-4.14.142-gnu/drivers/i2c/busses/i2c-piix4.c
--- linux-libre-4.14.141-gnu/drivers/i2c/busses/i2c-piix4.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/i2c/busses/i2c-piix4.c	2019-09-06 04:21:01.000000000 -0400
@@ -99,7 +99,7 @@
 #define SB800_PIIX4_PORT_IDX_MASK	0x06
 #define SB800_PIIX4_PORT_IDX_SHIFT	1
 
-/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
+/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
 #define SB800_PIIX4_PORT_IDX_KERNCZ		0x02
 #define SB800_PIIX4_PORT_IDX_MASK_KERNCZ	0x18
 #define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ	3
@@ -359,18 +359,16 @@ static int piix4_setup_sb800(struct pci_
 
 	/* Find which register is used for port selection */
 	if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD) {
-		switch (PIIX4_dev->device) {
-		case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS:
+		if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS ||
+		    (PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
+		     PIIX4_dev->revision >= 0x1F)) {
 			piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
 			piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ;
 			piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ;
-			break;
-		case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS:
-		default:
+		} else {
 			piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT;
 			piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK;
 			piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT;
-			break;
 		}
 	} else {
 		mutex_lock(&piix4_mutex_sb800);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/i2c/busses/i2c-rcar.c linux-libre-4.14.142-gnu/drivers/i2c/busses/i2c-rcar.c
--- linux-libre-4.14.141-gnu/drivers/i2c/busses/i2c-rcar.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/i2c/busses/i2c-rcar.c	2019-09-06 04:21:01.000000000 -0400
@@ -144,6 +144,7 @@ struct rcar_i2c_priv {
 	enum dma_data_direction dma_direction;
 
 	struct reset_control *rstc;
+	int irq;
 };
 
 #define rcar_i2c_priv_to_dev(p)		((p)->adap.dev.parent)
@@ -813,9 +814,11 @@ static int rcar_unreg_slave(struct i2c_c
 
 	WARN_ON(!priv->slave);
 
+	/* disable irqs and ensure none is running before clearing ptr */
 	rcar_i2c_write(priv, ICSIER, 0);
 	rcar_i2c_write(priv, ICSCR, 0);
 
+	synchronize_irq(priv->irq);
 	priv->slave = NULL;
 
 	pm_runtime_put(rcar_i2c_priv_to_dev(priv));
@@ -866,7 +869,7 @@ static int rcar_i2c_probe(struct platfor
 	struct i2c_adapter *adap;
 	struct device *dev = &pdev->dev;
 	struct i2c_timings i2c_t;
-	int irq, ret;
+	int ret;
 
 	priv = devm_kzalloc(dev, sizeof(struct rcar_i2c_priv), GFP_KERNEL);
 	if (!priv)
@@ -927,10 +930,10 @@ static int rcar_i2c_probe(struct platfor
 		pm_runtime_put(dev);
 
 
-	irq = platform_get_irq(pdev, 0);
-	ret = devm_request_irq(dev, irq, rcar_i2c_irq, 0, dev_name(dev), priv);
+	priv->irq = platform_get_irq(pdev, 0);
+	ret = devm_request_irq(dev, priv->irq, rcar_i2c_irq, 0, dev_name(dev), priv);
 	if (ret < 0) {
-		dev_err(dev, "cannot get irq %d\n", irq);
+		dev_err(dev, "cannot get irq %d\n", priv->irq);
 		goto out_pm_disable;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/iommu/dma-iommu.c linux-libre-4.14.142-gnu/drivers/iommu/dma-iommu.c
--- linux-libre-4.14.141-gnu/drivers/iommu/dma-iommu.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/iommu/dma-iommu.c	2019-09-06 04:21:01.000000000 -0400
@@ -684,7 +684,7 @@ static int __finalise_sg(struct device *
 		 * - and wouldn't make the resulting output segment too long
 		 */
 		if (cur_len && !s_iova_off && (dma_addr & seg_mask) &&
-		    (cur_len + s_length <= max_len)) {
+		    (max_len - cur_len >= s_length)) {
 			/* ...then concatenate it with the previous one */
 			cur_len += s_length;
 		} else {
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/misc/vmw_vmci/vmci_doorbell.c linux-libre-4.14.142-gnu/drivers/misc/vmw_vmci/vmci_doorbell.c
--- linux-libre-4.14.141-gnu/drivers/misc/vmw_vmci/vmci_doorbell.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/misc/vmw_vmci/vmci_doorbell.c	2019-09-06 04:21:01.000000000 -0400
@@ -318,7 +318,8 @@ int vmci_dbell_host_context_notify(u32 s
 
 	entry = container_of(resource, struct dbell_entry, resource);
 	if (entry->run_delayed) {
-		schedule_work(&entry->work);
+		if (!schedule_work(&entry->work))
+			vmci_resource_put(resource);
 	} else {
 		entry->notify_cb(entry->client_data);
 		vmci_resource_put(resource);
@@ -366,7 +367,8 @@ static void dbell_fire_entries(u32 notif
 		    atomic_read(&dbell->active) == 1) {
 			if (dbell->run_delayed) {
 				vmci_resource_get(&dbell->resource);
-				schedule_work(&dbell->work);
+				if (!schedule_work(&dbell->work))
+					vmci_resource_put(&dbell->resource);
 			} else {
 				dbell->notify_cb(dbell->client_data);
 			}
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/mmc/core/sd.c linux-libre-4.14.142-gnu/drivers/mmc/core/sd.c
--- linux-libre-4.14.141-gnu/drivers/mmc/core/sd.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/mmc/core/sd.c	2019-09-06 04:21:01.000000000 -0400
@@ -1232,6 +1232,12 @@ int mmc_attach_sd(struct mmc_host *host)
 			goto err;
 	}
 
+	/*
+	 * Some SD cards claims an out of spec VDD voltage range. Let's treat
+	 * these bits as being in-valid and especially also bit7.
+	 */
+	ocr &= ~0x7FFF;
+
 	rocr = mmc_select_voltage(host, ocr);
 
 	/*
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/mmc/host/sdhci-of-at91.c linux-libre-4.14.142-gnu/drivers/mmc/host/sdhci-of-at91.c
--- linux-libre-4.14.141-gnu/drivers/mmc/host/sdhci-of-at91.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/mmc/host/sdhci-of-at91.c	2019-09-06 04:21:01.000000000 -0400
@@ -364,6 +364,9 @@ static int sdhci_at91_probe(struct platf
 	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
 	pm_runtime_use_autosuspend(&pdev->dev);
 
+	/* HS200 is broken at this moment */
+	host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200;
+
 	ret = sdhci_add_host(host);
 	if (ret)
 		goto pm_runtime_disable;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/scsi/ufs/unipro.h linux-libre-4.14.142-gnu/drivers/scsi/ufs/unipro.h
--- linux-libre-4.14.141-gnu/drivers/scsi/ufs/unipro.h	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/scsi/ufs/unipro.h	2019-09-06 04:21:01.000000000 -0400
@@ -52,7 +52,7 @@
 #define RX_HS_UNTERMINATED_ENABLE		0x00A6
 #define RX_ENTER_HIBERN8			0x00A7
 #define RX_BYPASS_8B10B_ENABLE			0x00A8
-#define RX_TERMINATION_FORCE_ENABLE		0x0089
+#define RX_TERMINATION_FORCE_ENABLE		0x00A9
 #define RX_MIN_ACTIVATETIME_CAPABILITY		0x008F
 #define RX_HIBERN8TIME_CAPABILITY		0x0092
 #define RX_REFCLKFREQ				0x00EB
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/chipidea/udc.c linux-libre-4.14.142-gnu/drivers/usb/chipidea/udc.c
--- linux-libre-4.14.141-gnu/drivers/usb/chipidea/udc.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/chipidea/udc.c	2019-09-06 04:21:01.000000000 -0400
@@ -711,12 +711,6 @@ static int _gadget_stop_activity(struct
 	struct ci_hdrc    *ci = container_of(gadget, struct ci_hdrc, gadget);
 	unsigned long flags;
 
-	spin_lock_irqsave(&ci->lock, flags);
-	ci->gadget.speed = USB_SPEED_UNKNOWN;
-	ci->remote_wakeup = 0;
-	ci->suspended = 0;
-	spin_unlock_irqrestore(&ci->lock, flags);
-
 	/* flush all endpoints */
 	gadget_for_each_ep(ep, gadget) {
 		usb_ep_fifo_flush(ep);
@@ -734,6 +728,12 @@ static int _gadget_stop_activity(struct
 		ci->status = NULL;
 	}
 
+	spin_lock_irqsave(&ci->lock, flags);
+	ci->gadget.speed = USB_SPEED_UNKNOWN;
+	ci->remote_wakeup = 0;
+	ci->suspended = 0;
+	spin_unlock_irqrestore(&ci->lock, flags);
+
 	return 0;
 }
 
@@ -1305,6 +1305,10 @@ static int ep_disable(struct usb_ep *ep)
 		return -EBUSY;
 
 	spin_lock_irqsave(hwep->lock, flags);
+	if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
+		spin_unlock_irqrestore(hwep->lock, flags);
+		return 0;
+	}
 
 	/* only internal SW should disable ctrl endpts */
 
@@ -1394,6 +1398,10 @@ static int ep_queue(struct usb_ep *ep, s
 		return -EINVAL;
 
 	spin_lock_irqsave(hwep->lock, flags);
+	if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
+		spin_unlock_irqrestore(hwep->lock, flags);
+		return 0;
+	}
 	retval = _ep_queue(ep, req, gfp_flags);
 	spin_unlock_irqrestore(hwep->lock, flags);
 	return retval;
@@ -1417,8 +1425,8 @@ static int ep_dequeue(struct usb_ep *ep,
 		return -EINVAL;
 
 	spin_lock_irqsave(hwep->lock, flags);
-
-	hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
+	if (hwep->ci->gadget.speed != USB_SPEED_UNKNOWN)
+		hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
 
 	list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) {
 		dma_pool_free(hwep->td_pool, node->ptr, node->dma);
@@ -1489,6 +1497,10 @@ static void ep_fifo_flush(struct usb_ep
 	}
 
 	spin_lock_irqsave(hwep->lock, flags);
+	if (hwep->ci->gadget.speed == USB_SPEED_UNKNOWN) {
+		spin_unlock_irqrestore(hwep->lock, flags);
+		return;
+	}
 
 	hw_ep_flush(hwep->ci, hwep->num, hwep->dir);
 
@@ -1557,6 +1569,10 @@ static int ci_udc_wakeup(struct usb_gadg
 	int ret = 0;
 
 	spin_lock_irqsave(&ci->lock, flags);
+	if (ci->gadget.speed == USB_SPEED_UNKNOWN) {
+		spin_unlock_irqrestore(&ci->lock, flags);
+		return 0;
+	}
 	if (!ci->remote_wakeup) {
 		ret = -EOPNOTSUPP;
 		goto out;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/class/cdc-wdm.c linux-libre-4.14.142-gnu/drivers/usb/class/cdc-wdm.c
--- linux-libre-4.14.141-gnu/drivers/usb/class/cdc-wdm.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/class/cdc-wdm.c	2019-09-06 04:21:01.000000000 -0400
@@ -584,10 +584,20 @@ static int wdm_flush(struct file *file,
 {
 	struct wdm_device *desc = file->private_data;
 
-	wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
+	wait_event(desc->wait,
+			/*
+			 * needs both flags. We cannot do with one
+			 * because resetting it would cause a race
+			 * with write() yet we need to signal
+			 * a disconnect
+			 */
+			!test_bit(WDM_IN_USE, &desc->flags) ||
+			test_bit(WDM_DISCONNECTING, &desc->flags));
 
 	/* cannot dereference desc->intf if WDM_DISCONNECTING */
-	if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags))
+	if (test_bit(WDM_DISCONNECTING, &desc->flags))
+		return -ENODEV;
+	if (desc->werr < 0)
 		dev_err(&desc->intf->dev, "Error in flush path: %d\n",
 			desc->werr);
 
@@ -955,8 +965,6 @@ static void wdm_disconnect(struct usb_in
 	spin_lock_irqsave(&desc->iuspin, flags);
 	set_bit(WDM_DISCONNECTING, &desc->flags);
 	set_bit(WDM_READ, &desc->flags);
-	/* to terminate pending flushes */
-	clear_bit(WDM_IN_USE, &desc->flags);
 	spin_unlock_irqrestore(&desc->iuspin, flags);
 	wake_up_all(&desc->wait);
 	mutex_lock(&desc->rlock);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/gadget/composite.c linux-libre-4.14.142-gnu/drivers/usb/gadget/composite.c
--- linux-libre-4.14.141-gnu/drivers/usb/gadget/composite.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/gadget/composite.c	2019-09-06 04:21:01.000000000 -0400
@@ -2008,6 +2008,7 @@ void composite_disconnect(struct usb_gad
 	 * disconnect callbacks?
 	 */
 	spin_lock_irqsave(&cdev->lock, flags);
+	cdev->suspended = 0;
 	if (cdev->config)
 		reset_config(cdev);
 	if (cdev->driver->disconnect)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/gadget/function/f_mass_storage.c linux-libre-4.14.142-gnu/drivers/usb/gadget/function/f_mass_storage.c
--- linux-libre-4.14.141-gnu/drivers/usb/gadget/function/f_mass_storage.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/gadget/function/f_mass_storage.c	2019-09-06 04:21:01.000000000 -0400
@@ -261,7 +261,7 @@ struct fsg_common;
 struct fsg_common {
 	struct usb_gadget	*gadget;
 	struct usb_composite_dev *cdev;
-	struct fsg_dev		*fsg, *new_fsg;
+	struct fsg_dev		*fsg;
 	wait_queue_head_t	io_wait;
 	wait_queue_head_t	fsg_wait;
 
@@ -290,6 +290,7 @@ struct fsg_common {
 	unsigned int		bulk_out_maxpacket;
 	enum fsg_state		state;		/* For exception handling */
 	unsigned int		exception_req_tag;
+	void			*exception_arg;
 
 	enum data_direction	data_dir;
 	u32			data_size;
@@ -393,7 +394,8 @@ static int fsg_set_halt(struct fsg_dev *
 
 /* These routines may be called in process context or in_irq */
 
-static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
+static void __raise_exception(struct fsg_common *common, enum fsg_state new_state,
+			      void *arg)
 {
 	unsigned long		flags;
 
@@ -406,6 +408,7 @@ static void raise_exception(struct fsg_c
 	if (common->state <= new_state) {
 		common->exception_req_tag = common->ep0_req_tag;
 		common->state = new_state;
+		common->exception_arg = arg;
 		if (common->thread_task)
 			send_sig_info(SIGUSR1, SEND_SIG_FORCED,
 				      common->thread_task);
@@ -413,6 +416,10 @@ static void raise_exception(struct fsg_c
 	spin_unlock_irqrestore(&common->lock, flags);
 }
 
+static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
+{
+	__raise_exception(common, new_state, NULL);
+}
 
 /*-------------------------------------------------------------------------*/
 
@@ -2287,16 +2294,16 @@ reset:
 static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 {
 	struct fsg_dev *fsg = fsg_from_func(f);
-	fsg->common->new_fsg = fsg;
-	raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
+
+	__raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, fsg);
 	return USB_GADGET_DELAYED_STATUS;
 }
 
 static void fsg_disable(struct usb_function *f)
 {
 	struct fsg_dev *fsg = fsg_from_func(f);
-	fsg->common->new_fsg = NULL;
-	raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
+
+	__raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
 }
 
 
@@ -2309,6 +2316,7 @@ static void handle_exception(struct fsg_
 	enum fsg_state		old_state;
 	struct fsg_lun		*curlun;
 	unsigned int		exception_req_tag;
+	struct fsg_dev		*new_fsg;
 
 	/*
 	 * Clear the existing signals.  Anything but SIGUSR1 is converted
@@ -2362,6 +2370,7 @@ static void handle_exception(struct fsg_
 	common->next_buffhd_to_fill = &common->buffhds[0];
 	common->next_buffhd_to_drain = &common->buffhds[0];
 	exception_req_tag = common->exception_req_tag;
+	new_fsg = common->exception_arg;
 	old_state = common->state;
 	common->state = FSG_STATE_NORMAL;
 
@@ -2415,8 +2424,8 @@ static void handle_exception(struct fsg_
 		break;
 
 	case FSG_STATE_CONFIG_CHANGE:
-		do_set_interface(common, common->new_fsg);
-		if (common->new_fsg)
+		do_set_interface(common, new_fsg);
+		if (new_fsg)
 			usb_composite_setup_continue(common->cdev);
 		break;
 
@@ -3007,8 +3016,7 @@ static void fsg_unbind(struct usb_config
 
 	DBG(fsg, "unbind\n");
 	if (fsg->common->fsg == fsg) {
-		fsg->common->new_fsg = NULL;
-		raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
+		__raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
 		/* FIXME: make interruptible or killable somehow? */
 		wait_event(common->fsg_wait, common->fsg != fsg);
 	}
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/host/fotg210-hcd.c linux-libre-4.14.142-gnu/drivers/usb/host/fotg210-hcd.c
--- linux-libre-4.14.141-gnu/drivers/usb/host/fotg210-hcd.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/host/fotg210-hcd.c	2019-09-06 04:21:01.000000000 -0400
@@ -1652,6 +1652,10 @@ static int fotg210_hub_control(struct us
 			/* see what we found out */
 			temp = check_reset_complete(fotg210, wIndex, status_reg,
 					fotg210_readl(fotg210, status_reg));
+
+			/* restart schedule */
+			fotg210->command |= CMD_RUN;
+			fotg210_writel(fotg210, fotg210->command, &fotg210->regs->command);
 		}
 
 		if (!(temp & (PORT_RESUME|PORT_RESET))) {
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/host/ohci-hcd.c linux-libre-4.14.142-gnu/drivers/usb/host/ohci-hcd.c
--- linux-libre-4.14.141-gnu/drivers/usb/host/ohci-hcd.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/host/ohci-hcd.c	2019-09-06 04:21:01.000000000 -0400
@@ -417,8 +417,7 @@ static void ohci_usb_reset (struct ohci_
  * other cases where the next software may expect clean state from the
  * "firmware".  this is bus-neutral, unlike shutdown() methods.
  */
-static void
-ohci_shutdown (struct usb_hcd *hcd)
+static void _ohci_shutdown(struct usb_hcd *hcd)
 {
 	struct ohci_hcd *ohci;
 
@@ -434,6 +433,16 @@ ohci_shutdown (struct usb_hcd *hcd)
 	ohci->rh_state = OHCI_RH_HALTED;
 }
 
+static void ohci_shutdown(struct usb_hcd *hcd)
+{
+	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	unsigned long flags;
+
+	spin_lock_irqsave(&ohci->lock, flags);
+	_ohci_shutdown(hcd);
+	spin_unlock_irqrestore(&ohci->lock, flags);
+}
+
 /*-------------------------------------------------------------------------*
  * HC functions
  *-------------------------------------------------------------------------*/
@@ -752,7 +761,7 @@ static void io_watchdog_func(unsigned lo
  died:
 			usb_hc_died(ohci_to_hcd(ohci));
 			ohci_dump(ohci);
-			ohci_shutdown(ohci_to_hcd(ohci));
+			_ohci_shutdown(ohci_to_hcd(ohci));
 			goto done;
 		} else {
 			/* No write back because the done queue was empty */
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/host/xhci-rcar.c linux-libre-4.14.142-gnu/drivers/usb/host/xhci-rcar.c
--- linux-libre-4.14.141-gnu/drivers/usb/host/xhci-rcar.c	2019-08-29 17:31:25.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/host/xhci-rcar.c	2019-09-06 07:24:24.000000000 -0400
@@ -111,7 +111,7 @@ static int xhci_rcar_is_gen2(struct devi
 	return of_device_is_compatible(node, "renesas,xhci-r8a7790") ||
 		of_device_is_compatible(node, "renesas,xhci-r8a7791") ||
 		of_device_is_compatible(node, "renesas,xhci-r8a7793") ||
-		of_device_is_compatible(node, "renensas,rcar-gen2-xhci");
+		of_device_is_compatible(node, "renesas,rcar-gen2-xhci");
 }
 
 static int xhci_rcar_is_gen3(struct device *dev)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/storage/realtek_cr.c linux-libre-4.14.142-gnu/drivers/usb/storage/realtek_cr.c
--- linux-libre-4.14.141-gnu/drivers/usb/storage/realtek_cr.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/storage/realtek_cr.c	2019-09-06 04:21:01.000000000 -0400
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
 
 static int auto_delink_en = 1;
 module_param(auto_delink_en, int, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(auto_delink_en, "enable auto delink");
+MODULE_PARM_DESC(auto_delink_en, "auto delink mode (0=firmware, 1=software [default])");
 
 #ifdef CONFIG_REALTEK_AUTOPM
 static int ss_en = 1;
@@ -1009,12 +1009,15 @@ static int init_realtek_cr(struct us_dat
 			goto INIT_FAIL;
 	}
 
-	if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) ||
-	    CHECK_FW_VER(chip, 0x5901))
-		SET_AUTO_DELINK(chip);
-	if (STATUS_LEN(chip) == 16) {
-		if (SUPPORT_AUTO_DELINK(chip))
+	if (CHECK_PID(chip, 0x0138) || CHECK_PID(chip, 0x0158) ||
+	    CHECK_PID(chip, 0x0159)) {
+		if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) ||
+				CHECK_FW_VER(chip, 0x5901))
 			SET_AUTO_DELINK(chip);
+		if (STATUS_LEN(chip) == 16) {
+			if (SUPPORT_AUTO_DELINK(chip))
+				SET_AUTO_DELINK(chip);
+		}
 	}
 #ifdef CONFIG_REALTEK_AUTOPM
 	if (ss_en)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/usb/storage/unusual_devs.h linux-libre-4.14.142-gnu/drivers/usb/storage/unusual_devs.h
--- linux-libre-4.14.141-gnu/drivers/usb/storage/unusual_devs.h	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/usb/storage/unusual_devs.h	2019-09-06 04:21:01.000000000 -0400
@@ -2119,7 +2119,7 @@ UNUSUAL_DEV(  0x14cd, 0x6600, 0x0201, 0x
 		US_FL_IGNORE_RESIDUE ),
 
 /* Reported by Michael Büsch <m@bues.ch> */
-UNUSUAL_DEV(  0x152d, 0x0567, 0x0114, 0x0116,
+UNUSUAL_DEV(  0x152d, 0x0567, 0x0114, 0x0117,
 		"JMicron",
 		"USB to ATA/ATAPI Bridge",
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
diff -druNp --no-dereference linux-libre-4.14.141-gnu/drivers/watchdog/bcm2835_wdt.c linux-libre-4.14.142-gnu/drivers/watchdog/bcm2835_wdt.c
--- linux-libre-4.14.141-gnu/drivers/watchdog/bcm2835_wdt.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/drivers/watchdog/bcm2835_wdt.c	2019-09-06 04:21:01.000000000 -0400
@@ -252,6 +252,7 @@ module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
+MODULE_ALIAS("platform:bcm2835-wdt");
 MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>");
 MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer");
 MODULE_LICENSE("GPL");
diff -druNp --no-dereference linux-libre-4.14.141-gnu/fs/nfs/direct.c linux-libre-4.14.142-gnu/fs/nfs/direct.c
--- linux-libre-4.14.141-gnu/fs/nfs/direct.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/fs/nfs/direct.c	2019-09-06 04:21:01.000000000 -0400
@@ -400,15 +400,21 @@ static void nfs_direct_read_completion(s
 	unsigned long bytes = 0;
 	struct nfs_direct_req *dreq = hdr->dreq;
 
-	if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
-		goto out_put;
-
 	spin_lock(&dreq->lock);
-	if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && (hdr->good_bytes == 0))
+	if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
 		dreq->error = hdr->error;
-	else
+
+	if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) {
+		spin_unlock(&dreq->lock);
+		goto out_put;
+	}
+
+	if (hdr->good_bytes != 0)
 		nfs_direct_good_bytes(dreq, hdr);
 
+	if (test_bit(NFS_IOHDR_EOF, &hdr->flags))
+		dreq->error = 0;
+
 	spin_unlock(&dreq->lock);
 
 	while (!list_empty(&hdr->pages)) {
@@ -428,7 +434,7 @@ out_put:
 	hdr->release(hdr);
 }
 
-static void nfs_read_sync_pgio_error(struct list_head *head)
+static void nfs_read_sync_pgio_error(struct list_head *head, int error)
 {
 	struct nfs_page *req;
 
@@ -664,8 +670,7 @@ static void nfs_direct_write_reschedule(
 
 	list_for_each_entry_safe(req, tmp, &reqs, wb_list) {
 		if (!nfs_pageio_add_request(&desc, req)) {
-			nfs_list_remove_request(req);
-			nfs_list_add_request(req, &failed);
+			nfs_list_move_request(req, &failed);
 			spin_lock(&cinfo.inode->i_lock);
 			dreq->flags = 0;
 			if (desc.pg_error < 0)
@@ -775,16 +780,19 @@ static void nfs_direct_write_completion(
 	bool request_commit = false;
 	struct nfs_page *req = nfs_list_entry(hdr->pages.next);
 
-	if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
-		goto out_put;
-
 	nfs_init_cinfo_from_dreq(&cinfo, dreq);
 
 	spin_lock(&dreq->lock);
 
 	if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
 		dreq->error = hdr->error;
-	if (dreq->error == 0) {
+
+	if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) {
+		spin_unlock(&dreq->lock);
+		goto out_put;
+	}
+
+	if (hdr->good_bytes != 0) {
 		nfs_direct_good_bytes(dreq, hdr);
 		if (nfs_write_need_commit(hdr)) {
 			if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
@@ -821,7 +829,7 @@ out_put:
 	hdr->release(hdr);
 }
 
-static void nfs_write_sync_pgio_error(struct list_head *head)
+static void nfs_write_sync_pgio_error(struct list_head *head, int error)
 {
 	struct nfs_page *req;
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/fs/nfs/pagelist.c linux-libre-4.14.142-gnu/fs/nfs/pagelist.c
--- linux-libre-4.14.141-gnu/fs/nfs/pagelist.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/fs/nfs/pagelist.c	2019-09-06 04:21:01.000000000 -0400
@@ -768,8 +768,7 @@ int nfs_generic_pgio(struct nfs_pageio_d
 	pageused = 0;
 	while (!list_empty(head)) {
 		req = nfs_list_entry(head->next);
-		nfs_list_remove_request(req);
-		nfs_list_add_request(req, &hdr->pages);
+		nfs_list_move_request(req, &hdr->pages);
 
 		if (!last_page || last_page != req->wb_page) {
 			pageused++;
@@ -961,8 +960,7 @@ static int nfs_pageio_do_add_request(str
 	}
 	if (!nfs_can_coalesce_requests(prev, req, desc))
 		return 0;
-	nfs_list_remove_request(req);
-	nfs_list_add_request(req, &mirror->pg_list);
+	nfs_list_move_request(req, &mirror->pg_list);
 	mirror->pg_count += req->wb_bytes;
 	return 1;
 }
@@ -994,9 +992,8 @@ nfs_pageio_cleanup_request(struct nfs_pa
 {
 	LIST_HEAD(head);
 
-	nfs_list_remove_request(req);
-	nfs_list_add_request(req, &head);
-	desc->pg_completion_ops->error_cleanup(&head);
+	nfs_list_move_request(req, &head);
+	desc->pg_completion_ops->error_cleanup(&head, desc->pg_error);
 }
 
 /**
@@ -1132,7 +1129,8 @@ static void nfs_pageio_error_cleanup(str
 
 	for (midx = 0; midx < desc->pg_mirror_count; midx++) {
 		mirror = &desc->pg_mirrors[midx];
-		desc->pg_completion_ops->error_cleanup(&mirror->pg_list);
+		desc->pg_completion_ops->error_cleanup(&mirror->pg_list,
+				desc->pg_error);
 	}
 }
 
@@ -1234,21 +1232,23 @@ static void nfs_pageio_complete_mirror(s
 int nfs_pageio_resend(struct nfs_pageio_descriptor *desc,
 		      struct nfs_pgio_header *hdr)
 {
-	LIST_HEAD(failed);
+	LIST_HEAD(pages);
 
 	desc->pg_io_completion = hdr->io_completion;
 	desc->pg_dreq = hdr->dreq;
-	while (!list_empty(&hdr->pages)) {
-		struct nfs_page *req = nfs_list_entry(hdr->pages.next);
+	list_splice_init(&hdr->pages, &pages);
+	while (!list_empty(&pages)) {
+		struct nfs_page *req = nfs_list_entry(pages.next);
 
-		nfs_list_remove_request(req);
 		if (!nfs_pageio_add_request(desc, req))
-			nfs_list_add_request(req, &failed);
+			break;
 	}
 	nfs_pageio_complete(desc);
-	if (!list_empty(&failed)) {
-		list_move(&failed, &hdr->pages);
-		return desc->pg_error < 0 ? desc->pg_error : -EIO;
+	if (!list_empty(&pages)) {
+		int err = desc->pg_error < 0 ? desc->pg_error : -EIO;
+		hdr->completion_ops->error_cleanup(&pages, err);
+		nfs_set_pgio_error(hdr, err, hdr->io_start);
+		return err;
 	}
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.14.141-gnu/fs/nfs/read.c linux-libre-4.14.142-gnu/fs/nfs/read.c
--- linux-libre-4.14.141-gnu/fs/nfs/read.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/fs/nfs/read.c	2019-09-06 04:21:01.000000000 -0400
@@ -205,7 +205,7 @@ static void nfs_initiate_read(struct nfs
 }
 
 static void
-nfs_async_read_error(struct list_head *head)
+nfs_async_read_error(struct list_head *head, int error)
 {
 	struct nfs_page	*req;
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/fs/nfs/write.c linux-libre-4.14.142-gnu/fs/nfs/write.c
--- linux-libre-4.14.141-gnu/fs/nfs/write.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/fs/nfs/write.c	2019-09-06 04:21:01.000000000 -0400
@@ -1397,20 +1397,27 @@ static void nfs_redirty_request(struct n
 	nfs_release_request(req);
 }
 
-static void nfs_async_write_error(struct list_head *head)
+static void nfs_async_write_error(struct list_head *head, int error)
 {
 	struct nfs_page	*req;
 
 	while (!list_empty(head)) {
 		req = nfs_list_entry(head->next);
 		nfs_list_remove_request(req);
+		if (nfs_error_is_fatal(error)) {
+			nfs_context_set_write_error(req->wb_context, error);
+			if (nfs_error_is_fatal_on_server(error)) {
+				nfs_write_error_remove_page(req);
+				continue;
+			}
+		}
 		nfs_redirty_request(req);
 	}
 }
 
 static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr)
 {
-	nfs_async_write_error(&hdr->pages);
+	nfs_async_write_error(&hdr->pages, 0);
 }
 
 static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops = {
diff -druNp --no-dereference linux-libre-4.14.141-gnu/include/linux/nfs_page.h linux-libre-4.14.142-gnu/include/linux/nfs_page.h
--- linux-libre-4.14.141-gnu/include/linux/nfs_page.h	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/include/linux/nfs_page.h	2019-09-06 04:21:01.000000000 -0400
@@ -164,6 +164,16 @@ nfs_list_add_request(struct nfs_page *re
 	list_add_tail(&req->wb_list, head);
 }
 
+/**
+ * nfs_list_move_request - Move a request to a new list
+ * @req: request
+ * @head: head of list into which to insert the request.
+ */
+static inline void
+nfs_list_move_request(struct nfs_page *req, struct list_head *head)
+{
+	list_move_tail(&req->wb_list, head);
+}
 
 /**
  * nfs_list_remove_request - Remove a request from its wb_list
diff -druNp --no-dereference linux-libre-4.14.141-gnu/include/linux/nfs_xdr.h linux-libre-4.14.142-gnu/include/linux/nfs_xdr.h
--- linux-libre-4.14.141-gnu/include/linux/nfs_xdr.h	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/include/linux/nfs_xdr.h	2019-09-06 04:21:01.000000000 -0400
@@ -1520,7 +1520,7 @@ struct nfs_commit_data {
 };
 
 struct nfs_pgio_completion_ops {
-	void	(*error_cleanup)(struct list_head *head);
+	void	(*error_cleanup)(struct list_head *head, int);
 	void	(*init_hdr)(struct nfs_pgio_header *hdr);
 	void	(*completion)(struct nfs_pgio_header *hdr);
 	void	(*reschedule_io)(struct nfs_pgio_header *hdr);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/include/net/tcp.h linux-libre-4.14.142-gnu/include/net/tcp.h
--- linux-libre-4.14.141-gnu/include/net/tcp.h	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/include/net/tcp.h	2019-09-06 04:21:01.000000000 -0400
@@ -1702,6 +1702,10 @@ static inline struct sk_buff *tcp_rtx_qu
 {
 	struct sk_buff *skb = tcp_send_head(sk);
 
+	/* empty retransmit queue, for example due to zero window */
+	if (skb == tcp_write_queue_head(sk))
+		return NULL;
+
 	return skb ? tcp_write_queue_prev(sk, skb) : tcp_write_queue_tail(sk);
 }
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/kernel/trace/ftrace.c linux-libre-4.14.142-gnu/kernel/trace/ftrace.c
--- linux-libre-4.14.141-gnu/kernel/trace/ftrace.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/kernel/trace/ftrace.c	2019-09-06 04:21:01.000000000 -0400
@@ -3184,6 +3184,14 @@ t_probe_next(struct seq_file *m, loff_t
 		hnd = &iter->probe_entry->hlist;
 
 	hash = iter->probe->ops.func_hash->filter_hash;
+
+	/*
+	 * A probe being registered may temporarily have an empty hash
+	 * and it's at the end of the func_probes list.
+	 */
+	if (!hash || hash == EMPTY_HASH)
+		return NULL;
+
 	size = 1 << hash->size_bits;
 
  retry:
@@ -4380,12 +4388,21 @@ register_ftrace_function_probe(char *glo
 
 	mutex_unlock(&ftrace_lock);
 
+	/*
+	 * Note, there's a small window here that the func_hash->filter_hash
+	 * may be NULL or empty. Need to be carefule when reading the loop.
+	 */
 	mutex_lock(&probe->ops.func_hash->regex_lock);
 
 	orig_hash = &probe->ops.func_hash->filter_hash;
 	old_hash = *orig_hash;
 	hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash);
 
+	if (!hash) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
 	ret = ftrace_match_records(hash, glob, strlen(glob));
 
 	/* Nothing found? */
diff -druNp --no-dereference linux-libre-4.14.141-gnu/Makefile linux-libre-4.14.142-gnu/Makefile
--- linux-libre-4.14.141-gnu/Makefile	2019-08-29 17:01:07.000000000 -0400
+++ linux-libre-4.14.142-gnu/Makefile	2019-09-06 06:54:43.000000000 -0400
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 141
+SUBLEVEL = 142
 EXTRAVERSION = -gnu
 NAME = Petit Gorille
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/mm/zsmalloc.c linux-libre-4.14.142-gnu/mm/zsmalloc.c
--- linux-libre-4.14.141-gnu/mm/zsmalloc.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/mm/zsmalloc.c	2019-09-06 04:21:01.000000000 -0400
@@ -2431,7 +2431,9 @@ struct zs_pool *zs_create_pool(const cha
 	if (!pool->name)
 		goto err;
 
+#ifdef CONFIG_COMPACTION
 	init_waitqueue_head(&pool->migration_wait);
+#endif
 
 	if (create_cache(pool))
 		goto err;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/net/core/stream.c linux-libre-4.14.142-gnu/net/core/stream.c
--- linux-libre-4.14.141-gnu/net/core/stream.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/net/core/stream.c	2019-09-06 04:21:01.000000000 -0400
@@ -120,7 +120,6 @@ int sk_stream_wait_memory(struct sock *s
 	int err = 0;
 	long vm_wait = 0;
 	long current_timeo = *timeo_p;
-	bool noblock = (*timeo_p ? false : true);
 	DEFINE_WAIT_FUNC(wait, woken_wake_function);
 
 	if (sk_stream_memory_free(sk))
@@ -133,11 +132,8 @@ int sk_stream_wait_memory(struct sock *s
 
 		if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
 			goto do_error;
-		if (!*timeo_p) {
-			if (noblock)
-				set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
-			goto do_nonblock;
-		}
+		if (!*timeo_p)
+			goto do_eagain;
 		if (signal_pending(current))
 			goto do_interrupted;
 		sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
@@ -169,7 +165,13 @@ out:
 do_error:
 	err = -EPIPE;
 	goto out;
-do_nonblock:
+do_eagain:
+	/* Make sure that whenever EAGAIN is returned, EPOLLOUT event can
+	 * be generated later.
+	 * When TCP receives ACK packets that make room, tcp_check_space()
+	 * only calls tcp_new_space() if SOCK_NOSPACE is set.
+	 */
+	set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
 	err = -EAGAIN;
 	goto out;
 do_interrupted:
diff -druNp --no-dereference linux-libre-4.14.141-gnu/net/mac80211/cfg.c linux-libre-4.14.142-gnu/net/mac80211/cfg.c
--- linux-libre-4.14.141-gnu/net/mac80211/cfg.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/net/mac80211/cfg.c	2019-09-06 04:21:01.000000000 -0400
@@ -1459,6 +1459,11 @@ static int ieee80211_add_station(struct
 	if (is_multicast_ether_addr(mac))
 		return -EINVAL;
 
+	if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER) &&
+	    sdata->vif.type == NL80211_IFTYPE_STATION &&
+	    !sdata->u.mgd.associated)
+		return -EINVAL;
+
 	sta = sta_info_alloc(sdata, mac, GFP_KERNEL);
 	if (!sta)
 		return -ENOMEM;
@@ -1466,10 +1471,6 @@ static int ieee80211_add_station(struct
 	if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))
 		sta->sta.tdls = true;
 
-	if (sta->sta.tdls && sdata->vif.type == NL80211_IFTYPE_STATION &&
-	    !sdata->u.mgd.associated)
-		return -EINVAL;
-
 	err = sta_apply_parameters(local, sta, params);
 	if (err) {
 		sta_info_free(local, sta);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/net/smc/smc_tx.c linux-libre-4.14.142-gnu/net/smc/smc_tx.c
--- linux-libre-4.14.141-gnu/net/smc/smc_tx.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/net/smc/smc_tx.c	2019-09-06 04:21:01.000000000 -0400
@@ -70,13 +70,11 @@ static int smc_tx_wait_memory(struct smc
 	DEFINE_WAIT_FUNC(wait, woken_wake_function);
 	struct smc_connection *conn = &smc->conn;
 	struct sock *sk = &smc->sk;
-	bool noblock;
 	long timeo;
 	int rc = 0;
 
 	/* similar to sk_stream_wait_memory */
 	timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
-	noblock = timeo ? false : true;
 	add_wait_queue(sk_sleep(sk), &wait);
 	while (1) {
 		sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
@@ -91,8 +89,8 @@ static int smc_tx_wait_memory(struct smc
 			break;
 		}
 		if (!timeo) {
-			if (noblock)
-				set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
+			/* ensure EPOLLOUT is subsequently generated */
+			set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
 			rc = -EAGAIN;
 			break;
 		}
diff -druNp --no-dereference linux-libre-4.14.141-gnu/net/wireless/reg.c linux-libre-4.14.142-gnu/net/wireless/reg.c
--- linux-libre-4.14.141-gnu/net/wireless/reg.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/net/wireless/reg.c	2019-09-06 04:21:01.000000000 -0400
@@ -2252,7 +2252,7 @@ static void reg_process_pending_hints(vo
 
 	/* When last_request->processed becomes true this will be rescheduled */
 	if (lr && !lr->processed) {
-		reg_process_hint(lr);
+		pr_debug("Pending regulatory request, waiting for it to be processed...\n");
 		return;
 	}
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/sound/core/seq/seq_clientmgr.c linux-libre-4.14.142-gnu/sound/core/seq/seq_clientmgr.c
--- linux-libre-4.14.141-gnu/sound/core/seq/seq_clientmgr.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/sound/core/seq/seq_clientmgr.c	2019-09-06 04:21:01.000000000 -0400
@@ -1821,8 +1821,7 @@ static int snd_seq_ioctl_get_client_pool
 	if (cptr->type == USER_CLIENT) {
 		info->input_pool = cptr->data.user.fifo_pool_size;
 		info->input_free = info->input_pool;
-		if (cptr->data.user.fifo)
-			info->input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool);
+		info->input_free = snd_seq_fifo_unused_cells(cptr->data.user.fifo);
 	} else {
 		info->input_pool = 0;
 		info->input_free = 0;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/sound/core/seq/seq_fifo.c linux-libre-4.14.142-gnu/sound/core/seq/seq_fifo.c
--- linux-libre-4.14.141-gnu/sound/core/seq/seq_fifo.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/sound/core/seq/seq_fifo.c	2019-09-06 04:21:01.000000000 -0400
@@ -280,3 +280,20 @@ int snd_seq_fifo_resize(struct snd_seq_f
 
 	return 0;
 }
+
+/* get the number of unused cells safely */
+int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f)
+{
+	unsigned long flags;
+	int cells;
+
+	if (!f)
+		return 0;
+
+	snd_use_lock_use(&f->use_lock);
+	spin_lock_irqsave(&f->lock, flags);
+	cells = snd_seq_unused_cells(f->pool);
+	spin_unlock_irqrestore(&f->lock, flags);
+	snd_use_lock_free(&f->use_lock);
+	return cells;
+}
diff -druNp --no-dereference linux-libre-4.14.141-gnu/sound/core/seq/seq_fifo.h linux-libre-4.14.142-gnu/sound/core/seq/seq_fifo.h
--- linux-libre-4.14.141-gnu/sound/core/seq/seq_fifo.h	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/sound/core/seq/seq_fifo.h	2019-09-06 04:21:01.000000000 -0400
@@ -68,5 +68,7 @@ int snd_seq_fifo_poll_wait(struct snd_se
 /* resize pool in fifo */
 int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize);
 
+/* get the number of unused cells safely */
+int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f);
 
 #endif
diff -druNp --no-dereference linux-libre-4.14.141-gnu/sound/soc/soc-core.c linux-libre-4.14.142-gnu/sound/soc/soc-core.c
--- linux-libre-4.14.141-gnu/sound/soc/soc-core.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/sound/soc/soc-core.c	2019-09-06 04:21:01.000000000 -0400
@@ -1757,11 +1757,8 @@ static int soc_probe_link_dais(struct sn
 		}
 	}
 
-	if (dai_link->dai_fmt) {
-		ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
-		if (ret)
-			return ret;
-	}
+	if (dai_link->dai_fmt)
+		snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
 
 	ret = soc_post_component_init(rtd, dai_link->name);
 	if (ret)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/sound/usb/line6/pcm.c linux-libre-4.14.142-gnu/sound/usb/line6/pcm.c
--- linux-libre-4.14.141-gnu/sound/usb/line6/pcm.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/sound/usb/line6/pcm.c	2019-09-06 04:21:01.000000000 -0400
@@ -552,6 +552,15 @@ int line6_init_pcm(struct usb_line6 *lin
 	line6pcm->volume_monitor = 255;
 	line6pcm->line6 = line6;
 
+	spin_lock_init(&line6pcm->out.lock);
+	spin_lock_init(&line6pcm->in.lock);
+	line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
+
+	line6->line6pcm = line6pcm;
+
+	pcm->private_data = line6pcm;
+	pcm->private_free = line6_cleanup_pcm;
+
 	line6pcm->max_packet_size_in =
 		usb_maxpacket(line6->usbdev,
 			usb_rcvisocpipe(line6->usbdev, ep_read), 0);
@@ -564,15 +573,6 @@ int line6_init_pcm(struct usb_line6 *lin
 		return -EINVAL;
 	}
 
-	spin_lock_init(&line6pcm->out.lock);
-	spin_lock_init(&line6pcm->in.lock);
-	line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
-
-	line6->line6pcm = line6pcm;
-
-	pcm->private_data = line6pcm;
-	pcm->private_free = line6_cleanup_pcm;
-
 	err = line6_create_audio_out_urbs(line6pcm);
 	if (err < 0)
 		return err;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/sound/usb/mixer.c linux-libre-4.14.142-gnu/sound/usb/mixer.c
--- linux-libre-4.14.141-gnu/sound/usb/mixer.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/sound/usb/mixer.c	2019-09-06 04:21:01.000000000 -0400
@@ -82,6 +82,7 @@ struct mixer_build {
 	unsigned char *buffer;
 	unsigned int buflen;
 	DECLARE_BITMAP(unitbitmap, MAX_ID_ELEMS);
+	DECLARE_BITMAP(termbitmap, MAX_ID_ELEMS);
 	struct usb_audio_term oterm;
 	const struct usbmix_name_map *map;
 	const struct usbmix_selector_map *selector_map;
@@ -716,15 +717,24 @@ static int get_term_name(struct mixer_bu
  * parse the source unit recursively until it reaches to a terminal
  * or a branched unit.
  */
-static int check_input_term(struct mixer_build *state, int id,
+static int __check_input_term(struct mixer_build *state, int id,
 			    struct usb_audio_term *term)
 {
 	int err;
 	void *p1;
+	unsigned char *hdr;
 
 	memset(term, 0, sizeof(*term));
-	while ((p1 = find_audio_control_unit(state, id)) != NULL) {
-		unsigned char *hdr = p1;
+	for (;;) {
+		/* a loop in the terminal chain? */
+		if (test_and_set_bit(id, state->termbitmap))
+			return -EINVAL;
+
+		p1 = find_audio_control_unit(state, id);
+		if (!p1)
+			break;
+
+		hdr = p1;
 		term->id = id;
 		switch (hdr[2]) {
 		case UAC_INPUT_TERMINAL:
@@ -739,7 +749,7 @@ static int check_input_term(struct mixer
 
 				/* call recursively to verify that the
 				 * referenced clock entity is valid */
-				err = check_input_term(state, d->bCSourceID, term);
+				err = __check_input_term(state, d->bCSourceID, term);
 				if (err < 0)
 					return err;
 
@@ -771,7 +781,7 @@ static int check_input_term(struct mixer
 		case UAC2_CLOCK_SELECTOR: {
 			struct uac_selector_unit_descriptor *d = p1;
 			/* call recursively to retrieve the channel info */
-			err = check_input_term(state, d->baSourceID[0], term);
+			err = __check_input_term(state, d->baSourceID[0], term);
 			if (err < 0)
 				return err;
 			term->type = d->bDescriptorSubtype << 16; /* virtual type */
@@ -818,6 +828,15 @@ static int check_input_term(struct mixer
 	return -ENODEV;
 }
 
+
+static int check_input_term(struct mixer_build *state, int id,
+			    struct usb_audio_term *term)
+{
+	memset(term, 0, sizeof(*term));
+	memset(state->termbitmap, 0, sizeof(state->termbitmap));
+	return __check_input_term(state, id, term);
+}
+
 /*
  * Feature Unit
  */
@@ -1700,6 +1719,7 @@ static int parse_audio_mixer_unit(struct
 	int pin, ich, err;
 
 	if (desc->bLength < 11 || !(input_pins = desc->bNrInPins) ||
+	    desc->bLength < sizeof(*desc) + desc->bNrInPins ||
 	    !(num_outs = uac_mixer_unit_bNrChannels(desc))) {
 		usb_audio_err(state->chip,
 			      "invalid MIXER UNIT descriptor %d\n",
diff -druNp --no-dereference linux-libre-4.14.141-gnu/tools/hv/hv_kvp_daemon.c linux-libre-4.14.142-gnu/tools/hv/hv_kvp_daemon.c
--- linux-libre-4.14.141-gnu/tools/hv/hv_kvp_daemon.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/tools/hv/hv_kvp_daemon.c	2019-09-06 04:21:01.000000000 -0400
@@ -1380,6 +1380,8 @@ int main(int argc, char *argv[])
 			daemonize = 0;
 			break;
 		case 'h':
+			print_usage(argv);
+			exit(0);
 		default:
 			print_usage(argv);
 			exit(EXIT_FAILURE);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/tools/hv/hv_vss_daemon.c linux-libre-4.14.142-gnu/tools/hv/hv_vss_daemon.c
--- linux-libre-4.14.141-gnu/tools/hv/hv_vss_daemon.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/tools/hv/hv_vss_daemon.c	2019-09-06 04:21:01.000000000 -0400
@@ -172,6 +172,8 @@ int main(int argc, char *argv[])
 			daemonize = 0;
 			break;
 		case 'h':
+			print_usage(argv);
+			exit(0);
 		default:
 			print_usage(argv);
 			exit(EXIT_FAILURE);
diff -druNp --no-dereference linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic.c linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic.c
--- linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic.c	2019-09-06 04:21:01.000000000 -0400
@@ -199,6 +199,13 @@ static int vgic_irq_cmp(void *priv, stru
 	bool penda, pendb;
 	int ret;
 
+	/*
+	 * list_sort may call this function with the same element when
+	 * the list is fairly long.
+	 */
+	if (unlikely(irqa == irqb))
+		return 0;
+
 	spin_lock(&irqa->irq_lock);
 	spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING);
 
diff -druNp --no-dereference linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic-mmio.c linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic-mmio.c
--- linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic-mmio.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic-mmio.c	2019-09-06 04:21:01.000000000 -0400
@@ -123,6 +123,12 @@ unsigned long vgic_mmio_read_pending(str
 	return value;
 }
 
+static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq)
+{
+	return (vgic_irq_is_sgi(irq->intid) &&
+		vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2);
+}
+
 void vgic_mmio_write_spending(struct kvm_vcpu *vcpu,
 			      gpa_t addr, unsigned int len,
 			      unsigned long val)
@@ -133,6 +139,12 @@ void vgic_mmio_write_spending(struct kvm
 	for_each_set_bit(i, &val, len * 8) {
 		struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
 
+		/* GICD_ISPENDR0 SGI bits are WI */
+		if (is_vgic_v2_sgi(vcpu, irq)) {
+			vgic_put_irq(vcpu->kvm, irq);
+			continue;
+		}
+
 		spin_lock(&irq->irq_lock);
 		irq->pending_latch = true;
 
@@ -151,6 +163,12 @@ void vgic_mmio_write_cpending(struct kvm
 	for_each_set_bit(i, &val, len * 8) {
 		struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
 
+		/* GICD_ICPENDR0 SGI bits are WI */
+		if (is_vgic_v2_sgi(vcpu, irq)) {
+			vgic_put_irq(vcpu->kvm, irq);
+			continue;
+		}
+
 		spin_lock(&irq->irq_lock);
 
 		irq->pending_latch = false;
diff -druNp --no-dereference linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic-v2.c linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic-v2.c
--- linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic-v2.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic-v2.c	2019-09-06 04:21:01.000000000 -0400
@@ -142,7 +142,10 @@ void vgic_v2_populate_lr(struct kvm_vcpu
 		if (vgic_irq_is_sgi(irq->intid)) {
 			u32 src = ffs(irq->source);
 
-			BUG_ON(!src);
+			if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n",
+					   irq->intid))
+				return;
+
 			val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT;
 			irq->source &= ~(1 << (src - 1));
 			if (irq->source)
diff -druNp --no-dereference linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic-v3.c linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic-v3.c
--- linux-libre-4.14.141-gnu/virt/kvm/arm/vgic/vgic-v3.c	2019-08-29 02:26:46.000000000 -0400
+++ linux-libre-4.14.142-gnu/virt/kvm/arm/vgic/vgic-v3.c	2019-09-06 04:21:01.000000000 -0400
@@ -124,7 +124,10 @@ void vgic_v3_populate_lr(struct kvm_vcpu
 		    model == KVM_DEV_TYPE_ARM_VGIC_V2) {
 			u32 src = ffs(irq->source);
 
-			BUG_ON(!src);
+			if (WARN_RATELIMIT(!src, "No SGI source for INTID %d\n",
+					   irq->intid))
+				return;
+
 			val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT;
 			irq->source &= ~(1 << (src - 1));
 			if (irq->source)
