diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts linux-libre-5.0.12-gnu/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
--- linux-libre-5.0.11-gnu/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts	2019-05-04 03:21:23.000000000 -0400
@@ -93,7 +93,7 @@
 };
 
 &hdmi {
-	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
+	hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
 };
 
 &pwm {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi linux-libre-5.0.12-gnu/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi
--- linux-libre-5.0.11-gnu/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/boot/dts/imx6qdl-icore-rqs.dtsi	2019-05-04 03:21:23.000000000 -0400
@@ -264,7 +264,7 @@
 	pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
 	vmcc-supply = <&reg_sd3_vmmc>;
 	cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
-	bus-witdh = <4>;
+	bus-width = <4>;
 	no-1-8-v;
 	status = "okay";
 };
@@ -275,7 +275,7 @@
 	pinctrl-1 = <&pinctrl_usdhc4_100mhz>;
 	pinctrl-2 = <&pinctrl_usdhc4_200mhz>;
 	vmcc-supply = <&reg_sd4_vmmc>;
-	bus-witdh = <8>;
+	bus-width = <8>;
 	no-1-8-v;
 	non-removable;
 	status = "okay";
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi linux-libre-5.0.12-gnu/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
--- linux-libre-5.0.11-gnu/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi	2019-05-04 03:21:23.000000000 -0400
@@ -90,6 +90,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_enet>;
 	phy-mode = "rgmii";
+	phy-reset-duration = <10>; /* in msecs */
 	phy-reset-gpios = <&gpio3 23 GPIO_ACTIVE_LOW>;
 	phy-supply = <&vdd_eth_io_reg>;
 	status = "disabled";
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/include/asm/kvm_mmu.h linux-libre-5.0.12-gnu/arch/arm/include/asm/kvm_mmu.h
--- linux-libre-5.0.11-gnu/arch/arm/include/asm/kvm_mmu.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/include/asm/kvm_mmu.h	2019-05-04 03:21:23.000000000 -0400
@@ -381,6 +381,17 @@ static inline int kvm_read_guest_lock(st
 	return ret;
 }
 
+static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
+				       const void *data, unsigned long len)
+{
+	int srcu_idx = srcu_read_lock(&kvm->srcu);
+	int ret = kvm_write_guest(kvm, gpa, data, len);
+
+	srcu_read_unlock(&kvm->srcu, srcu_idx);
+
+	return ret;
+}
+
 static inline void *kvm_get_hyp_vector(void)
 {
 	switch(read_cpuid_part()) {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/include/asm/stage2_pgtable.h linux-libre-5.0.12-gnu/arch/arm/include/asm/stage2_pgtable.h
--- linux-libre-5.0.11-gnu/arch/arm/include/asm/stage2_pgtable.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/include/asm/stage2_pgtable.h	2019-05-04 03:21:23.000000000 -0400
@@ -75,6 +75,8 @@ static inline bool kvm_stage2_has_pud(st
 
 #define S2_PMD_MASK				PMD_MASK
 #define S2_PMD_SIZE				PMD_SIZE
+#define S2_PUD_MASK				PUD_MASK
+#define S2_PUD_SIZE				PUD_SIZE
 
 static inline bool kvm_stage2_has_pmd(struct kvm *kvm)
 {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/Kconfig linux-libre-5.0.12-gnu/arch/arm/Kconfig
--- linux-libre-5.0.11-gnu/arch/arm/Kconfig	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/Kconfig	2019-05-04 03:21:23.000000000 -0400
@@ -593,6 +593,7 @@ config ARCH_DAVINCI
 	select HAVE_IDE
 	select PM_GENERIC_DOMAINS if PM
 	select PM_GENERIC_DOMAINS_OF if PM && OF
+	select REGMAP_MMIO
 	select RESET_CONTROLLER
 	select USE_OF
 	select ZONE_DMA
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm/mach-imx/mach-imx51.c linux-libre-5.0.12-gnu/arch/arm/mach-imx/mach-imx51.c
--- linux-libre-5.0.11-gnu/arch/arm/mach-imx/mach-imx51.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm/mach-imx/mach-imx51.c	2019-05-04 03:21:23.000000000 -0400
@@ -59,6 +59,7 @@ static void __init imx51_m4if_setup(void
 		return;
 
 	m4if_base = of_iomap(np, 0);
+	of_node_put(np);
 	if (!m4if_base) {
 		pr_err("Unable to map M4IF registers\n");
 		return;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm64/boot/dts/renesas/r8a77990.dtsi linux-libre-5.0.12-gnu/arch/arm64/boot/dts/renesas/r8a77990.dtsi
--- linux-libre-5.0.11-gnu/arch/arm64/boot/dts/renesas/r8a77990.dtsi	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm64/boot/dts/renesas/r8a77990.dtsi	2019-05-04 03:21:23.000000000 -0400
@@ -2,7 +2,7 @@
 /*
  * Device Tree Source for the R-Car E3 (R8A77990) SoC
  *
- * Copyright (C) 2018 Renesas Electronics Corp.
+ * Copyright (C) 2018-2019 Renesas Electronics Corp.
  */
 
 #include <dt-bindings/clock/r8a77990-cpg-mssr.h>
@@ -1040,9 +1040,8 @@
 				 <&cpg CPG_CORE R8A77990_CLK_S3D1C>,
 				 <&scif_clk>;
 			clock-names = "fck", "brg_int", "scif_clk";
-			dmas = <&dmac1 0x5b>, <&dmac1 0x5a>,
-			       <&dmac2 0x5b>, <&dmac2 0x5a>;
-			dma-names = "tx", "rx", "tx", "rx";
+			dmas = <&dmac0 0x5b>, <&dmac0 0x5a>;
+			dma-names = "tx", "rx";
 			power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
 			resets = <&cpg 202>;
 			status = "disabled";
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm64/include/asm/kvm_mmu.h linux-libre-5.0.12-gnu/arch/arm64/include/asm/kvm_mmu.h
--- linux-libre-5.0.11-gnu/arch/arm64/include/asm/kvm_mmu.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm64/include/asm/kvm_mmu.h	2019-05-04 03:21:23.000000000 -0400
@@ -444,6 +444,17 @@ static inline int kvm_read_guest_lock(st
 	return ret;
 }
 
+static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
+				       const void *data, unsigned long len)
+{
+	int srcu_idx = srcu_read_lock(&kvm->srcu);
+	int ret = kvm_write_guest(kvm, gpa, data, len);
+
+	srcu_read_unlock(&kvm->srcu, srcu_idx);
+
+	return ret;
+}
+
 #ifdef CONFIG_KVM_INDIRECT_VECTORS
 /*
  * EL2 vectors can be mapped and rerouted in a number of ways,
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/arm64/kvm/reset.c linux-libre-5.0.12-gnu/arch/arm64/kvm/reset.c
--- linux-libre-5.0.11-gnu/arch/arm64/kvm/reset.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/arm64/kvm/reset.c	2019-05-04 03:21:23.000000000 -0400
@@ -123,6 +123,9 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu
 	int ret = -EINVAL;
 	bool loaded;
 
+	/* Reset PMU outside of the non-preemptible section */
+	kvm_pmu_vcpu_reset(vcpu);
+
 	preempt_disable();
 	loaded = (vcpu->cpu != -1);
 	if (loaded)
@@ -170,9 +173,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu
 		vcpu->arch.reset_state.reset = false;
 	}
 
-	/* Reset PMU */
-	kvm_pmu_vcpu_reset(vcpu);
-
 	/* Default workaround setup is enabled (if supported) */
 	if (kvm_arm_have_ssbd() == KVM_SSBD_KERNEL)
 		vcpu->arch.workaround_flags |= VCPU_WORKAROUND_2_FLAG;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/s390/include/asm/elf.h linux-libre-5.0.12-gnu/arch/s390/include/asm/elf.h
--- linux-libre-5.0.11-gnu/arch/s390/include/asm/elf.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/s390/include/asm/elf.h	2019-05-04 03:21:23.000000000 -0400
@@ -252,11 +252,14 @@ do {								\
 
 /*
  * Cache aliasing on the latest machines calls for a mapping granularity
- * of 512KB. For 64-bit processes use a 512KB alignment and a randomization
- * of up to 1GB. For 31-bit processes the virtual address space is limited,
- * use no alignment and limit the randomization to 8MB.
+ * of 512KB for the anonymous mapping base. For 64-bit processes use a
+ * 512KB alignment and a randomization of up to 1GB. For 31-bit processes
+ * the virtual address space is limited, use no alignment and limit the
+ * randomization to 8MB.
+ * For the additional randomization of the program break use 32MB for
+ * 64-bit and 8MB for 31-bit.
  */
-#define BRK_RND_MASK	(is_compat_task() ? 0x7ffUL : 0x3ffffUL)
+#define BRK_RND_MASK	(is_compat_task() ? 0x7ffUL : 0x1fffUL)
 #define MMAP_RND_MASK	(is_compat_task() ? 0x7ffUL : 0x3ff80UL)
 #define MMAP_ALIGN_MASK	(is_compat_task() ? 0 : 0x7fUL)
 #define STACK_RND_MASK	MMAP_RND_MASK
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/include/asm/kvm_host.h linux-libre-5.0.12-gnu/arch/x86/include/asm/kvm_host.h
--- linux-libre-5.0.11-gnu/arch/x86/include/asm/kvm_host.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/include/asm/kvm_host.h	2019-05-04 03:21:23.000000000 -0400
@@ -1198,6 +1198,8 @@ struct kvm_x86_ops {
 	int (*nested_enable_evmcs)(struct kvm_vcpu *vcpu,
 				   uint16_t *vmcs_version);
 	uint16_t (*nested_get_evmcs_version)(struct kvm_vcpu *vcpu);
+
+	bool (*need_emulation_on_page_fault)(struct kvm_vcpu *vcpu);
 };
 
 struct kvm_arch_async_pf {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/kvm/hyperv.c linux-libre-5.0.12-gnu/arch/x86/kvm/hyperv.c
--- linux-libre-5.0.11-gnu/arch/x86/kvm/hyperv.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/kvm/hyperv.c	2019-05-04 03:21:23.000000000 -0400
@@ -526,7 +526,9 @@ static int stimer_set_config(struct kvm_
 		new_config.enable = 0;
 	stimer->config.as_uint64 = new_config.as_uint64;
 
-	stimer_mark_pending(stimer, false);
+	if (stimer->config.enable)
+		stimer_mark_pending(stimer, false);
+
 	return 0;
 }
 
@@ -542,7 +544,10 @@ static int stimer_set_count(struct kvm_v
 		stimer->config.enable = 0;
 	else if (stimer->config.auto_enable)
 		stimer->config.enable = 1;
-	stimer_mark_pending(stimer, false);
+
+	if (stimer->config.enable)
+		stimer_mark_pending(stimer, false);
+
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/kvm/mmu.c linux-libre-5.0.12-gnu/arch/x86/kvm/mmu.c
--- linux-libre-5.0.11-gnu/arch/x86/kvm/mmu.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/kvm/mmu.c	2019-05-04 03:21:23.000000000 -0400
@@ -4915,11 +4915,15 @@ static union kvm_mmu_role
 kvm_calc_shadow_ept_root_page_role(struct kvm_vcpu *vcpu, bool accessed_dirty,
 				   bool execonly)
 {
-	union kvm_mmu_role role;
+	union kvm_mmu_role role = {0};
+	union kvm_mmu_page_role root_base = vcpu->arch.root_mmu.mmu_role.base;
 
-	/* Base role is inherited from root_mmu */
-	role.base.word = vcpu->arch.root_mmu.mmu_role.base.word;
-	role.ext = kvm_calc_mmu_role_ext(vcpu);
+	/* Legacy paging and SMM flags are inherited from root_mmu */
+	role.base.smm = root_base.smm;
+	role.base.nxe = root_base.nxe;
+	role.base.cr0_wp = root_base.cr0_wp;
+	role.base.smep_andnot_wp = root_base.smep_andnot_wp;
+	role.base.smap_andnot_wp = root_base.smap_andnot_wp;
 
 	role.base.level = PT64_ROOT_4LEVEL;
 	role.base.direct = false;
@@ -4927,6 +4931,7 @@ kvm_calc_shadow_ept_root_page_role(struc
 	role.base.guest_mode = true;
 	role.base.access = ACC_ALL;
 
+	role.ext = kvm_calc_mmu_role_ext(vcpu);
 	role.ext.execonly = execonly;
 
 	return role;
@@ -5390,10 +5395,12 @@ emulate:
 	 * This can happen if a guest gets a page-fault on data access but the HW
 	 * table walker is not able to read the instruction page (e.g instruction
 	 * page is not present in memory). In those cases we simply restart the
-	 * guest.
+	 * guest, with the exception of AMD Erratum 1096 which is unrecoverable.
 	 */
-	if (unlikely(insn && !insn_len))
-		return 1;
+	if (unlikely(insn && !insn_len)) {
+		if (!kvm_x86_ops->need_emulation_on_page_fault(vcpu))
+			return 1;
+	}
 
 	er = x86_emulate_instruction(vcpu, cr2, emulation_type, insn, insn_len);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/kvm/svm.c linux-libre-5.0.12-gnu/arch/x86/kvm/svm.c
--- linux-libre-5.0.11-gnu/arch/x86/kvm/svm.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/kvm/svm.c	2019-05-04 03:21:23.000000000 -0400
@@ -7114,6 +7114,36 @@ static int nested_enable_evmcs(struct kv
 	return -ENODEV;
 }
 
+static bool svm_need_emulation_on_page_fault(struct kvm_vcpu *vcpu)
+{
+	bool is_user, smap;
+
+	is_user = svm_get_cpl(vcpu) == 3;
+	smap = !kvm_read_cr4_bits(vcpu, X86_CR4_SMAP);
+
+	/*
+	 * Detect and workaround Errata 1096 Fam_17h_00_0Fh
+	 *
+	 * In non SEV guest, hypervisor will be able to read the guest
+	 * memory to decode the instruction pointer when insn_len is zero
+	 * so we return true to indicate that decoding is possible.
+	 *
+	 * But in the SEV guest, the guest memory is encrypted with the
+	 * guest specific key and hypervisor will not be able to decode the
+	 * instruction pointer so we will not able to workaround it. Lets
+	 * print the error and request to kill the guest.
+	 */
+	if (is_user && smap) {
+		if (!sev_guest(vcpu->kvm))
+			return true;
+
+		pr_err_ratelimited("KVM: Guest triggered AMD Erratum 1096\n");
+		kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
+	}
+
+	return false;
+}
+
 static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
 	.cpu_has_kvm_support = has_svm,
 	.disabled_by_bios = is_disabled,
@@ -7247,6 +7277,8 @@ static struct kvm_x86_ops svm_x86_ops __
 
 	.nested_enable_evmcs = nested_enable_evmcs,
 	.nested_get_evmcs_version = nested_get_evmcs_version,
+
+	.need_emulation_on_page_fault = svm_need_emulation_on_page_fault,
 };
 
 static int __init svm_init(void)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/kvm/vmx/vmx.c linux-libre-5.0.12-gnu/arch/x86/kvm/vmx/vmx.c
--- linux-libre-5.0.11-gnu/arch/x86/kvm/vmx/vmx.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/kvm/vmx/vmx.c	2019-05-04 03:21:23.000000000 -0400
@@ -7526,6 +7526,11 @@ static int enable_smi_window(struct kvm_
 	return 0;
 }
 
+static bool vmx_need_emulation_on_page_fault(struct kvm_vcpu *vcpu)
+{
+	return 0;
+}
+
 static __init int hardware_setup(void)
 {
 	unsigned long host_bndcfgs;
@@ -7828,6 +7833,7 @@ static struct kvm_x86_ops vmx_x86_ops __
 	.set_nested_state = NULL,
 	.get_vmcs12_pages = NULL,
 	.nested_enable_evmcs = NULL,
+	.need_emulation_on_page_fault = vmx_need_emulation_on_page_fault,
 };
 
 static void vmx_cleanup_l1d_flush(void)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/kvm/x86.c linux-libre-5.0.12-gnu/arch/x86/kvm/x86.c
--- linux-libre-5.0.11-gnu/arch/x86/kvm/x86.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/kvm/x86.c	2019-05-04 03:21:23.000000000 -0400
@@ -1127,7 +1127,7 @@ static u32 msrs_to_save[] = {
 #endif
 	MSR_IA32_TSC, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA,
 	MSR_IA32_FEATURE_CONTROL, MSR_IA32_BNDCFGS, MSR_TSC_AUX,
-	MSR_IA32_SPEC_CTRL, MSR_IA32_ARCH_CAPABILITIES,
+	MSR_IA32_SPEC_CTRL,
 	MSR_IA32_RTIT_CTL, MSR_IA32_RTIT_STATUS, MSR_IA32_RTIT_CR3_MATCH,
 	MSR_IA32_RTIT_OUTPUT_BASE, MSR_IA32_RTIT_OUTPUT_MASK,
 	MSR_IA32_RTIT_ADDR0_A, MSR_IA32_RTIT_ADDR0_B,
@@ -1160,6 +1160,7 @@ static u32 emulated_msrs[] = {
 
 	MSR_IA32_TSC_ADJUST,
 	MSR_IA32_TSCDEADLINE,
+	MSR_IA32_ARCH_CAPABILITIES,
 	MSR_IA32_MISC_ENABLE,
 	MSR_IA32_MCG_STATUS,
 	MSR_IA32_MCG_CTL,
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/mm/mmap.c linux-libre-5.0.12-gnu/arch/x86/mm/mmap.c
--- linux-libre-5.0.11-gnu/arch/x86/mm/mmap.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/mm/mmap.c	2019-05-04 03:21:23.000000000 -0400
@@ -230,7 +230,7 @@ bool mmap_address_hint_valid(unsigned lo
 /* Can we access it for direct reading/writing? Must be RAM: */
 int valid_phys_addr_range(phys_addr_t addr, size_t count)
 {
-	return addr + count <= __pa(high_memory);
+	return addr + count - 1 <= __pa(high_memory - 1);
 }
 
 /* Can we access it through mmap? Must be a valid physical address: */
diff -druNp --no-dereference linux-libre-5.0.11-gnu/arch/x86/realmode/init.c linux-libre-5.0.12-gnu/arch/x86/realmode/init.c
--- linux-libre-5.0.11-gnu/arch/x86/realmode/init.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/arch/x86/realmode/init.c	2019-05-04 03:21:23.000000000 -0400
@@ -20,8 +20,6 @@ void __init set_real_mode_mem(phys_addr_
 	void *base = __va(mem);
 
 	real_mode_header = (struct real_mode_header *) base;
-	printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n",
-	       base, (unsigned long long)mem, size);
 }
 
 void __init reserve_real_mode(void)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/Documentation/i2c/busses/i2c-i801 linux-libre-5.0.12-gnu/Documentation/i2c/busses/i2c-i801
--- linux-libre-5.0.11-gnu/Documentation/i2c/busses/i2c-i801	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/Documentation/i2c/busses/i2c-i801	2019-05-04 03:21:23.000000000 -0400
@@ -36,6 +36,7 @@ Supported adapters:
   * Intel Cannon Lake (PCH)
   * Intel Cedar Fork (PCH)
   * Intel Ice Lake (PCH)
+  * Intel Comet Lake (PCH)
    Datasheets: Publicly available at the Intel website
 
 On Intel Patsburg and later chipsets, both the normal host SMBus controller
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/acpi/acpica/evgpe.c linux-libre-5.0.12-gnu/drivers/acpi/acpica/evgpe.c
--- linux-libre-5.0.11-gnu/drivers/acpi/acpica/evgpe.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/acpi/acpica/evgpe.c	2019-05-04 03:21:23.000000000 -0400
@@ -81,12 +81,8 @@ acpi_status acpi_ev_enable_gpe(struct ac
 
 	ACPI_FUNCTION_TRACE(ev_enable_gpe);
 
-	/* Clear the GPE status */
-	status = acpi_hw_clear_gpe(gpe_event_info);
-	if (ACPI_FAILURE(status))
-		return_ACPI_STATUS(status);
-
 	/* Enable the requested GPE */
+
 	status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
 	return_ACPI_STATUS(status);
 }
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/ata/libata-zpodd.c linux-libre-5.0.12-gnu/drivers/ata/libata-zpodd.c
--- linux-libre-5.0.11-gnu/drivers/ata/libata-zpodd.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/ata/libata-zpodd.c	2019-05-04 03:21:23.000000000 -0400
@@ -52,38 +52,52 @@ static int eject_tray(struct ata_device
 /* Per the spec, only slot type and drawer type ODD can be supported */
 static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
 {
-	char buf[16];
+	char *buf;
 	unsigned int ret;
-	struct rm_feature_desc *desc = (void *)(buf + 8);
+	struct rm_feature_desc *desc;
 	struct ata_taskfile tf;
 	static const char cdb[] = {  GPCMD_GET_CONFIGURATION,
 			2,      /* only 1 feature descriptor requested */
 			0, 3,   /* 3, removable medium feature */
 			0, 0, 0,/* reserved */
-			0, sizeof(buf),
+			0, 16,
 			0, 0, 0,
 	};
 
+	buf = kzalloc(16, GFP_KERNEL);
+	if (!buf)
+		return ODD_MECH_TYPE_UNSUPPORTED;
+	desc = (void *)(buf + 8);
+
 	ata_tf_init(dev, &tf);
 	tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
 	tf.command = ATA_CMD_PACKET;
 	tf.protocol = ATAPI_PROT_PIO;
-	tf.lbam = sizeof(buf);
+	tf.lbam = 16;
 
 	ret = ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE,
-				buf, sizeof(buf), 0);
-	if (ret)
+				buf, 16, 0);
+	if (ret) {
+		kfree(buf);
 		return ODD_MECH_TYPE_UNSUPPORTED;
+	}
 
-	if (be16_to_cpu(desc->feature_code) != 3)
+	if (be16_to_cpu(desc->feature_code) != 3) {
+		kfree(buf);
 		return ODD_MECH_TYPE_UNSUPPORTED;
+	}
 
-	if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1)
+	if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1) {
+		kfree(buf);
 		return ODD_MECH_TYPE_SLOT;
-	else if (desc->mech_type == 1 && desc->load == 0 && desc->eject == 1)
+	} else if (desc->mech_type == 1 && desc->load == 0 &&
+		   desc->eject == 1) {
+		kfree(buf);
 		return ODD_MECH_TYPE_DRAWER;
-	else
+	} else {
+		kfree(buf);
 		return ODD_MECH_TYPE_UNSUPPORTED;
+	}
 }
 
 /* Test if ODD is zero power ready by sense code */
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpio/gpio-aspeed.c linux-libre-5.0.12-gnu/drivers/gpio/gpio-aspeed.c
--- linux-libre-5.0.11-gnu/drivers/gpio/gpio-aspeed.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpio/gpio-aspeed.c	2019-05-04 03:21:23.000000000 -0400
@@ -1224,6 +1224,8 @@ static int __init aspeed_gpio_probe(stru
 
 	gpio->offset_timer =
 		devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL);
+	if (!gpio->offset_timer)
+		return -ENOMEM;
 
 	return aspeed_gpio_setup_irqs(gpio, pdev);
 }
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpio/gpiolib-of.c linux-libre-5.0.12-gnu/drivers/gpio/gpiolib-of.c
--- linux-libre-5.0.11-gnu/drivers/gpio/gpiolib-of.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpio/gpiolib-of.c	2019-05-04 03:21:23.000000000 -0400
@@ -119,7 +119,8 @@ static void of_gpio_flags_quirks(struct
 	 * to determine if the flags should have inverted semantics.
 	 */
 	if (IS_ENABLED(CONFIG_SPI_MASTER) &&
-	    of_property_read_bool(np, "cs-gpios")) {
+	    of_property_read_bool(np, "cs-gpios") &&
+	    !strcmp(propname, "cs-gpios")) {
 		struct device_node *child;
 		u32 cs;
 		int ret;
@@ -141,16 +142,16 @@ static void of_gpio_flags_quirks(struct
 				 * conflict and the "spi-cs-high" flag will
 				 * take precedence.
 				 */
-				if (of_property_read_bool(np, "spi-cs-high")) {
+				if (of_property_read_bool(child, "spi-cs-high")) {
 					if (*flags & OF_GPIO_ACTIVE_LOW) {
 						pr_warn("%s GPIO handle specifies active low - ignored\n",
-							of_node_full_name(np));
+							of_node_full_name(child));
 						*flags &= ~OF_GPIO_ACTIVE_LOW;
 					}
 				} else {
 					if (!(*flags & OF_GPIO_ACTIVE_LOW))
 						pr_info("%s enforce active low on chipselect handle\n",
-							of_node_full_name(np));
+							of_node_full_name(child));
 					*flags |= OF_GPIO_ACTIVE_LOW;
 				}
 				break;
@@ -711,7 +712,13 @@ int of_gpiochip_add(struct gpio_chip *ch
 
 	of_node_get(chip->of_node);
 
-	return of_gpiochip_scan_gpios(chip);
+	status = of_gpiochip_scan_gpios(chip);
+	if (status) {
+		of_node_put(chip->of_node);
+		gpiochip_remove_pin_ranges(chip);
+	}
+
+	return status;
 }
 
 void of_gpiochip_remove(struct gpio_chip *chip)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpu/drm/drm_drv.c linux-libre-5.0.12-gnu/drivers/gpu/drm/drm_drv.c
--- linux-libre-5.0.11-gnu/drivers/gpu/drm/drm_drv.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpu/drm/drm_drv.c	2019-05-04 03:21:23.000000000 -0400
@@ -381,11 +381,7 @@ void drm_dev_unplug(struct drm_device *d
 	synchronize_srcu(&drm_unplug_srcu);
 
 	drm_dev_unregister(dev);
-
-	mutex_lock(&drm_global_mutex);
-	if (dev->open_count == 0)
-		drm_dev_put(dev);
-	mutex_unlock(&drm_global_mutex);
+	drm_dev_put(dev);
 }
 EXPORT_SYMBOL(drm_dev_unplug);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpu/drm/drm_file.c linux-libre-5.0.12-gnu/drivers/gpu/drm/drm_file.c
--- linux-libre-5.0.11-gnu/drivers/gpu/drm/drm_file.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpu/drm/drm_file.c	2019-05-04 03:21:23.000000000 -0400
@@ -479,11 +479,9 @@ int drm_release(struct inode *inode, str
 
 	drm_file_free(file_priv);
 
-	if (!--dev->open_count) {
+	if (!--dev->open_count)
 		drm_lastclose(dev);
-		if (drm_dev_is_unplugged(dev))
-			drm_put_dev(dev);
-	}
+
 	mutex_unlock(&drm_global_mutex);
 
 	drm_minor_release(minor);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpu/drm/i915/intel_dp.c linux-libre-5.0.12-gnu/drivers/gpu/drm/i915/intel_dp.c
--- linux-libre-5.0.11-gnu/drivers/gpu/drm/i915/intel_dp.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpu/drm/i915/intel_dp.c	2019-05-04 03:21:23.000000000 -0400
@@ -1871,6 +1871,9 @@ static bool intel_dp_dsc_compute_config(
 	u8 dsc_max_bpc;
 	int pipe_bpp;
 
+	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
+		intel_dp_supports_fec(intel_dp, pipe_config);
+
 	if (!intel_dp_supports_dsc(intel_dp, pipe_config))
 		return false;
 
@@ -2097,9 +2100,6 @@ intel_dp_compute_config(struct intel_enc
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		return false;
 
-	pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) &&
-				  intel_dp_supports_fec(intel_dp, pipe_config);
-
 	if (!intel_dp_compute_link_config(encoder, pipe_config, conn_state))
 		return false;
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpu/drm/meson/meson_drv.c linux-libre-5.0.12-gnu/drivers/gpu/drm/meson/meson_drv.c
--- linux-libre-5.0.11-gnu/drivers/gpu/drm/meson/meson_drv.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpu/drm/meson/meson_drv.c	2019-05-04 03:21:23.000000000 -0400
@@ -317,12 +317,14 @@ static int meson_drv_bind_master(struct
 
 	ret = drm_dev_register(drm, 0);
 	if (ret)
-		goto free_drm;
+		goto uninstall_irq;
 
 	drm_fbdev_generic_setup(drm, 32);
 
 	return 0;
 
+uninstall_irq:
+	drm_irq_uninstall(drm);
 free_drm:
 	drm_dev_put(drm);
 
@@ -336,8 +338,8 @@ static int meson_drv_bind(struct device
 
 static void meson_drv_unbind(struct device *dev)
 {
-	struct drm_device *drm = dev_get_drvdata(dev);
-	struct meson_drm *priv = drm->dev_private;
+	struct meson_drm *priv = dev_get_drvdata(dev);
+	struct drm_device *drm = priv->drm;
 
 	if (priv->canvas) {
 		meson_canvas_free(priv->canvas, priv->canvas_id_osd1);
@@ -347,6 +349,7 @@ static void meson_drv_unbind(struct devi
 	}
 
 	drm_dev_unregister(drm);
+	drm_irq_uninstall(drm);
 	drm_kms_helper_poll_fini(drm);
 	drm_mode_config_cleanup(drm);
 	drm_dev_put(drm);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/gpu/drm/tegra/hub.c linux-libre-5.0.12-gnu/drivers/gpu/drm/tegra/hub.c
--- linux-libre-5.0.11-gnu/drivers/gpu/drm/tegra/hub.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/gpu/drm/tegra/hub.c	2019-05-04 03:21:23.000000000 -0400
@@ -378,14 +378,16 @@ static int tegra_shared_plane_atomic_che
 static void tegra_shared_plane_atomic_disable(struct drm_plane *plane,
 					      struct drm_plane_state *old_state)
 {
-	struct tegra_dc *dc = to_tegra_dc(old_state->crtc);
 	struct tegra_plane *p = to_tegra_plane(plane);
+	struct tegra_dc *dc;
 	u32 value;
 
 	/* rien ne va plus */
 	if (!old_state || !old_state->crtc)
 		return;
 
+	dc = to_tegra_dc(old_state->crtc);
+
 	/*
 	 * XXX Legacy helpers seem to sometimes call ->atomic_disable() even
 	 * on planes that are already disabled. Make sure we fallback to the
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/i2c/busses/i2c-i801.c linux-libre-5.0.12-gnu/drivers/i2c/busses/i2c-i801.c
--- linux-libre-5.0.11-gnu/drivers/i2c/busses/i2c-i801.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/i2c/busses/i2c-i801.c	2019-05-04 03:21:23.000000000 -0400
@@ -71,6 +71,7 @@
  * Cannon Lake-LP (PCH)		0x9da3	32	hard	yes	yes	yes
  * Cedar Fork (PCH)		0x18df	32	hard	yes	yes	yes
  * Ice Lake-LP (PCH)		0x34a3	32	hard	yes	yes	yes
+ * Comet Lake (PCH)		0x02a3	32	hard	yes	yes	yes
  *
  * Features supported by this driver:
  * Software PEC				no
@@ -240,6 +241,7 @@
 #define PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS	0xa223
 #define PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS	0xa2a3
 #define PCI_DEVICE_ID_INTEL_CANNONLAKE_H_SMBUS		0xa323
+#define PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS		0x02a3
 
 struct i801_mux_config {
 	char *gpio_chip;
@@ -1038,6 +1040,7 @@ static const struct pci_device_id i801_i
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CANNONLAKE_H_SMBUS) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS) },
 	{ 0, }
 };
 
@@ -1534,6 +1537,7 @@ static int i801_probe(struct pci_dev *de
 	case PCI_DEVICE_ID_INTEL_DNV_SMBUS:
 	case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS:
 	case PCI_DEVICE_ID_INTEL_ICELAKE_LP_SMBUS:
+	case PCI_DEVICE_ID_INTEL_COMETLAKE_SMBUS:
 		priv->features |= FEATURE_I2C_BLOCK_READ;
 		priv->features |= FEATURE_IRQ;
 		priv->features |= FEATURE_SMBUS_PEC;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/i2c/busses/Kconfig linux-libre-5.0.12-gnu/drivers/i2c/busses/Kconfig
--- linux-libre-5.0.11-gnu/drivers/i2c/busses/Kconfig	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/i2c/busses/Kconfig	2019-05-04 03:21:23.000000000 -0400
@@ -131,6 +131,7 @@ config I2C_I801
 	    Cannon Lake (PCH)
 	    Cedar Fork (PCH)
 	    Ice Lake (PCH)
+	    Comet Lake (PCH)
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-i801.
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/iommu/amd_iommu.c linux-libre-5.0.12-gnu/drivers/iommu/amd_iommu.c
--- linux-libre-5.0.11-gnu/drivers/iommu/amd_iommu.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/iommu/amd_iommu.c	2019-05-04 03:21:23.000000000 -0400
@@ -3166,21 +3166,24 @@ static void amd_iommu_get_resv_regions(s
 		return;
 
 	list_for_each_entry(entry, &amd_iommu_unity_map, list) {
+		int type, prot = 0;
 		size_t length;
-		int prot = 0;
 
 		if (devid < entry->devid_start || devid > entry->devid_end)
 			continue;
 
+		type   = IOMMU_RESV_DIRECT;
 		length = entry->address_end - entry->address_start;
 		if (entry->prot & IOMMU_PROT_IR)
 			prot |= IOMMU_READ;
 		if (entry->prot & IOMMU_PROT_IW)
 			prot |= IOMMU_WRITE;
+		if (entry->prot & IOMMU_UNITY_MAP_FLAG_EXCL_RANGE)
+			/* Exclusion range */
+			type = IOMMU_RESV_RESERVED;
 
 		region = iommu_alloc_resv_region(entry->address_start,
-						 length, prot,
-						 IOMMU_RESV_DIRECT);
+						 length, prot, type);
 		if (!region) {
 			pr_err("Out of memory allocating dm-regions for %s\n",
 				dev_name(dev));
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/iommu/amd_iommu_init.c linux-libre-5.0.12-gnu/drivers/iommu/amd_iommu_init.c
--- linux-libre-5.0.11-gnu/drivers/iommu/amd_iommu_init.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/iommu/amd_iommu_init.c	2019-05-04 03:21:23.000000000 -0400
@@ -2013,6 +2013,9 @@ static int __init init_unity_map_range(s
 	if (e == NULL)
 		return -ENOMEM;
 
+	if (m->flags & IVMD_FLAG_EXCL_RANGE)
+		init_exclusion_range(m);
+
 	switch (m->type) {
 	default:
 		kfree(e);
@@ -2059,9 +2062,7 @@ static int __init init_memory_definition
 
 	while (p < end) {
 		m = (struct ivmd_header *)p;
-		if (m->flags & IVMD_FLAG_EXCL_RANGE)
-			init_exclusion_range(m);
-		else if (m->flags & IVMD_FLAG_UNITY_MAP)
+		if (m->flags & (IVMD_FLAG_UNITY_MAP | IVMD_FLAG_EXCL_RANGE))
 			init_unity_map_range(m);
 
 		p += m->length;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/iommu/amd_iommu_types.h linux-libre-5.0.12-gnu/drivers/iommu/amd_iommu_types.h
--- linux-libre-5.0.11-gnu/drivers/iommu/amd_iommu_types.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/iommu/amd_iommu_types.h	2019-05-04 03:21:23.000000000 -0400
@@ -374,6 +374,8 @@
 #define IOMMU_PROT_IR 0x01
 #define IOMMU_PROT_IW 0x02
 
+#define IOMMU_UNITY_MAP_FLAG_EXCL_RANGE	(1 << 2)
+
 /* IOMMU capabilities */
 #define IOMMU_CAP_IOTLB   24
 #define IOMMU_CAP_NPCACHE 26
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/leds/leds-pca9532.c linux-libre-5.0.12-gnu/drivers/leds/leds-pca9532.c
--- linux-libre-5.0.11-gnu/drivers/leds/leds-pca9532.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/leds/leds-pca9532.c	2019-05-04 03:21:23.000000000 -0400
@@ -513,6 +513,7 @@ static int pca9532_probe(struct i2c_clie
 	const struct i2c_device_id *id)
 {
 	int devid;
+	const struct of_device_id *of_id;
 	struct pca9532_data *data = i2c_get_clientdata(client);
 	struct pca9532_platform_data *pca9532_pdata =
 			dev_get_platdata(&client->dev);
@@ -528,8 +529,11 @@ static int pca9532_probe(struct i2c_clie
 			dev_err(&client->dev, "no platform data\n");
 			return -EINVAL;
 		}
-		devid = (int)(uintptr_t)of_match_device(
-			of_pca9532_leds_match, &client->dev)->data;
+		of_id = of_match_device(of_pca9532_leds_match,
+				&client->dev);
+		if (unlikely(!of_id))
+			return -EINVAL;
+		devid = (int)(uintptr_t) of_id->data;
 	} else {
 		devid = id->driver_data;
 	}
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/leds/trigger/ledtrig-netdev.c linux-libre-5.0.12-gnu/drivers/leds/trigger/ledtrig-netdev.c
--- linux-libre-5.0.11-gnu/drivers/leds/trigger/ledtrig-netdev.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/leds/trigger/ledtrig-netdev.c	2019-05-04 03:21:23.000000000 -0400
@@ -122,7 +122,8 @@ static ssize_t device_name_store(struct
 		trigger_data->net_dev = NULL;
 	}
 
-	strncpy(trigger_data->device_name, buf, size);
+	memcpy(trigger_data->device_name, buf, size);
+	trigger_data->device_name[size] = 0;
 	if (size > 0 && trigger_data->device_name[size - 1] == '\n')
 		trigger_data->device_name[size - 1] = 0;
 
@@ -301,11 +302,11 @@ static int netdev_trig_notify(struct not
 		container_of(nb, struct led_netdev_data, notifier);
 
 	if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE
-	    && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER
-	    && evt != NETDEV_CHANGENAME)
+	    && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER)
 		return NOTIFY_DONE;
 
-	if (strcmp(dev->name, trigger_data->device_name))
+	if (!(dev == trigger_data->net_dev ||
+	      (evt == NETDEV_REGISTER && !strcmp(dev->name, trigger_data->device_name))))
 		return NOTIFY_DONE;
 
 	cancel_delayed_work_sync(&trigger_data->work);
@@ -320,12 +321,9 @@ static int netdev_trig_notify(struct not
 		dev_hold(dev);
 		trigger_data->net_dev = dev;
 		break;
-	case NETDEV_CHANGENAME:
 	case NETDEV_UNREGISTER:
-		if (trigger_data->net_dev) {
-			dev_put(trigger_data->net_dev);
-			trigger_data->net_dev = NULL;
-		}
+		dev_put(trigger_data->net_dev);
+		trigger_data->net_dev = NULL;
 		break;
 	case NETDEV_UP:
 	case NETDEV_CHANGE:
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/cadence/macb_main.c linux-libre-5.0.12-gnu/drivers/net/ethernet/cadence/macb_main.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/cadence/macb_main.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/cadence/macb_main.c	2019-05-04 03:21:23.000000000 -0400
@@ -3318,14 +3318,20 @@ static int macb_clk_init(struct platform
 		*hclk = devm_clk_get(&pdev->dev, "hclk");
 	}
 
-	if (IS_ERR(*pclk)) {
+	if (IS_ERR_OR_NULL(*pclk)) {
 		err = PTR_ERR(*pclk);
+		if (!err)
+			err = -ENODEV;
+
 		dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
 		return err;
 	}
 
-	if (IS_ERR(*hclk)) {
+	if (IS_ERR_OR_NULL(*hclk)) {
 		err = PTR_ERR(*hclk);
+		if (!err)
+			err = -ENODEV;
+
 		dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
 		return err;
 	}
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/ibm/ehea/ehea_main.c linux-libre-5.0.12-gnu/drivers/net/ethernet/ibm/ehea/ehea_main.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/ibm/ehea/ehea_main.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/ibm/ehea/ehea_main.c	2019-05-04 03:21:23.000000000 -0400
@@ -3160,6 +3160,7 @@ static ssize_t ehea_probe_port(struct de
 
 	if (ehea_add_adapter_mr(adapter)) {
 		pr_err("creating MR failed\n");
+		of_node_put(eth_dn);
 		return -EIO;
 	}
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/micrel/ks8851.c linux-libre-5.0.12-gnu/drivers/net/ethernet/micrel/ks8851.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/micrel/ks8851.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/micrel/ks8851.c	2019-05-04 03:21:23.000000000 -0400
@@ -535,9 +535,8 @@ static void ks8851_rx_pkts(struct ks8851
 		/* set dma read address */
 		ks8851_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI | 0x00);
 
-		/* start the packet dma process, and set auto-dequeue rx */
-		ks8851_wrreg16(ks, KS_RXQCR,
-			       ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE);
+		/* start DMA access */
+		ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
 
 		if (rxlen > 4) {
 			unsigned int rxalign;
@@ -568,7 +567,8 @@ static void ks8851_rx_pkts(struct ks8851
 			}
 		}
 
-		ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
+		/* end DMA access and dequeue packet */
+		ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_RRXEF);
 	}
 }
 
@@ -785,6 +785,15 @@ static void ks8851_tx_work(struct work_s
 static int ks8851_net_open(struct net_device *dev)
 {
 	struct ks8851_net *ks = netdev_priv(dev);
+	int ret;
+
+	ret = request_threaded_irq(dev->irq, NULL, ks8851_irq,
+				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+				   dev->name, ks);
+	if (ret < 0) {
+		netdev_err(dev, "failed to get irq\n");
+		return ret;
+	}
 
 	/* lock the card, even if we may not actually be doing anything
 	 * else at the moment */
@@ -849,6 +858,7 @@ static int ks8851_net_open(struct net_de
 	netif_dbg(ks, ifup, ks->netdev, "network device up\n");
 
 	mutex_unlock(&ks->lock);
+	mii_check_link(&ks->mii);
 	return 0;
 }
 
@@ -899,6 +909,8 @@ static int ks8851_net_stop(struct net_de
 		dev_kfree_skb(txb);
 	}
 
+	free_irq(dev->irq, ks);
+
 	return 0;
 }
 
@@ -1508,6 +1520,7 @@ static int ks8851_probe(struct spi_devic
 
 	spi_set_drvdata(spi, ks);
 
+	netif_carrier_off(ks->netdev);
 	ndev->if_port = IF_PORT_100BASET;
 	ndev->netdev_ops = &ks8851_netdev_ops;
 	ndev->irq = spi->irq;
@@ -1529,14 +1542,6 @@ static int ks8851_probe(struct spi_devic
 	ks8851_read_selftest(ks);
 	ks8851_init_mac(ks);
 
-	ret = request_threaded_irq(spi->irq, NULL, ks8851_irq,
-				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-				   ndev->name, ks);
-	if (ret < 0) {
-		dev_err(&spi->dev, "failed to get irq\n");
-		goto err_irq;
-	}
-
 	ret = register_netdev(ndev);
 	if (ret) {
 		dev_err(&spi->dev, "failed to register network device\n");
@@ -1549,14 +1554,10 @@ static int ks8851_probe(struct spi_devic
 
 	return 0;
 
-
 err_netdev:
-	free_irq(ndev->irq, ks);
-
-err_irq:
+err_id:
 	if (gpio_is_valid(gpio))
 		gpio_set_value(gpio, 0);
-err_id:
 	regulator_disable(ks->vdd_reg);
 err_reg:
 	regulator_disable(ks->vdd_io);
@@ -1574,7 +1575,6 @@ static int ks8851_remove(struct spi_devi
 		dev_info(&spi->dev, "remove\n");
 
 	unregister_netdev(priv->netdev);
-	free_irq(spi->irq, priv);
 	if (gpio_is_valid(priv->gpio))
 		gpio_set_value(priv->gpio, 0);
 	regulator_disable(priv->vdd_reg);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c linux-libre-5.0.12-gnu/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c	2019-05-04 03:21:23.000000000 -0400
@@ -1048,6 +1048,8 @@ int qlcnic_do_lb_test(struct qlcnic_adap
 
 	for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) {
 		skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE);
+		if (!skb)
+			break;
 		qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
 		skb_put(skb, QLCNIC_ILB_PKT_SIZE);
 		adapter->ahw->diag_cnt = 0;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/stmicro/stmmac/ring_mode.c linux-libre-5.0.12-gnu/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/stmicro/stmmac/ring_mode.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/stmicro/stmmac/ring_mode.c	2019-05-04 03:21:23.000000000 -0400
@@ -59,7 +59,7 @@ static int jumbo_frm(void *p, struct sk_
 
 		desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
 		stmmac_prepare_tx_desc(priv, desc, 1, bmax, csum,
-				STMMAC_RING_MODE, 1, false, skb->len);
+				STMMAC_RING_MODE, 0, false, skb->len);
 		tx_q->tx_skbuff[entry] = NULL;
 		entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
 
@@ -79,7 +79,8 @@ static int jumbo_frm(void *p, struct sk_
 
 		desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
 		stmmac_prepare_tx_desc(priv, desc, 0, len, csum,
-				STMMAC_RING_MODE, 1, true, skb->len);
+				STMMAC_RING_MODE, 1, !skb_is_nonlinear(skb),
+				skb->len);
 	} else {
 		des2 = dma_map_single(priv->device, skb->data,
 				      nopaged_len, DMA_TO_DEVICE);
@@ -91,7 +92,8 @@ static int jumbo_frm(void *p, struct sk_
 		tx_q->tx_skbuff_dma[entry].is_jumbo = true;
 		desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
 		stmmac_prepare_tx_desc(priv, desc, 1, nopaged_len, csum,
-				STMMAC_RING_MODE, 1, true, skb->len);
+				STMMAC_RING_MODE, 0, !skb_is_nonlinear(skb),
+				skb->len);
 	}
 
 	tx_q->cur_tx = entry;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c linux-libre-5.0.12-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c	2019-05-04 03:21:23.000000000 -0400
@@ -3190,14 +3190,16 @@ static netdev_tx_t stmmac_xmit(struct sk
 		stmmac_prepare_tx_desc(priv, first, 1, nopaged_len,
 				csum_insertion, priv->mode, 1, last_segment,
 				skb->len);
-
-		/* The own bit must be the latest setting done when prepare the
-		 * descriptor and then barrier is needed to make sure that
-		 * all is coherent before granting the DMA engine.
-		 */
-		wmb();
+	} else {
+		stmmac_set_tx_owner(priv, first);
 	}
 
+	/* The own bit must be the latest setting done when prepare the
+	 * descriptor and then barrier is needed to make sure that
+	 * all is coherent before granting the DMA engine.
+	 */
+	wmb();
+
 	netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);
 
 	stmmac_enable_dma_transmission(priv, priv->ioaddr);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/ti/netcp_ethss.c linux-libre-5.0.12-gnu/drivers/net/ethernet/ti/netcp_ethss.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/ti/netcp_ethss.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/ti/netcp_ethss.c	2019-05-04 03:21:23.000000000 -0400
@@ -3657,12 +3657,16 @@ static int gbe_probe(struct netcp_device
 
 	ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device,
 				gbe_dev->dma_chan_name, gbe_dev->tx_queue_id);
-	if (ret)
+	if (ret) {
+		of_node_put(interfaces);
 		return ret;
+	}
 
 	ret = netcp_txpipe_open(&gbe_dev->tx_pipe);
-	if (ret)
+	if (ret) {
+		of_node_put(interfaces);
 		return ret;
+	}
 
 	/* Create network interfaces */
 	INIT_LIST_HEAD(&gbe_dev->gbe_intf_head);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ethernet/xilinx/xilinx_axienet_main.c linux-libre-5.0.12-gnu/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
--- linux-libre-5.0.11-gnu/drivers/net/ethernet/xilinx/xilinx_axienet_main.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ethernet/xilinx/xilinx_axienet_main.c	2019-05-04 03:21:23.000000000 -0400
@@ -1575,12 +1575,14 @@ static int axienet_probe(struct platform
 	ret = of_address_to_resource(np, 0, &dmares);
 	if (ret) {
 		dev_err(&pdev->dev, "unable to get DMA resource\n");
+		of_node_put(np);
 		goto free_netdev;
 	}
 	lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares);
 	if (IS_ERR(lp->dma_regs)) {
 		dev_err(&pdev->dev, "could not map DMA regs\n");
 		ret = PTR_ERR(lp->dma_regs);
+		of_node_put(np);
 		goto free_netdev;
 	}
 	lp->rx_irq = irq_of_parse_and_map(np, 1);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ieee802154/adf7242.c linux-libre-5.0.12-gnu/drivers/net/ieee802154/adf7242.c
--- linux-libre-5.0.11-gnu/drivers/net/ieee802154/adf7242.c	2019-05-02 15:04:41.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ieee802154/adf7242.c	2019-05-04 04:36:05.000000000 -0400
@@ -1264,6 +1264,10 @@ static int adf7242_probe(struct spi_devi
 	INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work);
 	lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev),
 					     WQ_MEM_RECLAIM);
+	if (unlikely(!lp->wqueue)) {
+		ret = -ENOMEM;
+		goto err_hw_init;
+	}
 
 	ret = adf7242_hw_init(lp);
 	if (ret)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/ieee802154/mac802154_hwsim.c linux-libre-5.0.12-gnu/drivers/net/ieee802154/mac802154_hwsim.c
--- linux-libre-5.0.11-gnu/drivers/net/ieee802154/mac802154_hwsim.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/ieee802154/mac802154_hwsim.c	2019-05-04 03:21:23.000000000 -0400
@@ -324,7 +324,7 @@ static int hwsim_get_radio_nl(struct sk_
 			goto out_err;
 		}
 
-		genlmsg_reply(skb, info);
+		res = genlmsg_reply(skb, info);
 		break;
 	}
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/phy/dp83822.c linux-libre-5.0.12-gnu/drivers/net/phy/dp83822.c
--- linux-libre-5.0.11-gnu/drivers/net/phy/dp83822.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/phy/dp83822.c	2019-05-04 03:21:23.000000000 -0400
@@ -23,6 +23,8 @@
 #include <linux/netdevice.h>
 
 #define DP83822_PHY_ID	        0x2000a240
+#define DP83825I_PHY_ID		0x2000a150
+
 #define DP83822_DEVADDR		0x1f
 
 #define MII_DP83822_PHYSCR	0x11
@@ -312,26 +314,30 @@ static int dp83822_resume(struct phy_dev
 	return 0;
 }
 
+#define DP83822_PHY_DRIVER(_id, _name)				\
+	{							\
+		PHY_ID_MATCH_MODEL(_id),			\
+		.name		= (_name),			\
+		.features	= PHY_BASIC_FEATURES,		\
+		.soft_reset	= dp83822_phy_reset,		\
+		.config_init	= dp83822_config_init,		\
+		.get_wol = dp83822_get_wol,			\
+		.set_wol = dp83822_set_wol,			\
+		.ack_interrupt = dp83822_ack_interrupt,		\
+		.config_intr = dp83822_config_intr,		\
+		.suspend = dp83822_suspend,			\
+		.resume = dp83822_resume,			\
+	}
+
 static struct phy_driver dp83822_driver[] = {
-	{
-		.phy_id = DP83822_PHY_ID,
-		.phy_id_mask = 0xfffffff0,
-		.name = "TI DP83822",
-		.features = PHY_BASIC_FEATURES,
-		.config_init = dp83822_config_init,
-		.soft_reset = dp83822_phy_reset,
-		.get_wol = dp83822_get_wol,
-		.set_wol = dp83822_set_wol,
-		.ack_interrupt = dp83822_ack_interrupt,
-		.config_intr = dp83822_config_intr,
-		.suspend = dp83822_suspend,
-		.resume = dp83822_resume,
-	 },
+	DP83822_PHY_DRIVER(DP83822_PHY_ID, "TI DP83822"),
+	DP83822_PHY_DRIVER(DP83825I_PHY_ID, "TI DP83825I"),
 };
 module_phy_driver(dp83822_driver);
 
 static struct mdio_device_id __maybe_unused dp83822_tbl[] = {
 	{ DP83822_PHY_ID, 0xfffffff0 },
+	{ DP83825I_PHY_ID, 0xfffffff0 },
 	{ },
 };
 MODULE_DEVICE_TABLE(mdio, dp83822_tbl);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c linux-libre-5.0.12-gnu/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
--- linux-libre-5.0.11-gnu/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c	2019-05-04 03:21:23.000000000 -0400
@@ -81,8 +81,9 @@ int mt76x02u_tx_prepare_skb(struct mt76_
 
 	mt76x02_insert_hdr_pad(skb);
 
-	txwi = skb_push(skb, sizeof(struct mt76x02_txwi));
+	txwi = (struct mt76x02_txwi *)(skb->data - sizeof(struct mt76x02_txwi));
 	mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, len);
+	skb_push(skb, sizeof(struct mt76x02_txwi));
 
 	pid = mt76_tx_status_skb_add(mdev, wcid, skb);
 	txwi->pktid = pid;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c linux-libre-5.0.12-gnu/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
--- linux-libre-5.0.11-gnu/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/net/wireless/mediatek/mt76/mt76x2/phy.c	2019-05-04 03:21:23.000000000 -0400
@@ -260,10 +260,15 @@ mt76x2_phy_set_gain_val(struct mt76x02_d
 	gain_val[0] = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust;
 	gain_val[1] = dev->cal.agc_gain_cur[1] - dev->cal.agc_gain_adjust;
 
-	if (dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40)
+	val = 0x1836 << 16;
+	if (!mt76x2_has_ext_lna(dev) &&
+	    dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40)
 		val = 0x1e42 << 16;
-	else
-		val = 0x1836 << 16;
+
+	if (mt76x2_has_ext_lna(dev) &&
+	    dev->mt76.chandef.chan->band == NL80211_BAND_2GHZ &&
+	    dev->mt76.chandef.width < NL80211_CHAN_WIDTH_40)
+		val = 0x0f36 << 16;
 
 	val |= 0xf8;
 
@@ -280,6 +285,7 @@ void mt76x2_phy_update_channel_gain(stru
 {
 	u8 *gain = dev->cal.agc_gain_init;
 	u8 low_gain_delta, gain_delta;
+	u32 agc_35, agc_37;
 	bool gain_change;
 	int low_gain;
 	u32 val;
@@ -316,6 +322,16 @@ void mt76x2_phy_update_channel_gain(stru
 	else
 		low_gain_delta = 14;
 
+	agc_37 = 0x2121262c;
+	if (dev->mt76.chandef.chan->band == NL80211_BAND_2GHZ)
+		agc_35 = 0x11111516;
+	else if (low_gain == 2)
+		agc_35 = agc_37 = 0x08080808;
+	else if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_80)
+		agc_35 = 0x10101014;
+	else
+		agc_35 = 0x11111116;
+
 	if (low_gain == 2) {
 		mt76_wr(dev, MT_BBP(RXO, 18), 0xf000a990);
 		mt76_wr(dev, MT_BBP(AGC, 35), 0x08080808);
@@ -324,15 +340,13 @@ void mt76x2_phy_update_channel_gain(stru
 		dev->cal.agc_gain_adjust = 0;
 	} else {
 		mt76_wr(dev, MT_BBP(RXO, 18), 0xf000a991);
-		if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_80)
-			mt76_wr(dev, MT_BBP(AGC, 35), 0x10101014);
-		else
-			mt76_wr(dev, MT_BBP(AGC, 35), 0x11111116);
-		mt76_wr(dev, MT_BBP(AGC, 37), 0x2121262C);
 		gain_delta = 0;
 		dev->cal.agc_gain_adjust = low_gain_delta;
 	}
 
+	mt76_wr(dev, MT_BBP(AGC, 35), agc_35);
+	mt76_wr(dev, MT_BBP(AGC, 37), agc_37);
+
 	dev->cal.agc_gain_cur[0] = gain[0] - gain_delta;
 	dev->cal.agc_gain_cur[1] = gain[1] - gain_delta;
 	mt76x2_phy_set_gain_val(dev);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/nvme/host/multipath.c linux-libre-5.0.12-gnu/drivers/nvme/host/multipath.c
--- linux-libre-5.0.11-gnu/drivers/nvme/host/multipath.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/nvme/host/multipath.c	2019-05-04 03:21:23.000000000 -0400
@@ -366,15 +366,12 @@ static inline bool nvme_state_is_live(en
 static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
 		struct nvme_ns *ns)
 {
-	enum nvme_ana_state old;
-
 	mutex_lock(&ns->head->lock);
-	old = ns->ana_state;
 	ns->ana_grpid = le32_to_cpu(desc->grpid);
 	ns->ana_state = desc->state;
 	clear_bit(NVME_NS_ANA_PENDING, &ns->flags);
 
-	if (nvme_state_is_live(ns->ana_state) && !nvme_state_is_live(old))
+	if (nvme_state_is_live(ns->ana_state))
 		nvme_mpath_set_live(ns);
 	mutex_unlock(&ns->head->lock);
 }
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/nvme/target/core.c linux-libre-5.0.12-gnu/drivers/nvme/target/core.c
--- linux-libre-5.0.11-gnu/drivers/nvme/target/core.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/nvme/target/core.c	2019-05-04 03:21:23.000000000 -0400
@@ -517,7 +517,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
 
 	ret = nvmet_p2pmem_ns_enable(ns);
 	if (ret)
-		goto out_unlock;
+		goto out_dev_disable;
 
 	list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
 		nvmet_p2pmem_ns_add_p2p(ctrl, ns);
@@ -558,7 +558,7 @@ out_unlock:
 out_dev_put:
 	list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
 		pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid));
-
+out_dev_disable:
 	nvmet_ns_dev_disable(ns);
 	goto out_unlock;
 }
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/nvme/target/io-cmd-file.c linux-libre-5.0.12-gnu/drivers/nvme/target/io-cmd-file.c
--- linux-libre-5.0.11-gnu/drivers/nvme/target/io-cmd-file.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/nvme/target/io-cmd-file.c	2019-05-04 03:21:23.000000000 -0400
@@ -75,11 +75,11 @@ err:
 	return ret;
 }
 
-static void nvmet_file_init_bvec(struct bio_vec *bv, struct sg_page_iter *iter)
+static void nvmet_file_init_bvec(struct bio_vec *bv, struct scatterlist *sg)
 {
-	bv->bv_page = sg_page_iter_page(iter);
-	bv->bv_offset = iter->sg->offset;
-	bv->bv_len = PAGE_SIZE - iter->sg->offset;
+	bv->bv_page = sg_page(sg);
+	bv->bv_offset = sg->offset;
+	bv->bv_len = sg->length;
 }
 
 static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos,
@@ -128,14 +128,14 @@ static void nvmet_file_io_done(struct ki
 
 static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags)
 {
-	ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE);
-	struct sg_page_iter sg_pg_iter;
+	ssize_t nr_bvec = req->sg_cnt;
 	unsigned long bv_cnt = 0;
 	bool is_sync = false;
 	size_t len = 0, total_len = 0;
 	ssize_t ret = 0;
 	loff_t pos;
-
+	int i;
+	struct scatterlist *sg;
 
 	if (req->f.mpool_alloc && nr_bvec > NVMET_MAX_MPOOL_BVEC)
 		is_sync = true;
@@ -147,8 +147,8 @@ static bool nvmet_file_execute_io(struct
 	}
 
 	memset(&req->f.iocb, 0, sizeof(struct kiocb));
-	for_each_sg_page(req->sg, &sg_pg_iter, req->sg_cnt, 0) {
-		nvmet_file_init_bvec(&req->f.bvec[bv_cnt], &sg_pg_iter);
+	for_each_sg(req->sg, sg, req->sg_cnt, i) {
+		nvmet_file_init_bvec(&req->f.bvec[bv_cnt], sg);
 		len += req->f.bvec[bv_cnt].bv_len;
 		total_len += req->f.bvec[bv_cnt].bv_len;
 		bv_cnt++;
@@ -225,7 +225,7 @@ static void nvmet_file_submit_buffered_i
 
 static void nvmet_file_execute_rw(struct nvmet_req *req)
 {
-	ssize_t nr_bvec = DIV_ROUND_UP(req->data_len, PAGE_SIZE);
+	ssize_t nr_bvec = req->sg_cnt;
 
 	if (!req->sg_cnt || !nr_bvec) {
 		nvmet_req_complete(req, 0);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/s390/net/qeth_l3_main.c linux-libre-5.0.12-gnu/drivers/s390/net/qeth_l3_main.c
--- linux-libre-5.0.11-gnu/drivers/s390/net/qeth_l3_main.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/s390/net/qeth_l3_main.c	2019-05-04 03:21:23.000000000 -0400
@@ -2316,12 +2316,14 @@ static int qeth_l3_probe_device(struct c
 	struct qeth_card *card = dev_get_drvdata(&gdev->dev);
 	int rc;
 
+	hash_init(card->ip_htable);
+
 	if (gdev->dev.type == &qeth_generic_devtype) {
 		rc = qeth_l3_create_device_attributes(&gdev->dev);
 		if (rc)
 			return rc;
 	}
-	hash_init(card->ip_htable);
+
 	hash_init(card->ip_mc_htable);
 	card->info.hwtrap = 0;
 	return 0;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/s390/scsi/zfcp_fc.c linux-libre-5.0.12-gnu/drivers/s390/scsi/zfcp_fc.c
--- linux-libre-5.0.11-gnu/drivers/s390/scsi/zfcp_fc.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/s390/scsi/zfcp_fc.c	2019-05-04 03:21:23.000000000 -0400
@@ -239,10 +239,6 @@ static void _zfcp_fc_incoming_rscn(struc
 	list_for_each_entry(port, &adapter->port_list, list) {
 		if ((port->d_id & range) == (ntoh24(page->rscn_fid) & range))
 			zfcp_fc_test_link(port);
-		if (!port->d_id)
-			zfcp_erp_port_reopen(port,
-					     ZFCP_STATUS_COMMON_ERP_FAILED,
-					     "fcrscn1");
 	}
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 }
@@ -250,6 +246,7 @@ static void _zfcp_fc_incoming_rscn(struc
 static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
 {
 	struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data;
+	struct zfcp_adapter *adapter = fsf_req->adapter;
 	struct fc_els_rscn *head;
 	struct fc_els_rscn_page *page;
 	u16 i;
@@ -263,6 +260,22 @@ static void zfcp_fc_incoming_rscn(struct
 	no_entries = be16_to_cpu(head->rscn_plen) /
 		sizeof(struct fc_els_rscn_page);
 
+	if (no_entries > 1) {
+		/* handle failed ports */
+		unsigned long flags;
+		struct zfcp_port *port;
+
+		read_lock_irqsave(&adapter->port_list_lock, flags);
+		list_for_each_entry(port, &adapter->port_list, list) {
+			if (port->d_id)
+				continue;
+			zfcp_erp_port_reopen(port,
+					     ZFCP_STATUS_COMMON_ERP_FAILED,
+					     "fcrscn1");
+		}
+		read_unlock_irqrestore(&adapter->port_list_lock, flags);
+	}
+
 	for (i = 1; i < no_entries; i++) {
 		/* skip head and start with 1st element */
 		page++;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/scsi/aacraid/aacraid.h linux-libre-5.0.12-gnu/drivers/scsi/aacraid/aacraid.h
--- linux-libre-5.0.11-gnu/drivers/scsi/aacraid/aacraid.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/scsi/aacraid/aacraid.h	2019-05-04 03:21:23.000000000 -0400
@@ -2640,9 +2640,14 @@ static inline unsigned int cap_to_cyls(s
 	return capacity;
 }
 
+static inline int aac_pci_offline(struct aac_dev *dev)
+{
+	return pci_channel_offline(dev->pdev) || dev->handle_pci_error;
+}
+
 static inline int aac_adapter_check_health(struct aac_dev *dev)
 {
-	if (unlikely(pci_channel_offline(dev->pdev)))
+	if (unlikely(aac_pci_offline(dev)))
 		return -1;
 
 	return (dev)->a_ops.adapter_check_health(dev);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/scsi/aacraid/commsup.c linux-libre-5.0.12-gnu/drivers/scsi/aacraid/commsup.c
--- linux-libre-5.0.11-gnu/drivers/scsi/aacraid/commsup.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/scsi/aacraid/commsup.c	2019-05-04 03:21:23.000000000 -0400
@@ -672,7 +672,7 @@ int aac_fib_send(u16 command, struct fib
 					return -ETIMEDOUT;
 				}
 
-				if (unlikely(pci_channel_offline(dev->pdev)))
+				if (unlikely(aac_pci_offline(dev)))
 					return -EFAULT;
 
 				if ((blink = aac_adapter_check_health(dev)) > 0) {
@@ -772,7 +772,7 @@ int aac_hba_send(u8 command, struct fib
 
 		spin_unlock_irqrestore(&fibptr->event_lock, flags);
 
-		if (unlikely(pci_channel_offline(dev->pdev)))
+		if (unlikely(aac_pci_offline(dev)))
 			return -EFAULT;
 
 		fibptr->flags |= FIB_CONTEXT_FLAG_WAIT;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/scsi/mpt3sas/mpt3sas_base.c linux-libre-5.0.12-gnu/drivers/scsi/mpt3sas/mpt3sas_base.c
--- linux-libre-5.0.11-gnu/drivers/scsi/mpt3sas/mpt3sas_base.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/scsi/mpt3sas/mpt3sas_base.c	2019-05-04 03:21:23.000000000 -0400
@@ -3281,12 +3281,18 @@ mpt3sas_base_free_smid(struct MPT3SAS_AD
 
 	if (smid < ioc->hi_priority_smid) {
 		struct scsiio_tracker *st;
+		void *request;
 
 		st = _get_st_from_smid(ioc, smid);
 		if (!st) {
 			_base_recovery_check(ioc);
 			return;
 		}
+
+		/* Clear MPI request frame */
+		request = mpt3sas_base_get_msg_frame(ioc, smid);
+		memset(request, 0, ioc->request_sz);
+
 		mpt3sas_base_clear_st(ioc, st);
 		_base_recovery_check(ioc);
 		return;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c linux-libre-5.0.12-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c
--- linux-libre-5.0.11-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/scsi/mpt3sas/mpt3sas_scsih.c	2019-05-04 03:21:23.000000000 -0400
@@ -1462,11 +1462,23 @@ mpt3sas_scsih_scsi_lookup_get(struct MPT
 {
 	struct scsi_cmnd *scmd = NULL;
 	struct scsiio_tracker *st;
+	Mpi25SCSIIORequest_t *mpi_request;
 
 	if (smid > 0  &&
 	    smid <= ioc->scsiio_depth - INTERNAL_SCSIIO_CMDS_COUNT) {
 		u32 unique_tag = smid - 1;
 
+		mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+
+		/*
+		 * If SCSI IO request is outstanding at driver level then
+		 * DevHandle filed must be non-zero. If DevHandle is zero
+		 * then it means that this smid is free at driver level,
+		 * so return NULL.
+		 */
+		if (!mpi_request->DevHandle)
+			return scmd;
+
 		scmd = scsi_host_find_tag(ioc->shost, unique_tag);
 		if (scmd) {
 			st = scsi_cmd_priv(scmd);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/scsi/qla4xxx/ql4_os.c linux-libre-5.0.12-gnu/drivers/scsi/qla4xxx/ql4_os.c
--- linux-libre-5.0.11-gnu/drivers/scsi/qla4xxx/ql4_os.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/scsi/qla4xxx/ql4_os.c	2019-05-04 03:21:23.000000000 -0400
@@ -3203,6 +3203,8 @@ static int qla4xxx_conn_bind(struct iscs
 	if (iscsi_conn_bind(cls_session, cls_conn, is_leading))
 		return -EINVAL;
 	ep = iscsi_lookup_endpoint(transport_fd);
+	if (!ep)
+		return -EINVAL;
 	conn = cls_conn->dd_data;
 	qla_conn = conn->dd_data;
 	qla_conn->qla_ep = ep->dd_data;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/axis-fifo/Kconfig linux-libre-5.0.12-gnu/drivers/staging/axis-fifo/Kconfig
--- linux-libre-5.0.11-gnu/drivers/staging/axis-fifo/Kconfig	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/axis-fifo/Kconfig	2019-05-04 03:21:23.000000000 -0400
@@ -3,6 +3,7 @@
 #
 config XIL_AXIS_FIFO
 	tristate "Xilinx AXI-Stream FIFO IP core driver"
+	depends on OF
 	default n
 	help
 	  This adds support for the Xilinx AXI-Stream
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/mt7621-pci/Kconfig linux-libre-5.0.12-gnu/drivers/staging/mt7621-pci/Kconfig
--- linux-libre-5.0.11-gnu/drivers/staging/mt7621-pci/Kconfig	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/mt7621-pci/Kconfig	2019-05-04 03:21:23.000000000 -0400
@@ -1,6 +1,7 @@
 config PCI_MT7621
 	tristate "MediaTek MT7621 PCI Controller"
 	depends on RALINK
+	depends on PCI
 	select PCI_DRIVERS_GENERIC
 	help
 	  This selects a driver for the MediaTek MT7621 PCI Controller.
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtl8188eu/core/rtw_xmit.c linux-libre-5.0.12-gnu/drivers/staging/rtl8188eu/core/rtw_xmit.c
--- linux-libre-5.0.11-gnu/drivers/staging/rtl8188eu/core/rtw_xmit.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtl8188eu/core/rtw_xmit.c	2019-05-04 03:21:23.000000000 -0400
@@ -174,7 +174,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv
 
 	pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf;
 
-	rtw_alloc_hwxmits(padapter);
+	res = rtw_alloc_hwxmits(padapter);
+	if (res == _FAIL)
+		goto exit;
 	rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
 
 	for (i = 0; i < 4; i++)
@@ -1503,7 +1505,7 @@ exit:
 	return res;
 }
 
-void rtw_alloc_hwxmits(struct adapter *padapter)
+s32 rtw_alloc_hwxmits(struct adapter *padapter)
 {
 	struct hw_xmit *hwxmits;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -1512,6 +1514,8 @@ void rtw_alloc_hwxmits(struct adapter *p
 
 	pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry,
 				     sizeof(struct hw_xmit), GFP_KERNEL);
+	if (!pxmitpriv->hwxmits)
+		return _FAIL;
 
 	hwxmits = pxmitpriv->hwxmits;
 
@@ -1519,6 +1523,7 @@ void rtw_alloc_hwxmits(struct adapter *p
 	hwxmits[1] .sta_queue = &pxmitpriv->vi_pending;
 	hwxmits[2] .sta_queue = &pxmitpriv->be_pending;
 	hwxmits[3] .sta_queue = &pxmitpriv->bk_pending;
+	return _SUCCESS;
 }
 
 void rtw_free_hwxmits(struct adapter *padapter)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtl8188eu/include/rtw_xmit.h linux-libre-5.0.12-gnu/drivers/staging/rtl8188eu/include/rtw_xmit.h
--- linux-libre-5.0.11-gnu/drivers/staging/rtl8188eu/include/rtw_xmit.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtl8188eu/include/rtw_xmit.h	2019-05-04 03:21:23.000000000 -0400
@@ -336,7 +336,7 @@ s32 rtw_txframes_sta_ac_pending(struct a
 void rtw_init_hwxmits(struct hw_xmit *phwxmit, int entry);
 s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter);
 void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv);
-void rtw_alloc_hwxmits(struct adapter *padapter);
+s32 rtw_alloc_hwxmits(struct adapter *padapter);
 void rtw_free_hwxmits(struct adapter *padapter);
 s32 rtw_xmit(struct adapter *padapter, struct sk_buff **pkt);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtl8712/rtl8712_cmd.c linux-libre-5.0.12-gnu/drivers/staging/rtl8712/rtl8712_cmd.c
--- linux-libre-5.0.11-gnu/drivers/staging/rtl8712/rtl8712_cmd.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtl8712/rtl8712_cmd.c	2019-05-04 03:21:23.000000000 -0400
@@ -147,17 +147,9 @@ static u8 write_macreg_hdl(struct _adapt
 
 static u8 read_bbreg_hdl(struct _adapter *padapter, u8 *pbuf)
 {
-	u32 val;
-	void (*pcmd_callback)(struct _adapter *dev, struct cmd_obj	*pcmd);
 	struct cmd_obj *pcmd  = (struct cmd_obj *)pbuf;
 
-	if (pcmd->rsp && pcmd->rspsz > 0)
-		memcpy(pcmd->rsp, (u8 *)&val, pcmd->rspsz);
-	pcmd_callback = cmd_callback[pcmd->cmdcode].callback;
-	if (!pcmd_callback)
-		r8712_free_cmd_obj(pcmd);
-	else
-		pcmd_callback(padapter, pcmd);
+	r8712_free_cmd_obj(pcmd);
 	return H2C_SUCCESS;
 }
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtl8712/rtl8712_cmd.h linux-libre-5.0.12-gnu/drivers/staging/rtl8712/rtl8712_cmd.h
--- linux-libre-5.0.11-gnu/drivers/staging/rtl8712/rtl8712_cmd.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtl8712/rtl8712_cmd.h	2019-05-04 03:21:23.000000000 -0400
@@ -140,7 +140,7 @@ enum rtl8712_h2c_cmd {
 static struct _cmd_callback	cmd_callback[] = {
 	{GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
 	{GEN_CMD_CODE(_Write_MACREG), NULL},
-	{GEN_CMD_CODE(_Read_BBREG), &r8712_getbbrfreg_cmdrsp_callback},
+	{GEN_CMD_CODE(_Read_BBREG), NULL},
 	{GEN_CMD_CODE(_Write_BBREG), NULL},
 	{GEN_CMD_CODE(_Read_RFREG), &r8712_getbbrfreg_cmdrsp_callback},
 	{GEN_CMD_CODE(_Write_RFREG), NULL}, /*5*/
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtl8723bs/core/rtw_xmit.c linux-libre-5.0.12-gnu/drivers/staging/rtl8723bs/core/rtw_xmit.c
--- linux-libre-5.0.11-gnu/drivers/staging/rtl8723bs/core/rtw_xmit.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtl8723bs/core/rtw_xmit.c	2019-05-04 03:21:23.000000000 -0400
@@ -260,7 +260,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv
 		}
 	}
 
-	rtw_alloc_hwxmits(padapter);
+	res = rtw_alloc_hwxmits(padapter);
+	if (res == _FAIL)
+		goto exit;
 	rtw_init_hwxmits(pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry);
 
 	for (i = 0; i < 4; i++) {
@@ -2144,7 +2146,7 @@ exit:
 	return res;
 }
 
-void rtw_alloc_hwxmits(struct adapter *padapter)
+s32 rtw_alloc_hwxmits(struct adapter *padapter)
 {
 	struct hw_xmit *hwxmits;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -2155,10 +2157,8 @@ void rtw_alloc_hwxmits(struct adapter *p
 
 	pxmitpriv->hwxmits = rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry);
 
-	if (pxmitpriv->hwxmits == NULL) {
-		DBG_871X("alloc hwxmits fail!...\n");
-		return;
-	}
+	if (!pxmitpriv->hwxmits)
+		return _FAIL;
 
 	hwxmits = pxmitpriv->hwxmits;
 
@@ -2204,7 +2204,7 @@ void rtw_alloc_hwxmits(struct adapter *p
 
 	}
 
-
+	return _SUCCESS;
 }
 
 void rtw_free_hwxmits(struct adapter *padapter)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtl8723bs/include/rtw_xmit.h linux-libre-5.0.12-gnu/drivers/staging/rtl8723bs/include/rtw_xmit.h
--- linux-libre-5.0.11-gnu/drivers/staging/rtl8723bs/include/rtw_xmit.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtl8723bs/include/rtw_xmit.h	2019-05-04 03:21:23.000000000 -0400
@@ -487,7 +487,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv
 void _rtw_free_xmit_priv (struct xmit_priv *pxmitpriv);
 
 
-void rtw_alloc_hwxmits(struct adapter *padapter);
+s32 rtw_alloc_hwxmits(struct adapter *padapter);
 void rtw_free_hwxmits(struct adapter *padapter);
 
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtlwifi/phydm/rtl_phydm.c linux-libre-5.0.12-gnu/drivers/staging/rtlwifi/phydm/rtl_phydm.c
--- linux-libre-5.0.11-gnu/drivers/staging/rtlwifi/phydm/rtl_phydm.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtlwifi/phydm/rtl_phydm.c	2019-05-04 03:21:23.000000000 -0400
@@ -180,6 +180,8 @@ static int rtl_phydm_init_priv(struct rt
 
 	rtlpriv->phydm.internal =
 		kzalloc(sizeof(struct phy_dm_struct), GFP_KERNEL);
+	if (!rtlpriv->phydm.internal)
+		return 0;
 
 	_rtl_phydm_init_com_info(rtlpriv, ic, params);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/rtlwifi/rtl8822be/fw.c linux-libre-5.0.12-gnu/drivers/staging/rtlwifi/rtl8822be/fw.c
--- linux-libre-5.0.11-gnu/drivers/staging/rtlwifi/rtl8822be/fw.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/rtlwifi/rtl8822be/fw.c	2019-05-04 03:21:23.000000000 -0400
@@ -741,6 +741,8 @@ void rtl8822be_set_fw_rsvdpagepkt(struct
 		      u1_rsvd_page_loc, 3);
 
 	skb = dev_alloc_skb(totalpacketlen);
+	if (!skb)
+		return;
 	memcpy((u8 *)skb_put(skb, totalpacketlen), &reserved_page_packet,
 	       totalpacketlen);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c linux-libre-5.0.12-gnu/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
--- linux-libre-5.0.11-gnu/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c	2019-05-04 03:21:23.000000000 -0400
@@ -3513,6 +3513,7 @@ static int vchiq_probe(struct platform_d
 	struct device_node *fw_node;
 	const struct of_device_id *of_id;
 	struct vchiq_drvdata *drvdata;
+	struct device *vchiq_dev;
 	int err;
 
 	of_id = of_match_node(vchiq_of_match, pdev->dev.of_node);
@@ -3547,9 +3548,12 @@ static int vchiq_probe(struct platform_d
 		goto failed_platform_init;
 	}
 
-	if (IS_ERR(device_create(vchiq_class, &pdev->dev, vchiq_devid,
-				 NULL, "vchiq")))
+	vchiq_dev = device_create(vchiq_class, &pdev->dev, vchiq_devid, NULL,
+				  "vchiq");
+	if (IS_ERR(vchiq_dev)) {
+		err = PTR_ERR(vchiq_dev);
 		goto failed_device_create;
+	}
 
 	vchiq_debugfs_init();
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/tty/serial/ar933x_uart.c linux-libre-5.0.12-gnu/drivers/tty/serial/ar933x_uart.c
--- linux-libre-5.0.11-gnu/drivers/tty/serial/ar933x_uart.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/tty/serial/ar933x_uart.c	2019-05-04 03:21:23.000000000 -0400
@@ -49,11 +49,6 @@ struct ar933x_uart_port {
 	struct clk		*clk;
 };
 
-static inline bool ar933x_uart_console_enabled(void)
-{
-	return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
-}
-
 static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
 					    int offset)
 {
@@ -508,6 +503,7 @@ static const struct uart_ops ar933x_uart
 	.verify_port	= ar933x_uart_verify_port,
 };
 
+#ifdef CONFIG_SERIAL_AR933X_CONSOLE
 static struct ar933x_uart_port *
 ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
 
@@ -604,14 +600,7 @@ static struct console ar933x_uart_consol
 	.index		= -1,
 	.data		= &ar933x_uart_driver,
 };
-
-static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
-{
-	if (!ar933x_uart_console_enabled())
-		return;
-
-	ar933x_console_ports[up->port.line] = up;
-}
+#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
 
 static struct uart_driver ar933x_uart_driver = {
 	.owner		= THIS_MODULE,
@@ -700,7 +689,9 @@ static int ar933x_uart_probe(struct plat
 	baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
 	up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
 
-	ar933x_uart_add_console_port(up);
+#ifdef CONFIG_SERIAL_AR933X_CONSOLE
+	ar933x_console_ports[up->port.line] = up;
+#endif
 
 	ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
 	if (ret)
@@ -749,8 +740,9 @@ static int __init ar933x_uart_init(void)
 {
 	int ret;
 
-	if (ar933x_uart_console_enabled())
-		ar933x_uart_driver.cons = &ar933x_uart_console;
+#ifdef CONFIG_SERIAL_AR933X_CONSOLE
+	ar933x_uart_driver.cons = &ar933x_uart_console;
+#endif
 
 	ret = uart_register_driver(&ar933x_uart_driver);
 	if (ret)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/tty/serial/sc16is7xx.c linux-libre-5.0.12-gnu/drivers/tty/serial/sc16is7xx.c
--- linux-libre-5.0.11-gnu/drivers/tty/serial/sc16is7xx.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/tty/serial/sc16is7xx.c	2019-05-04 03:21:23.000000000 -0400
@@ -1509,7 +1509,7 @@ static int __init sc16is7xx_init(void)
 	ret = i2c_add_driver(&sc16is7xx_i2c_uart_driver);
 	if (ret < 0) {
 		pr_err("failed to init sc16is7xx i2c --> %d\n", ret);
-		return ret;
+		goto err_i2c;
 	}
 #endif
 
@@ -1517,10 +1517,18 @@ static int __init sc16is7xx_init(void)
 	ret = spi_register_driver(&sc16is7xx_spi_uart_driver);
 	if (ret < 0) {
 		pr_err("failed to init sc16is7xx spi --> %d\n", ret);
-		return ret;
+		goto err_spi;
 	}
 #endif
 	return ret;
+
+err_spi:
+#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
+	i2c_del_driver(&sc16is7xx_i2c_uart_driver);
+#endif
+err_i2c:
+	uart_unregister_driver(&sc16is7xx_uart);
+	return ret;
 }
 module_init(sc16is7xx_init);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/usb/dwc3/dwc3-pci.c linux-libre-5.0.12-gnu/drivers/usb/dwc3/dwc3-pci.c
--- linux-libre-5.0.11-gnu/drivers/usb/dwc3/dwc3-pci.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/usb/dwc3/dwc3-pci.c	2019-05-04 03:21:23.000000000 -0400
@@ -29,6 +29,7 @@
 #define PCI_DEVICE_ID_INTEL_BXT_M		0x1aaa
 #define PCI_DEVICE_ID_INTEL_APL			0x5aaa
 #define PCI_DEVICE_ID_INTEL_KBP			0xa2b0
+#define PCI_DEVICE_ID_INTEL_CMLH		0x02ee
 #define PCI_DEVICE_ID_INTEL_GLK			0x31aa
 #define PCI_DEVICE_ID_INTEL_CNPLP		0x9dee
 #define PCI_DEVICE_ID_INTEL_CNPH		0xa36e
@@ -305,6 +306,9 @@ static const struct pci_device_id dwc3_p
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
 	  (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
 
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
+	  (kernel_ulong_t) &dwc3_pci_intel_properties, },
+
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
 	  (kernel_ulong_t) &dwc3_pci_intel_properties, },
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/usb/gadget/udc/net2272.c linux-libre-5.0.12-gnu/drivers/usb/gadget/udc/net2272.c
--- linux-libre-5.0.11-gnu/drivers/usb/gadget/udc/net2272.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/usb/gadget/udc/net2272.c	2019-05-04 03:21:23.000000000 -0400
@@ -945,6 +945,7 @@ net2272_dequeue(struct usb_ep *_ep, stru
 			break;
 	}
 	if (&req->req != _req) {
+		ep->stopped = stopped;
 		spin_unlock_irqrestore(&ep->dev->lock, flags);
 		return -EINVAL;
 	}
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/usb/gadget/udc/net2280.c linux-libre-5.0.12-gnu/drivers/usb/gadget/udc/net2280.c
--- linux-libre-5.0.11-gnu/drivers/usb/gadget/udc/net2280.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/usb/gadget/udc/net2280.c	2019-05-04 03:21:23.000000000 -0400
@@ -866,9 +866,6 @@ static void start_queue(struct net2280_e
 	(void) readl(&ep->dev->pci->pcimstctl);
 
 	writel(BIT(DMA_START), &dma->dmastat);
-
-	if (!ep->is_in)
-		stop_out_naking(ep);
 }
 
 static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
@@ -907,6 +904,7 @@ static void start_dma(struct net2280_ep
 			writel(BIT(DMA_START), &dma->dmastat);
 			return;
 		}
+		stop_out_naking(ep);
 	}
 
 	tmp = dmactl_default;
@@ -1275,9 +1273,9 @@ static int net2280_dequeue(struct usb_ep
 			break;
 	}
 	if (&req->req != _req) {
+		ep->stopped = stopped;
 		spin_unlock_irqrestore(&ep->dev->lock, flags);
-		dev_err(&ep->dev->pdev->dev, "%s: Request mismatch\n",
-								__func__);
+		ep_dbg(ep->dev, "%s: Request mismatch\n", __func__);
 		return -EINVAL;
 	}
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/usb/host/u132-hcd.c linux-libre-5.0.12-gnu/drivers/usb/host/u132-hcd.c
--- linux-libre-5.0.11-gnu/drivers/usb/host/u132-hcd.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/usb/host/u132-hcd.c	2019-05-04 03:21:23.000000000 -0400
@@ -3202,6 +3202,9 @@ static int __init u132_hcd_init(void)
 	printk(KERN_INFO "driver %s\n", hcd_name);
 	workqueue = create_singlethread_workqueue("u132");
 	retval = platform_driver_register(&u132_platform_driver);
+	if (retval)
+		destroy_workqueue(workqueue);
+
 	return retval;
 }
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/drivers/usb/misc/usb251xb.c linux-libre-5.0.12-gnu/drivers/usb/misc/usb251xb.c
--- linux-libre-5.0.11-gnu/drivers/usb/misc/usb251xb.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/drivers/usb/misc/usb251xb.c	2019-05-04 03:21:23.000000000 -0400
@@ -601,7 +601,7 @@ static int usb251xb_probe(struct usb251x
 							   dev);
 	int err;
 
-	if (np) {
+	if (np && of_id) {
 		err = usb251xb_get_ofdata(hub,
 					  (struct usb251xb_data *)of_id->data);
 		if (err) {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/afs/fsclient.c linux-libre-5.0.12-gnu/fs/afs/fsclient.c
--- linux-libre-5.0.11-gnu/fs/afs/fsclient.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/afs/fsclient.c	2019-05-04 03:21:23.000000000 -0400
@@ -1515,8 +1515,8 @@ static int afs_fs_setattr_size64(struct
 
 	xdr_encode_AFS_StoreStatus(&bp, attr);
 
-	*bp++ = 0;				/* position of start of write */
-	*bp++ = 0;
+	*bp++ = htonl(attr->ia_size >> 32);	/* position of start of write */
+	*bp++ = htonl((u32) attr->ia_size);
 	*bp++ = 0;				/* size of write */
 	*bp++ = 0;
 	*bp++ = htonl(attr->ia_size >> 32);	/* new file length */
@@ -1564,7 +1564,7 @@ static int afs_fs_setattr_size(struct af
 
 	xdr_encode_AFS_StoreStatus(&bp, attr);
 
-	*bp++ = 0;				/* position of start of write */
+	*bp++ = htonl(attr->ia_size);		/* position of start of write */
 	*bp++ = 0;				/* size of write */
 	*bp++ = htonl(attr->ia_size);		/* new file length */
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/afs/yfsclient.c linux-libre-5.0.12-gnu/fs/afs/yfsclient.c
--- linux-libre-5.0.11-gnu/fs/afs/yfsclient.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/afs/yfsclient.c	2019-05-04 03:21:23.000000000 -0400
@@ -1514,7 +1514,7 @@ static int yfs_fs_setattr_size(struct af
 	bp = xdr_encode_u32(bp, 0); /* RPC flags */
 	bp = xdr_encode_YFSFid(bp, &vnode->fid);
 	bp = xdr_encode_YFS_StoreStatus(bp, attr);
-	bp = xdr_encode_u64(bp, 0);		/* position of start of write */
+	bp = xdr_encode_u64(bp, attr->ia_size);	/* position of start of write */
 	bp = xdr_encode_u64(bp, 0);		/* size of write */
 	bp = xdr_encode_u64(bp, attr->ia_size);	/* new file length */
 	yfs_check_req(call, bp);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/btrfs/transaction.c linux-libre-5.0.12-gnu/fs/btrfs/transaction.c
--- linux-libre-5.0.11-gnu/fs/btrfs/transaction.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/btrfs/transaction.c	2019-05-04 03:21:23.000000000 -0400
@@ -1886,8 +1886,10 @@ static void btrfs_cleanup_pending_block_
        }
 }
 
-static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info)
+static inline int btrfs_start_delalloc_flush(struct btrfs_trans_handle *trans)
 {
+	struct btrfs_fs_info *fs_info = trans->fs_info;
+
 	/*
 	 * We use writeback_inodes_sb here because if we used
 	 * btrfs_start_delalloc_roots we would deadlock with fs freeze.
@@ -1897,15 +1899,50 @@ static inline int btrfs_start_delalloc_f
 	 * from already being in a transaction and our join_transaction doesn't
 	 * have to re-take the fs freeze lock.
 	 */
-	if (btrfs_test_opt(fs_info, FLUSHONCOMMIT))
+	if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) {
 		writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC);
+	} else {
+		struct btrfs_pending_snapshot *pending;
+		struct list_head *head = &trans->transaction->pending_snapshots;
+
+		/*
+		 * Flush dellaloc for any root that is going to be snapshotted.
+		 * This is done to avoid a corrupted version of files, in the
+		 * snapshots, that had both buffered and direct IO writes (even
+		 * if they were done sequentially) due to an unordered update of
+		 * the inode's size on disk.
+		 */
+		list_for_each_entry(pending, head, list) {
+			int ret;
+
+			ret = btrfs_start_delalloc_snapshot(pending->root);
+			if (ret)
+				return ret;
+		}
+	}
 	return 0;
 }
 
-static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info)
+static inline void btrfs_wait_delalloc_flush(struct btrfs_trans_handle *trans)
 {
-	if (btrfs_test_opt(fs_info, FLUSHONCOMMIT))
+	struct btrfs_fs_info *fs_info = trans->fs_info;
+
+	if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) {
 		btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
+	} else {
+		struct btrfs_pending_snapshot *pending;
+		struct list_head *head = &trans->transaction->pending_snapshots;
+
+		/*
+		 * Wait for any dellaloc that we started previously for the roots
+		 * that are going to be snapshotted. This is to avoid a corrupted
+		 * version of files in the snapshots that had both buffered and
+		 * direct IO writes (even if they were done sequentially).
+		 */
+		list_for_each_entry(pending, head, list)
+			btrfs_wait_ordered_extents(pending->root,
+						   U64_MAX, 0, U64_MAX);
+	}
 }
 
 int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
@@ -2024,7 +2061,7 @@ int btrfs_commit_transaction(struct btrf
 
 	extwriter_counter_dec(cur_trans, trans->type);
 
-	ret = btrfs_start_delalloc_flush(fs_info);
+	ret = btrfs_start_delalloc_flush(trans);
 	if (ret)
 		goto cleanup_transaction;
 
@@ -2040,7 +2077,7 @@ int btrfs_commit_transaction(struct btrf
 	if (ret)
 		goto cleanup_transaction;
 
-	btrfs_wait_delalloc_flush(fs_info);
+	btrfs_wait_delalloc_flush(trans);
 
 	btrfs_scrub_pause(fs_info);
 	/*
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/ceph/inode.c linux-libre-5.0.12-gnu/fs/ceph/inode.c
--- linux-libre-5.0.11-gnu/fs/ceph/inode.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/ceph/inode.c	2019-05-04 03:21:23.000000000 -0400
@@ -524,6 +524,7 @@ static void ceph_i_callback(struct rcu_h
 	struct inode *inode = container_of(head, struct inode, i_rcu);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 
+	kfree(ci->i_symlink);
 	kmem_cache_free(ceph_inode_cachep, ci);
 }
 
@@ -561,7 +562,6 @@ void ceph_destroy_inode(struct inode *in
 		ceph_put_snap_realm(mdsc, realm);
 	}
 
-	kfree(ci->i_symlink);
 	while ((n = rb_first(&ci->i_fragtree)) != NULL) {
 		frag = rb_entry(n, struct ceph_inode_frag, node);
 		rb_erase(n, &ci->i_fragtree);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/fuse/dev.c linux-libre-5.0.12-gnu/fs/fuse/dev.c
--- linux-libre-5.0.11-gnu/fs/fuse/dev.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/fuse/dev.c	2019-05-04 03:21:23.000000000 -0400
@@ -2034,10 +2034,8 @@ static ssize_t fuse_dev_splice_write(str
 		rem += pipe->bufs[(pipe->curbuf + idx) & (pipe->buffers - 1)].len;
 
 	ret = -EINVAL;
-	if (rem < len) {
-		pipe_unlock(pipe);
-		goto out;
-	}
+	if (rem < len)
+		goto out_free;
 
 	rem = len;
 	while (rem) {
@@ -2055,7 +2053,9 @@ static ssize_t fuse_dev_splice_write(str
 			pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1);
 			pipe->nrbufs--;
 		} else {
-			pipe_buf_get(pipe, ibuf);
+			if (!pipe_buf_get(pipe, ibuf))
+				goto out_free;
+
 			*obuf = *ibuf;
 			obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
 			obuf->len = rem;
@@ -2078,11 +2078,11 @@ static ssize_t fuse_dev_splice_write(str
 	ret = fuse_dev_do_write(fud, &cs, len);
 
 	pipe_lock(pipe);
+out_free:
 	for (idx = 0; idx < nbuf; idx++)
 		pipe_buf_release(pipe, &bufs[idx]);
 	pipe_unlock(pipe);
 
-out:
 	kvfree(bufs);
 	return ret;
 }
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/nfs/client.c linux-libre-5.0.12-gnu/fs/nfs/client.c
--- linux-libre-5.0.11-gnu/fs/nfs/client.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/nfs/client.c	2019-05-04 03:21:23.000000000 -0400
@@ -453,7 +453,7 @@ void nfs_init_timeout_values(struct rpc_
 	case XPRT_TRANSPORT_RDMA:
 		if (retrans == NFS_UNSPEC_RETRANS)
 			to->to_retries = NFS_DEF_TCP_RETRANS;
-		if (timeo == NFS_UNSPEC_TIMEO || to->to_retries == 0)
+		if (timeo == NFS_UNSPEC_TIMEO || to->to_initval == 0)
 			to->to_initval = NFS_DEF_TCP_TIMEO * HZ / 10;
 		if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
 			to->to_initval = NFS_MAX_TCP_TIMEOUT;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/pipe.c linux-libre-5.0.12-gnu/fs/pipe.c
--- linux-libre-5.0.11-gnu/fs/pipe.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/pipe.c	2019-05-04 03:21:23.000000000 -0400
@@ -189,9 +189,9 @@ EXPORT_SYMBOL(generic_pipe_buf_steal);
  *	in the tee() system call, when we duplicate the buffers in one
  *	pipe into another.
  */
-void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
+bool generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
 {
-	get_page(buf->page);
+	return try_get_page(buf->page);
 }
 EXPORT_SYMBOL(generic_pipe_buf_get);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/fs/splice.c linux-libre-5.0.12-gnu/fs/splice.c
--- linux-libre-5.0.11-gnu/fs/splice.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/fs/splice.c	2019-05-04 03:21:23.000000000 -0400
@@ -1588,7 +1588,11 @@ retry:
 			 * Get a reference to this pipe buffer,
 			 * so we can copy the contents over.
 			 */
-			pipe_buf_get(ipipe, ibuf);
+			if (!pipe_buf_get(ipipe, ibuf)) {
+				if (ret == 0)
+					ret = -EFAULT;
+				break;
+			}
 			*obuf = *ibuf;
 
 			/*
@@ -1662,7 +1666,11 @@ static int link_pipe(struct pipe_inode_i
 		 * Get a reference to this pipe buffer,
 		 * so we can copy the contents over.
 		 */
-		pipe_buf_get(ipipe, ibuf);
+		if (!pipe_buf_get(ipipe, ibuf)) {
+			if (ret == 0)
+				ret = -EFAULT;
+			break;
+		}
 
 		obuf = opipe->bufs + nbuf;
 		*obuf = *ibuf;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/include/linux/mm.h linux-libre-5.0.12-gnu/include/linux/mm.h
--- linux-libre-5.0.11-gnu/include/linux/mm.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/include/linux/mm.h	2019-05-04 03:21:23.000000000 -0400
@@ -965,6 +965,10 @@ static inline bool is_pci_p2pdma_page(co
 }
 #endif /* CONFIG_DEV_PAGEMAP_OPS */
 
+/* 127: arbitrary random number, small enough to assemble well */
+#define page_ref_zero_or_close_to_overflow(page) \
+	((unsigned int) page_ref_count(page) + 127u <= 127u)
+
 static inline void get_page(struct page *page)
 {
 	page = compound_head(page);
@@ -972,10 +976,19 @@ static inline void get_page(struct page
 	 * Getting a normal page or the head of a compound page
 	 * requires to already have an elevated page->_refcount.
 	 */
-	VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page);
+	VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page);
 	page_ref_inc(page);
 }
 
+static inline __must_check bool try_get_page(struct page *page)
+{
+	page = compound_head(page);
+	if (WARN_ON_ONCE(page_ref_count(page) <= 0))
+		return false;
+	page_ref_inc(page);
+	return true;
+}
+
 static inline void put_page(struct page *page)
 {
 	page = compound_head(page);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/include/linux/pipe_fs_i.h linux-libre-5.0.12-gnu/include/linux/pipe_fs_i.h
--- linux-libre-5.0.11-gnu/include/linux/pipe_fs_i.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/include/linux/pipe_fs_i.h	2019-05-04 03:21:23.000000000 -0400
@@ -108,18 +108,20 @@ struct pipe_buf_operations {
 	/*
 	 * Get a reference to the pipe buffer.
 	 */
-	void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
+	bool (*get)(struct pipe_inode_info *, struct pipe_buffer *);
 };
 
 /**
  * pipe_buf_get - get a reference to a pipe_buffer
  * @pipe:	the pipe that the buffer belongs to
  * @buf:	the buffer to get a reference to
+ *
+ * Return: %true if the reference was successfully obtained.
  */
-static inline void pipe_buf_get(struct pipe_inode_info *pipe,
+static inline __must_check bool pipe_buf_get(struct pipe_inode_info *pipe,
 				struct pipe_buffer *buf)
 {
-	buf->ops->get(pipe, buf);
+	return buf->ops->get(pipe, buf);
 }
 
 /**
@@ -178,7 +180,7 @@ struct pipe_inode_info *alloc_pipe_info(
 void free_pipe_info(struct pipe_inode_info *);
 
 /* Generic pipe buffer ops functions */
-void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
+bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
 int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
 int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
 int generic_pipe_buf_nosteal(struct pipe_inode_info *, struct pipe_buffer *);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/include/linux/sched/signal.h linux-libre-5.0.12-gnu/include/linux/sched/signal.h
--- linux-libre-5.0.11-gnu/include/linux/sched/signal.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/include/linux/sched/signal.h	2019-05-04 03:21:23.000000000 -0400
@@ -417,10 +417,20 @@ static inline void set_restore_sigmask(v
 	set_thread_flag(TIF_RESTORE_SIGMASK);
 	WARN_ON(!test_thread_flag(TIF_SIGPENDING));
 }
+
+static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
+{
+	clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
+}
+
 static inline void clear_restore_sigmask(void)
 {
 	clear_thread_flag(TIF_RESTORE_SIGMASK);
 }
+static inline bool test_tsk_restore_sigmask(struct task_struct *tsk)
+{
+	return test_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
+}
 static inline bool test_restore_sigmask(void)
 {
 	return test_thread_flag(TIF_RESTORE_SIGMASK);
@@ -438,6 +448,10 @@ static inline void set_restore_sigmask(v
 	current->restore_sigmask = true;
 	WARN_ON(!test_thread_flag(TIF_SIGPENDING));
 }
+static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
+{
+	tsk->restore_sigmask = false;
+}
 static inline void clear_restore_sigmask(void)
 {
 	current->restore_sigmask = false;
@@ -446,6 +460,10 @@ static inline bool test_restore_sigmask(
 {
 	return current->restore_sigmask;
 }
+static inline bool test_tsk_restore_sigmask(struct task_struct *tsk)
+{
+	return tsk->restore_sigmask;
+}
 static inline bool test_and_clear_restore_sigmask(void)
 {
 	if (!current->restore_sigmask)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/include/net/tc_act/tc_gact.h linux-libre-5.0.12-gnu/include/net/tc_act/tc_gact.h
--- linux-libre-5.0.11-gnu/include/net/tc_act/tc_gact.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/include/net/tc_act/tc_gact.h	2019-05-04 03:21:23.000000000 -0400
@@ -56,7 +56,7 @@ static inline bool is_tcf_gact_goto_chai
 
 static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a)
 {
-	return a->goto_chain->index;
+	return READ_ONCE(a->tcfa_action) & TC_ACT_EXT_VAL_MASK;
 }
 
 #endif /* __NET_TC_GACT_H */
diff -druNp --no-dereference linux-libre-5.0.11-gnu/include/net/xdp_sock.h linux-libre-5.0.12-gnu/include/net/xdp_sock.h
--- linux-libre-5.0.11-gnu/include/net/xdp_sock.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/include/net/xdp_sock.h	2019-05-04 03:21:23.000000000 -0400
@@ -36,7 +36,6 @@ struct xdp_umem {
 	u32 headroom;
 	u32 chunk_size_nohr;
 	struct user_struct *user;
-	struct pid *pid;
 	unsigned long address;
 	refcount_t users;
 	struct work_struct work;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/kernel/ptrace.c linux-libre-5.0.12-gnu/kernel/ptrace.c
--- linux-libre-5.0.11-gnu/kernel/ptrace.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/kernel/ptrace.c	2019-05-04 03:21:23.000000000 -0400
@@ -29,6 +29,7 @@
 #include <linux/hw_breakpoint.h>
 #include <linux/cn_proc.h>
 #include <linux/compat.h>
+#include <linux/sched/signal.h>
 
 /*
  * Access another process' address space via ptrace.
@@ -924,18 +925,26 @@ int ptrace_request(struct task_struct *c
 			ret = ptrace_setsiginfo(child, &siginfo);
 		break;
 
-	case PTRACE_GETSIGMASK:
+	case PTRACE_GETSIGMASK: {
+		sigset_t *mask;
+
 		if (addr != sizeof(sigset_t)) {
 			ret = -EINVAL;
 			break;
 		}
 
-		if (copy_to_user(datavp, &child->blocked, sizeof(sigset_t)))
+		if (test_tsk_restore_sigmask(child))
+			mask = &child->saved_sigmask;
+		else
+			mask = &child->blocked;
+
+		if (copy_to_user(datavp, mask, sizeof(sigset_t)))
 			ret = -EFAULT;
 		else
 			ret = 0;
 
 		break;
+	}
 
 	case PTRACE_SETSIGMASK: {
 		sigset_t new_set;
@@ -961,6 +970,8 @@ int ptrace_request(struct task_struct *c
 		child->blocked = new_set;
 		spin_unlock_irq(&child->sighand->siglock);
 
+		clear_tsk_restore_sigmask(child);
+
 		ret = 0;
 		break;
 	}
diff -druNp --no-dereference linux-libre-5.0.11-gnu/kernel/trace/trace.c linux-libre-5.0.12-gnu/kernel/trace/trace.c
--- linux-libre-5.0.11-gnu/kernel/trace/trace.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/kernel/trace/trace.c	2019-05-04 03:21:23.000000000 -0400
@@ -6843,12 +6843,16 @@ static void buffer_pipe_buf_release(stru
 	buf->private = 0;
 }
 
-static void buffer_pipe_buf_get(struct pipe_inode_info *pipe,
+static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
 				struct pipe_buffer *buf)
 {
 	struct buffer_ref *ref = (struct buffer_ref *)buf->private;
 
+	if (refcount_read(&ref->refcount) > INT_MAX/2)
+		return false;
+
 	refcount_inc(&ref->refcount);
+	return true;
 }
 
 /* Pipe buffer operations for a buffer. */
diff -druNp --no-dereference linux-libre-5.0.11-gnu/lib/sbitmap.c linux-libre-5.0.12-gnu/lib/sbitmap.c
--- linux-libre-5.0.11-gnu/lib/sbitmap.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/lib/sbitmap.c	2019-05-04 03:21:23.000000000 -0400
@@ -591,6 +591,17 @@ EXPORT_SYMBOL_GPL(sbitmap_queue_wake_up)
 void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
 			 unsigned int cpu)
 {
+	/*
+	 * Once the clear bit is set, the bit may be allocated out.
+	 *
+	 * Orders READ/WRITE on the asssociated instance(such as request
+	 * of blk_mq) by this bit for avoiding race with re-allocation,
+	 * and its pair is the memory barrier implied in __sbitmap_get_word.
+	 *
+	 * One invariant is that the clear bit has to be zero when the bit
+	 * is in use.
+	 */
+	smp_mb__before_atomic();
 	sbitmap_deferred_clear_bit(&sbq->sb, nr);
 
 	/*
diff -druNp --no-dereference linux-libre-5.0.11-gnu/Makefile linux-libre-5.0.12-gnu/Makefile
--- linux-libre-5.0.11-gnu/Makefile	2019-05-02 14:43:10.000000000 -0400
+++ linux-libre-5.0.12-gnu/Makefile	2019-05-04 04:14:34.000000000 -0400
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
 PATCHLEVEL = 0
-SUBLEVEL = 11
+SUBLEVEL = 12
 EXTRAVERSION = -gnu
 NAME = Shy Crocodile
 
@@ -31,7 +31,7 @@ _all:
 # descending is started. They are now explicitly listed as the
 # prepare rule.
 
-ifneq ($(sub-make-done),1)
+ifneq ($(sub_make_done),1)
 
 # Do not use make's built-in rules and variables
 # (this increases performance and avoids hard-to-debug behaviour)
@@ -159,6 +159,8 @@ need-sub-make := 1
 $(lastword $(MAKEFILE_LIST)): ;
 endif
 
+export sub_make_done := 1
+
 ifeq ($(need-sub-make),1)
 
 PHONY += $(MAKECMDGOALS) sub-make
@@ -168,12 +170,12 @@ $(filter-out _all sub-make $(CURDIR)/Mak
 
 # Invoke a second make in the output directory, passing relevant variables
 sub-make:
-	$(Q)$(MAKE) sub-make-done=1 \
+	$(Q)$(MAKE) \
 	$(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \
 	-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
 
 endif # need-sub-make
-endif # sub-make-done
+endif # sub_make_done
 
 # We process the rest of the Makefile if this is the final invocation of make
 ifeq ($(need-sub-make),)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/mm/gup.c linux-libre-5.0.12-gnu/mm/gup.c
--- linux-libre-5.0.11-gnu/mm/gup.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/mm/gup.c	2019-05-04 03:21:23.000000000 -0400
@@ -157,8 +157,12 @@ retry:
 		goto retry;
 	}
 
-	if (flags & FOLL_GET)
-		get_page(page);
+	if (flags & FOLL_GET) {
+		if (unlikely(!try_get_page(page))) {
+			page = ERR_PTR(-ENOMEM);
+			goto out;
+		}
+	}
 	if (flags & FOLL_TOUCH) {
 		if ((flags & FOLL_WRITE) &&
 		    !pte_dirty(pte) && !PageDirty(page))
@@ -295,7 +299,10 @@ retry_locked:
 			if (pmd_trans_unstable(pmd))
 				ret = -EBUSY;
 		} else {
-			get_page(page);
+			if (unlikely(!try_get_page(page))) {
+				spin_unlock(ptl);
+				return ERR_PTR(-ENOMEM);
+			}
 			spin_unlock(ptl);
 			lock_page(page);
 			ret = split_huge_page(page);
@@ -497,7 +504,10 @@ static int get_gate_page(struct mm_struc
 		if (is_device_public_page(*page))
 			goto unmap;
 	}
-	get_page(*page);
+	if (unlikely(!try_get_page(*page))) {
+		ret = -ENOMEM;
+		goto unmap;
+	}
 out:
 	ret = 0;
 unmap:
@@ -1393,6 +1403,20 @@ static void undo_dev_pagemap(int *nr, in
 	}
 }
 
+/*
+ * Return the compund head page with ref appropriately incremented,
+ * or NULL if that failed.
+ */
+static inline struct page *try_get_compound_head(struct page *page, int refs)
+{
+	struct page *head = compound_head(page);
+	if (WARN_ON_ONCE(page_ref_count(head) < 0))
+		return NULL;
+	if (unlikely(!page_cache_add_speculative(head, refs)))
+		return NULL;
+	return head;
+}
+
 #ifdef CONFIG_ARCH_HAS_PTE_SPECIAL
 static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
 			 int write, struct page **pages, int *nr)
@@ -1427,9 +1451,9 @@ static int gup_pte_range(pmd_t pmd, unsi
 
 		VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
 		page = pte_page(pte);
-		head = compound_head(page);
 
-		if (!page_cache_get_speculative(head))
+		head = try_get_compound_head(page, 1);
+		if (!head)
 			goto pte_unmap;
 
 		if (unlikely(pte_val(pte) != pte_val(*ptep))) {
@@ -1568,8 +1592,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_
 		refs++;
 	} while (addr += PAGE_SIZE, addr != end);
 
-	head = compound_head(pmd_page(orig));
-	if (!page_cache_add_speculative(head, refs)) {
+	head = try_get_compound_head(pmd_page(orig), refs);
+	if (!head) {
 		*nr -= refs;
 		return 0;
 	}
@@ -1606,8 +1630,8 @@ static int gup_huge_pud(pud_t orig, pud_
 		refs++;
 	} while (addr += PAGE_SIZE, addr != end);
 
-	head = compound_head(pud_page(orig));
-	if (!page_cache_add_speculative(head, refs)) {
+	head = try_get_compound_head(pud_page(orig), refs);
+	if (!head) {
 		*nr -= refs;
 		return 0;
 	}
@@ -1643,8 +1667,8 @@ static int gup_huge_pgd(pgd_t orig, pgd_
 		refs++;
 	} while (addr += PAGE_SIZE, addr != end);
 
-	head = compound_head(pgd_page(orig));
-	if (!page_cache_add_speculative(head, refs)) {
+	head = try_get_compound_head(pgd_page(orig), refs);
+	if (!head) {
 		*nr -= refs;
 		return 0;
 	}
diff -druNp --no-dereference linux-libre-5.0.11-gnu/mm/hugetlb.c linux-libre-5.0.12-gnu/mm/hugetlb.c
--- linux-libre-5.0.11-gnu/mm/hugetlb.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/mm/hugetlb.c	2019-05-04 03:21:23.000000000 -0400
@@ -4298,6 +4298,19 @@ long follow_hugetlb_page(struct mm_struc
 
 		pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT;
 		page = pte_page(huge_ptep_get(pte));
+
+		/*
+		 * Instead of doing 'try_get_page()' below in the same_page
+		 * loop, just check the count once here.
+		 */
+		if (unlikely(page_count(page) <= 0)) {
+			if (pages) {
+				spin_unlock(ptl);
+				remainder = 0;
+				err = -ENOMEM;
+				break;
+			}
+		}
 same_page:
 		if (pages) {
 			pages[i] = mem_map_offset(page, pfn_offset);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/mm/kasan/kasan.h linux-libre-5.0.12-gnu/mm/kasan/kasan.h
--- linux-libre-5.0.11-gnu/mm/kasan/kasan.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/mm/kasan/kasan.h	2019-05-04 03:21:23.000000000 -0400
@@ -164,7 +164,10 @@ static inline u8 random_tag(void)
 #endif
 
 #ifndef arch_kasan_set_tag
-#define arch_kasan_set_tag(addr, tag)	((void *)(addr))
+static inline const void *arch_kasan_set_tag(const void *addr, u8 tag)
+{
+	return addr;
+}
 #endif
 #ifndef arch_kasan_reset_tag
 #define arch_kasan_reset_tag(addr)	((void *)(addr))
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/bridge/br_netfilter_hooks.c linux-libre-5.0.12-gnu/net/bridge/br_netfilter_hooks.c
--- linux-libre-5.0.11-gnu/net/bridge/br_netfilter_hooks.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/bridge/br_netfilter_hooks.c	2019-05-04 03:21:23.000000000 -0400
@@ -502,6 +502,7 @@ static unsigned int br_nf_pre_routing(vo
 	nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr;
 
 	skb->protocol = htons(ETH_P_IP);
+	skb->transport_header = skb->network_header + ip_hdr(skb)->ihl * 4;
 
 	NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->net, state->sk, skb,
 		skb->dev, NULL,
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/bridge/br_netfilter_ipv6.c linux-libre-5.0.12-gnu/net/bridge/br_netfilter_ipv6.c
--- linux-libre-5.0.11-gnu/net/bridge/br_netfilter_ipv6.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/bridge/br_netfilter_ipv6.c	2019-05-04 03:21:23.000000000 -0400
@@ -235,6 +235,8 @@ unsigned int br_nf_pre_routing_ipv6(void
 	nf_bridge->ipv6_daddr = ipv6_hdr(skb)->daddr;
 
 	skb->protocol = htons(ETH_P_IPV6);
+	skb->transport_header = skb->network_header + sizeof(struct ipv6hdr);
+
 	NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, state->net, state->sk, skb,
 		skb->dev, NULL,
 		br_nf_pre_routing_finish_ipv6);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/ipv6/netfilter/ip6t_srh.c linux-libre-5.0.12-gnu/net/ipv6/netfilter/ip6t_srh.c
--- linux-libre-5.0.11-gnu/net/ipv6/netfilter/ip6t_srh.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/ipv6/netfilter/ip6t_srh.c	2019-05-04 03:21:23.000000000 -0400
@@ -210,6 +210,8 @@ static bool srh1_mt6(const struct sk_buf
 		psidoff = srhoff + sizeof(struct ipv6_sr_hdr) +
 			  ((srh->segments_left + 1) * sizeof(struct in6_addr));
 		psid = skb_header_pointer(skb, psidoff, sizeof(_psid), &_psid);
+		if (!psid)
+			return false;
 		if (NF_SRH_INVF(srhinfo, IP6T_SRH_INV_PSID,
 				ipv6_masked_addr_cmp(psid, &srhinfo->psid_msk,
 						     &srhinfo->psid_addr)))
@@ -223,6 +225,8 @@ static bool srh1_mt6(const struct sk_buf
 		nsidoff = srhoff + sizeof(struct ipv6_sr_hdr) +
 			  ((srh->segments_left - 1) * sizeof(struct in6_addr));
 		nsid = skb_header_pointer(skb, nsidoff, sizeof(_nsid), &_nsid);
+		if (!nsid)
+			return false;
 		if (NF_SRH_INVF(srhinfo, IP6T_SRH_INV_NSID,
 				ipv6_masked_addr_cmp(nsid, &srhinfo->nsid_msk,
 						     &srhinfo->nsid_addr)))
@@ -233,6 +237,8 @@ static bool srh1_mt6(const struct sk_buf
 	if (srhinfo->mt_flags & IP6T_SRH_LSID) {
 		lsidoff = srhoff + sizeof(struct ipv6_sr_hdr);
 		lsid = skb_header_pointer(skb, lsidoff, sizeof(_lsid), &_lsid);
+		if (!lsid)
+			return false;
 		if (NF_SRH_INVF(srhinfo, IP6T_SRH_INV_LSID,
 				ipv6_masked_addr_cmp(lsid, &srhinfo->lsid_msk,
 						     &srhinfo->lsid_addr)))
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/netfilter/Kconfig linux-libre-5.0.12-gnu/net/netfilter/Kconfig
--- linux-libre-5.0.11-gnu/net/netfilter/Kconfig	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/netfilter/Kconfig	2019-05-04 03:21:23.000000000 -0400
@@ -995,6 +995,7 @@ config NETFILTER_XT_TARGET_TEE
 	depends on NETFILTER_ADVANCED
 	depends on IPV6 || IPV6=n
 	depends on !NF_CONNTRACK || NF_CONNTRACK
+	depends on IP6_NF_IPTABLES || !IP6_NF_IPTABLES
 	select NF_DUP_IPV4
 	select NF_DUP_IPV6 if IP6_NF_IPTABLES
 	---help---
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/netfilter/nft_set_rbtree.c linux-libre-5.0.12-gnu/net/netfilter/nft_set_rbtree.c
--- linux-libre-5.0.11-gnu/net/netfilter/nft_set_rbtree.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/netfilter/nft_set_rbtree.c	2019-05-04 03:21:23.000000000 -0400
@@ -308,10 +308,6 @@ static void *nft_rbtree_deactivate(const
 		else if (d > 0)
 			parent = parent->rb_right;
 		else {
-			if (!nft_set_elem_active(&rbe->ext, genmask)) {
-				parent = parent->rb_left;
-				continue;
-			}
 			if (nft_rbtree_interval_end(rbe) &&
 			    !nft_rbtree_interval_end(this)) {
 				parent = parent->rb_left;
@@ -320,6 +316,9 @@ static void *nft_rbtree_deactivate(const
 				   nft_rbtree_interval_end(this)) {
 				parent = parent->rb_right;
 				continue;
+			} else if (!nft_set_elem_active(&rbe->ext, genmask)) {
+				parent = parent->rb_left;
+				continue;
 			}
 			nft_rbtree_flush(net, set, rbe);
 			return rbe;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/sunrpc/xprtsock.c linux-libre-5.0.12-gnu/net/sunrpc/xprtsock.c
--- linux-libre-5.0.11-gnu/net/sunrpc/xprtsock.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/sunrpc/xprtsock.c	2019-05-04 03:21:23.000000000 -0400
@@ -486,8 +486,8 @@ xs_read_stream_request(struct sock_xprt
 		int flags, struct rpc_rqst *req)
 {
 	struct xdr_buf *buf = &req->rq_private_buf;
-	size_t want, read;
-	ssize_t ret;
+	size_t want, uninitialized_var(read);
+	ssize_t uninitialized_var(ret);
 
 	xs_read_header(transport, buf);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/net/xdp/xdp_umem.c linux-libre-5.0.12-gnu/net/xdp/xdp_umem.c
--- linux-libre-5.0.11-gnu/net/xdp/xdp_umem.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/net/xdp/xdp_umem.c	2019-05-04 03:21:23.000000000 -0400
@@ -189,9 +189,6 @@ static void xdp_umem_unaccount_pages(str
 
 static void xdp_umem_release(struct xdp_umem *umem)
 {
-	struct task_struct *task;
-	struct mm_struct *mm;
-
 	xdp_umem_clear_dev(umem);
 
 	if (umem->fq) {
@@ -208,21 +205,10 @@ static void xdp_umem_release(struct xdp_
 
 	xdp_umem_unpin_pages(umem);
 
-	task = get_pid_task(umem->pid, PIDTYPE_PID);
-	put_pid(umem->pid);
-	if (!task)
-		goto out;
-	mm = get_task_mm(task);
-	put_task_struct(task);
-	if (!mm)
-		goto out;
-
-	mmput(mm);
 	kfree(umem->pages);
 	umem->pages = NULL;
 
 	xdp_umem_unaccount_pages(umem);
-out:
 	kfree(umem);
 }
 
@@ -351,7 +337,6 @@ static int xdp_umem_reg(struct xdp_umem
 	if (size_chk < 0)
 		return -EINVAL;
 
-	umem->pid = get_task_pid(current, PIDTYPE_PID);
 	umem->address = (unsigned long)addr;
 	umem->chunk_mask = ~((u64)chunk_size - 1);
 	umem->size = size;
@@ -367,7 +352,7 @@ static int xdp_umem_reg(struct xdp_umem
 
 	err = xdp_umem_account_pages(umem);
 	if (err)
-		goto out;
+		return err;
 
 	err = xdp_umem_pin_pages(umem);
 	if (err)
@@ -386,8 +371,6 @@ static int xdp_umem_reg(struct xdp_umem
 
 out_account:
 	xdp_umem_unaccount_pages(umem);
-out:
-	put_pid(umem->pid);
 	return err;
 }
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/scripts/kconfig/lxdialog/inputbox.c linux-libre-5.0.12-gnu/scripts/kconfig/lxdialog/inputbox.c
--- linux-libre-5.0.11-gnu/scripts/kconfig/lxdialog/inputbox.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/scripts/kconfig/lxdialog/inputbox.c	2019-05-04 03:21:23.000000000 -0400
@@ -113,7 +113,8 @@ do_resize:
 			case KEY_DOWN:
 				break;
 			case KEY_BACKSPACE:
-			case 127:
+			case 8:   /* ^H */
+			case 127: /* ^? */
 				if (pos) {
 					wattrset(dialog, dlg.inputbox.atr);
 					if (input_x == 0) {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/scripts/kconfig/nconf.c linux-libre-5.0.12-gnu/scripts/kconfig/nconf.c
--- linux-libre-5.0.11-gnu/scripts/kconfig/nconf.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/scripts/kconfig/nconf.c	2019-05-04 03:21:23.000000000 -0400
@@ -1048,7 +1048,7 @@ static int do_match(int key, struct matc
 		state->match_direction = FIND_NEXT_MATCH_UP;
 		*ans = get_mext_match(state->pattern,
 				state->match_direction);
-	} else if (key == KEY_BACKSPACE || key == 127) {
+	} else if (key == KEY_BACKSPACE || key == 8 || key == 127) {
 		state->pattern[strlen(state->pattern)-1] = '\0';
 		adj_match_dir(&state->match_direction);
 	} else
diff -druNp --no-dereference linux-libre-5.0.11-gnu/scripts/kconfig/nconf.gui.c linux-libre-5.0.12-gnu/scripts/kconfig/nconf.gui.c
--- linux-libre-5.0.11-gnu/scripts/kconfig/nconf.gui.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/scripts/kconfig/nconf.gui.c	2019-05-04 03:21:23.000000000 -0400
@@ -439,7 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
 		case KEY_F(F_EXIT):
 		case KEY_F(F_BACK):
 			break;
-		case 127:
+		case 8:   /* ^H */
+		case 127: /* ^? */
 		case KEY_BACKSPACE:
 			if (cursor_position > 0) {
 				memmove(&result[cursor_position-1],
diff -druNp --no-dereference linux-libre-5.0.11-gnu/scripts/selinux/genheaders/genheaders.c linux-libre-5.0.12-gnu/scripts/selinux/genheaders/genheaders.c
--- linux-libre-5.0.11-gnu/scripts/selinux/genheaders/genheaders.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/scripts/selinux/genheaders/genheaders.c	2019-05-04 03:21:23.000000000 -0400
@@ -9,7 +9,6 @@
 #include <string.h>
 #include <errno.h>
 #include <ctype.h>
-#include <sys/socket.h>
 
 struct security_class_mapping {
 	const char *name;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/scripts/selinux/mdp/mdp.c linux-libre-5.0.12-gnu/scripts/selinux/mdp/mdp.c
--- linux-libre-5.0.11-gnu/scripts/selinux/mdp/mdp.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/scripts/selinux/mdp/mdp.c	2019-05-04 03:21:23.000000000 -0400
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/socket.h>
 
 static void usage(char *name)
 {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/security/selinux/include/classmap.h linux-libre-5.0.12-gnu/security/selinux/include/classmap.h
--- linux-libre-5.0.11-gnu/security/selinux/include/classmap.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/security/selinux/include/classmap.h	2019-05-04 03:21:23.000000000 -0400
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/capability.h>
+#include <linux/socket.h>
 
 #define COMMON_FILE_SOCK_PERMS "ioctl", "read", "write", "create", \
     "getattr", "setattr", "lock", "relabelfrom", "relabelto", "append", "map"
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/build/feature/test-libopencsd.c linux-libre-5.0.12-gnu/tools/build/feature/test-libopencsd.c
--- linux-libre-5.0.11-gnu/tools/build/feature/test-libopencsd.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/build/feature/test-libopencsd.c	2019-05-04 03:21:23.000000000 -0400
@@ -4,9 +4,9 @@
 /*
  * Check OpenCSD library version is sufficient to provide required features
  */
-#define OCSD_MIN_VER ((0 << 16) | (10 << 8) | (0))
+#define OCSD_MIN_VER ((0 << 16) | (11 << 8) | (0))
 #if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
-#error "OpenCSD >= 0.10.0 is required"
+#error "OpenCSD >= 0.11.0 is required"
 #endif
 
 int main(void)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c linux-libre-5.0.12-gnu/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
--- linux-libre-5.0.11-gnu/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c	2019-05-04 03:21:23.000000000 -0400
@@ -374,6 +374,7 @@ cs_etm_decoder__buffer_range(struct cs_e
 		break;
 	case OCSD_INSTR_ISB:
 	case OCSD_INSTR_DSB_DMB:
+	case OCSD_INSTR_WFI_WFE:
 	case OCSD_INSTR_OTHER:
 	default:
 		packet->last_instr_taken_branch = false;
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/perf/util/machine.c linux-libre-5.0.12-gnu/tools/perf/util/machine.c
--- linux-libre-5.0.11-gnu/tools/perf/util/machine.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/perf/util/machine.c	2019-05-04 03:21:23.000000000 -0400
@@ -1358,6 +1358,20 @@ static void machine__set_kernel_mmap(str
 		machine->vmlinux_map->end = ~0ULL;
 }
 
+static void machine__update_kernel_mmap(struct machine *machine,
+				     u64 start, u64 end)
+{
+	struct map *map = machine__kernel_map(machine);
+
+	map__get(map);
+	map_groups__remove(&machine->kmaps, map);
+
+	machine__set_kernel_mmap(machine, start, end);
+
+	map_groups__insert(&machine->kmaps, map);
+	map__put(map);
+}
+
 int machine__create_kernel_maps(struct machine *machine)
 {
 	struct dso *kernel = machine__get_kernel(machine);
@@ -1390,17 +1404,11 @@ int machine__create_kernel_maps(struct m
 			goto out_put;
 		}
 
-		/* we have a real start address now, so re-order the kmaps */
-		map = machine__kernel_map(machine);
-
-		map__get(map);
-		map_groups__remove(&machine->kmaps, map);
-
-		/* assume it's the last in the kmaps */
-		machine__set_kernel_mmap(machine, addr, ~0ULL);
-
-		map_groups__insert(&machine->kmaps, map);
-		map__put(map);
+		/*
+		 * we have a real start address now, so re-order the kmaps
+		 * assume it's the last in the kmaps
+		 */
+		machine__update_kernel_mmap(machine, addr, ~0ULL);
 	}
 
 	if (machine__create_extra_kernel_maps(machine, kernel))
@@ -1536,7 +1544,7 @@ static int machine__process_kernel_mmap_
 		if (strstr(kernel->long_name, "vmlinux"))
 			dso__set_short_name(kernel, "[kernel.vmlinux]", false);
 
-		machine__set_kernel_mmap(machine, event->mmap.start,
+		machine__update_kernel_mmap(machine, event->mmap.start,
 					 event->mmap.start + event->mmap.len);
 
 		/*
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/include/kvm_util.h linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/include/kvm_util.h
--- linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/include/kvm_util.h	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/include/kvm_util.h	2019-05-04 03:21:23.000000000 -0400
@@ -102,6 +102,7 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *v
 struct kvm_run *vcpu_state(struct kvm_vm *vm, uint32_t vcpuid);
 void vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
 int _vcpu_run(struct kvm_vm *vm, uint32_t vcpuid);
+void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid);
 void vcpu_set_mp_state(struct kvm_vm *vm, uint32_t vcpuid,
 		       struct kvm_mp_state *mp_state);
 void vcpu_regs_get(struct kvm_vm *vm, uint32_t vcpuid, struct kvm_regs *regs);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/lib/kvm_util.c linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/lib/kvm_util.c
--- linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/lib/kvm_util.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/lib/kvm_util.c	2019-05-04 03:21:23.000000000 -0400
@@ -1121,6 +1121,22 @@ int _vcpu_run(struct kvm_vm *vm, uint32_
 	return rc;
 }
 
+void vcpu_run_complete_io(struct kvm_vm *vm, uint32_t vcpuid)
+{
+	struct vcpu *vcpu = vcpu_find(vm, vcpuid);
+	int ret;
+
+	TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid);
+
+	vcpu->state->immediate_exit = 1;
+	ret = ioctl(vcpu->fd, KVM_RUN, NULL);
+	vcpu->state->immediate_exit = 0;
+
+	TEST_ASSERT(ret == -1 && errno == EINTR,
+		    "KVM_RUN IOCTL didn't exit immediately, rc: %i, errno: %i",
+		    ret, errno);
+}
+
 /*
  * VM VCPU Set MP State
  *
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/Makefile linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/Makefile
--- linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/Makefile	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/Makefile	2019-05-04 03:21:23.000000000 -0400
@@ -28,8 +28,8 @@ LIBKVM += $(LIBKVM_$(UNAME_M))
 INSTALL_HDR_PATH = $(top_srcdir)/usr
 LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
 LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include
-CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I..
-LDFLAGS += -pthread
+CFLAGS += -O2 -g -std=gnu99 -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude -I$(<D) -Iinclude/$(UNAME_M) -I..
+LDFLAGS += -pthread -no-pie
 
 # After inclusion, $(OUTPUT) is defined and
 # $(TEST_GEN_PROGS) starts with $(OUTPUT)/
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c
--- linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/x86_64/cr4_cpuid_sync_test.c	2019-05-04 03:21:23.000000000 -0400
@@ -87,22 +87,25 @@ int main(int argc, char *argv[])
 	while (1) {
 		rc = _vcpu_run(vm, VCPU_ID);
 
-		if (run->exit_reason == KVM_EXIT_IO) {
-			switch (get_ucall(vm, VCPU_ID, &uc)) {
-			case UCALL_SYNC:
-				/* emulate hypervisor clearing CR4.OSXSAVE */
-				vcpu_sregs_get(vm, VCPU_ID, &sregs);
-				sregs.cr4 &= ~X86_CR4_OSXSAVE;
-				vcpu_sregs_set(vm, VCPU_ID, &sregs);
-				break;
-			case UCALL_ABORT:
-				TEST_ASSERT(false, "Guest CR4 bit (OSXSAVE) unsynchronized with CPUID bit.");
-				break;
-			case UCALL_DONE:
-				goto done;
-			default:
-				TEST_ASSERT(false, "Unknown ucall 0x%x.", uc.cmd);
-			}
+		TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
+			    "Unexpected exit reason: %u (%s),\n",
+			    run->exit_reason,
+			    exit_reason_str(run->exit_reason));
+
+		switch (get_ucall(vm, VCPU_ID, &uc)) {
+		case UCALL_SYNC:
+			/* emulate hypervisor clearing CR4.OSXSAVE */
+			vcpu_sregs_get(vm, VCPU_ID, &sregs);
+			sregs.cr4 &= ~X86_CR4_OSXSAVE;
+			vcpu_sregs_set(vm, VCPU_ID, &sregs);
+			break;
+		case UCALL_ABORT:
+			TEST_ASSERT(false, "Guest CR4 bit (OSXSAVE) unsynchronized with CPUID bit.");
+			break;
+		case UCALL_DONE:
+			goto done;
+		default:
+			TEST_ASSERT(false, "Unknown ucall 0x%x.", uc.cmd);
 		}
 	}
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/x86_64/state_test.c linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/x86_64/state_test.c
--- linux-libre-5.0.11-gnu/tools/testing/selftests/kvm/x86_64/state_test.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/tools/testing/selftests/kvm/x86_64/state_test.c	2019-05-04 03:21:23.000000000 -0400
@@ -134,6 +134,11 @@ int main(int argc, char *argv[])
 
 	struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(1);
 
+	if (!kvm_check_cap(KVM_CAP_IMMEDIATE_EXIT)) {
+		fprintf(stderr, "immediate_exit not available, skipping test\n");
+		exit(KSFT_SKIP);
+	}
+
 	/* Create VM */
 	vm = vm_create_default(VCPU_ID, 0, guest_code);
 	vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
@@ -156,8 +161,6 @@ int main(int argc, char *argv[])
 			    stage, run->exit_reason,
 			    exit_reason_str(run->exit_reason));
 
-		memset(&regs1, 0, sizeof(regs1));
-		vcpu_regs_get(vm, VCPU_ID, &regs1);
 		switch (get_ucall(vm, VCPU_ID, &uc)) {
 		case UCALL_ABORT:
 			TEST_ASSERT(false, "%s at %s:%d", (const char *)uc.args[0],
@@ -176,6 +179,17 @@ int main(int argc, char *argv[])
 			    uc.args[1] == stage, "Unexpected register values vmexit #%lx, got %lx",
 			    stage, (ulong)uc.args[1]);
 
+		/*
+		 * When KVM exits to userspace with KVM_EXIT_IO, KVM guarantees
+		 * guest state is consistent only after userspace re-enters the
+		 * kernel with KVM_RUN.  Complete IO prior to migrating state
+		 * to a new VM.
+		 */
+		vcpu_run_complete_io(vm, VCPU_ID);
+
+		memset(&regs1, 0, sizeof(regs1));
+		vcpu_regs_get(vm, VCPU_ID, &regs1);
+
 		state = vcpu_save_state(vm, VCPU_ID);
 		kvm_vm_release(vm);
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/virt/kvm/arm/hyp/vgic-v3-sr.c linux-libre-5.0.12-gnu/virt/kvm/arm/hyp/vgic-v3-sr.c
--- linux-libre-5.0.11-gnu/virt/kvm/arm/hyp/vgic-v3-sr.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/virt/kvm/arm/hyp/vgic-v3-sr.c	2019-05-04 03:21:23.000000000 -0400
@@ -222,7 +222,7 @@ void __hyp_text __vgic_v3_save_state(str
 		}
 	}
 
-	if (used_lrs) {
+	if (used_lrs || cpu_if->its_vpe.its_vm) {
 		int i;
 		u32 elrsr;
 
@@ -247,7 +247,7 @@ void __hyp_text __vgic_v3_restore_state(
 	u64 used_lrs = vcpu->arch.vgic_cpu.used_lrs;
 	int i;
 
-	if (used_lrs) {
+	if (used_lrs || cpu_if->its_vpe.its_vm) {
 		write_gicreg(cpu_if->vgic_hcr, ICH_HCR_EL2);
 
 		for (i = 0; i < used_lrs; i++)
diff -druNp --no-dereference linux-libre-5.0.11-gnu/virt/kvm/arm/mmu.c linux-libre-5.0.12-gnu/virt/kvm/arm/mmu.c
--- linux-libre-5.0.11-gnu/virt/kvm/arm/mmu.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/virt/kvm/arm/mmu.c	2019-05-04 03:21:23.000000000 -0400
@@ -1060,25 +1060,43 @@ static int stage2_set_pmd_huge(struct kv
 {
 	pmd_t *pmd, old_pmd;
 
+retry:
 	pmd = stage2_get_pmd(kvm, cache, addr);
 	VM_BUG_ON(!pmd);
 
 	old_pmd = *pmd;
+	/*
+	 * Multiple vcpus faulting on the same PMD entry, can
+	 * lead to them sequentially updating the PMD with the
+	 * same value. Following the break-before-make
+	 * (pmd_clear() followed by tlb_flush()) process can
+	 * hinder forward progress due to refaults generated
+	 * on missing translations.
+	 *
+	 * Skip updating the page table if the entry is
+	 * unchanged.
+	 */
+	if (pmd_val(old_pmd) == pmd_val(*new_pmd))
+		return 0;
+
 	if (pmd_present(old_pmd)) {
 		/*
-		 * Multiple vcpus faulting on the same PMD entry, can
-		 * lead to them sequentially updating the PMD with the
-		 * same value. Following the break-before-make
-		 * (pmd_clear() followed by tlb_flush()) process can
-		 * hinder forward progress due to refaults generated
-		 * on missing translations.
+		 * If we already have PTE level mapping for this block,
+		 * we must unmap it to avoid inconsistent TLB state and
+		 * leaking the table page. We could end up in this situation
+		 * if the memory slot was marked for dirty logging and was
+		 * reverted, leaving PTE level mappings for the pages accessed
+		 * during the period. So, unmap the PTE level mapping for this
+		 * block and retry, as we could have released the upper level
+		 * table in the process.
 		 *
-		 * Skip updating the page table if the entry is
-		 * unchanged.
+		 * Normal THP split/merge follows mmu_notifier callbacks and do
+		 * get handled accordingly.
 		 */
-		if (pmd_val(old_pmd) == pmd_val(*new_pmd))
-			return 0;
-
+		if (!pmd_thp_or_huge(old_pmd)) {
+			unmap_stage2_range(kvm, addr & S2_PMD_MASK, S2_PMD_SIZE);
+			goto retry;
+		}
 		/*
 		 * Mapping in huge pages should only happen through a
 		 * fault.  If a page is merged into a transparent huge
@@ -1090,8 +1108,7 @@ static int stage2_set_pmd_huge(struct kv
 		 * should become splitting first, unmapped, merged,
 		 * and mapped back in on-demand.
 		 */
-		VM_BUG_ON(pmd_pfn(old_pmd) != pmd_pfn(*new_pmd));
-
+		WARN_ON_ONCE(pmd_pfn(old_pmd) != pmd_pfn(*new_pmd));
 		pmd_clear(pmd);
 		kvm_tlb_flush_vmid_ipa(kvm, addr);
 	} else {
@@ -1107,6 +1124,7 @@ static int stage2_set_pud_huge(struct kv
 {
 	pud_t *pudp, old_pud;
 
+retry:
 	pudp = stage2_get_pud(kvm, cache, addr);
 	VM_BUG_ON(!pudp);
 
@@ -1114,14 +1132,23 @@ static int stage2_set_pud_huge(struct kv
 
 	/*
 	 * A large number of vcpus faulting on the same stage 2 entry,
-	 * can lead to a refault due to the
-	 * stage2_pud_clear()/tlb_flush(). Skip updating the page
-	 * tables if there is no change.
+	 * can lead to a refault due to the stage2_pud_clear()/tlb_flush().
+	 * Skip updating the page tables if there is no change.
 	 */
 	if (pud_val(old_pud) == pud_val(*new_pudp))
 		return 0;
 
 	if (stage2_pud_present(kvm, old_pud)) {
+		/*
+		 * If we already have table level mapping for this block, unmap
+		 * the range for this block and retry.
+		 */
+		if (!stage2_pud_huge(kvm, old_pud)) {
+			unmap_stage2_range(kvm, addr & S2_PUD_MASK, S2_PUD_SIZE);
+			goto retry;
+		}
+
+		WARN_ON_ONCE(kvm_pud_pfn(old_pud) != kvm_pud_pfn(*new_pudp));
 		stage2_pud_clear(kvm, pudp);
 		kvm_tlb_flush_vmid_ipa(kvm, addr);
 	} else {
diff -druNp --no-dereference linux-libre-5.0.11-gnu/virt/kvm/arm/vgic/vgic.c linux-libre-5.0.12-gnu/virt/kvm/arm/vgic/vgic.c
--- linux-libre-5.0.11-gnu/virt/kvm/arm/vgic/vgic.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/virt/kvm/arm/vgic/vgic.c	2019-05-04 03:21:23.000000000 -0400
@@ -867,15 +867,21 @@ void kvm_vgic_flush_hwstate(struct kvm_v
 	 * either observe the new interrupt before or after doing this check,
 	 * and introducing additional synchronization mechanism doesn't change
 	 * this.
+	 *
+	 * Note that we still need to go through the whole thing if anything
+	 * can be directly injected (GICv4).
 	 */
-	if (list_empty(&vcpu->arch.vgic_cpu.ap_list_head))
+	if (list_empty(&vcpu->arch.vgic_cpu.ap_list_head) &&
+	    !vgic_supports_direct_msis(vcpu->kvm))
 		return;
 
 	DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
 
-	raw_spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock);
-	vgic_flush_lr_state(vcpu);
-	raw_spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock);
+	if (!list_empty(&vcpu->arch.vgic_cpu.ap_list_head)) {
+		raw_spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock);
+		vgic_flush_lr_state(vcpu);
+		raw_spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock);
+	}
 
 	if (can_access_vgic_from_kernel())
 		vgic_restore_state(vcpu);
diff -druNp --no-dereference linux-libre-5.0.11-gnu/virt/kvm/arm/vgic/vgic-its.c linux-libre-5.0.12-gnu/virt/kvm/arm/vgic/vgic-its.c
--- linux-libre-5.0.11-gnu/virt/kvm/arm/vgic/vgic-its.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/virt/kvm/arm/vgic/vgic-its.c	2019-05-04 03:21:23.000000000 -0400
@@ -754,8 +754,9 @@ static bool vgic_its_check_id(struct vgi
 	u64 indirect_ptr, type = GITS_BASER_TYPE(baser);
 	phys_addr_t base = GITS_BASER_ADDR_48_to_52(baser);
 	int esz = GITS_BASER_ENTRY_SIZE(baser);
-	int index;
+	int index, idx;
 	gfn_t gfn;
+	bool ret;
 
 	switch (type) {
 	case GITS_BASER_TYPE_DEVICE:
@@ -782,7 +783,8 @@ static bool vgic_its_check_id(struct vgi
 
 		if (eaddr)
 			*eaddr = addr;
-		return kvm_is_visible_gfn(its->dev->kvm, gfn);
+
+		goto out;
 	}
 
 	/* calculate and check the index into the 1st level */
@@ -812,7 +814,12 @@ static bool vgic_its_check_id(struct vgi
 
 	if (eaddr)
 		*eaddr = indirect_ptr;
-	return kvm_is_visible_gfn(its->dev->kvm, gfn);
+
+out:
+	idx = srcu_read_lock(&its->dev->kvm->srcu);
+	ret = kvm_is_visible_gfn(its->dev->kvm, gfn);
+	srcu_read_unlock(&its->dev->kvm->srcu, idx);
+	return ret;
 }
 
 static int vgic_its_alloc_collection(struct vgic_its *its,
@@ -1919,7 +1926,7 @@ static int vgic_its_save_ite(struct vgic
 	       ((u64)ite->irq->intid << KVM_ITS_ITE_PINTID_SHIFT) |
 		ite->collection->collection_id;
 	val = cpu_to_le64(val);
-	return kvm_write_guest(kvm, gpa, &val, ite_esz);
+	return kvm_write_guest_lock(kvm, gpa, &val, ite_esz);
 }
 
 /**
@@ -2066,7 +2073,7 @@ static int vgic_its_save_dte(struct vgic
 	       (itt_addr_field << KVM_ITS_DTE_ITTADDR_SHIFT) |
 		(dev->num_eventid_bits - 1));
 	val = cpu_to_le64(val);
-	return kvm_write_guest(kvm, ptr, &val, dte_esz);
+	return kvm_write_guest_lock(kvm, ptr, &val, dte_esz);
 }
 
 /**
@@ -2246,7 +2253,7 @@ static int vgic_its_save_cte(struct vgic
 	       ((u64)collection->target_addr << KVM_ITS_CTE_RDBASE_SHIFT) |
 	       collection->collection_id);
 	val = cpu_to_le64(val);
-	return kvm_write_guest(its->dev->kvm, gpa, &val, esz);
+	return kvm_write_guest_lock(its->dev->kvm, gpa, &val, esz);
 }
 
 static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz)
@@ -2317,7 +2324,7 @@ static int vgic_its_save_collection_tabl
 	 */
 	val = 0;
 	BUG_ON(cte_esz > sizeof(val));
-	ret = kvm_write_guest(its->dev->kvm, gpa, &val, cte_esz);
+	ret = kvm_write_guest_lock(its->dev->kvm, gpa, &val, cte_esz);
 	return ret;
 }
 
diff -druNp --no-dereference linux-libre-5.0.11-gnu/virt/kvm/arm/vgic/vgic-v3.c linux-libre-5.0.12-gnu/virt/kvm/arm/vgic/vgic-v3.c
--- linux-libre-5.0.11-gnu/virt/kvm/arm/vgic/vgic-v3.c	2019-05-02 04:02:58.000000000 -0400
+++ linux-libre-5.0.12-gnu/virt/kvm/arm/vgic/vgic-v3.c	2019-05-04 03:21:23.000000000 -0400
@@ -358,7 +358,7 @@ retry:
 	if (status) {
 		/* clear consumed data */
 		val &= ~(1 << bit_nr);
-		ret = kvm_write_guest(kvm, ptr, &val, 1);
+		ret = kvm_write_guest_lock(kvm, ptr, &val, 1);
 		if (ret)
 			return ret;
 	}
@@ -409,7 +409,7 @@ int vgic_v3_save_pending_tables(struct k
 		else
 			val &= ~(1 << bit_nr);
 
-		ret = kvm_write_guest(kvm, ptr, &val, 1);
+		ret = kvm_write_guest_lock(kvm, ptr, &val, 1);
 		if (ret)
 			return ret;
 	}
