diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm/boot/dts/dra7.dtsi linux-libre-4.4.160-gnu/arch/arm/boot/dts/dra7.dtsi
--- linux-libre-4.4.159-gnu/arch/arm/boot/dts/dra7.dtsi	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm/boot/dts/dra7.dtsi	2018-10-10 02:52:13.000000000 -0400
@@ -1549,7 +1549,7 @@
 			};
 		};
 
-		dcan1: can@481cc000 {
+		dcan1: can@4ae3c000 {
 			compatible = "ti,dra7-d_can";
 			ti,hwmods = "dcan1";
 			reg = <0x4ae3c000 0x2000>;
@@ -1559,7 +1559,7 @@
 			status = "disabled";
 		};
 
-		dcan2: can@481d0000 {
+		dcan2: can@48480000 {
 			compatible = "ti,dra7-d_can";
 			ti,hwmods = "dcan2";
 			reg = <0x48480000 0x2000>;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm/mach-mvebu/pmsu.c linux-libre-4.4.160-gnu/arch/arm/mach-mvebu/pmsu.c
--- linux-libre-4.4.159-gnu/arch/arm/mach-mvebu/pmsu.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm/mach-mvebu/pmsu.c	2018-10-10 02:52:13.000000000 -0400
@@ -117,8 +117,8 @@ void mvebu_pmsu_set_cpu_boot_addr(int hw
 		PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
 }
 
-extern unsigned char mvebu_boot_wa_start;
-extern unsigned char mvebu_boot_wa_end;
+extern unsigned char mvebu_boot_wa_start[];
+extern unsigned char mvebu_boot_wa_end[];
 
 /*
  * This function sets up the boot address workaround needed for SMP
@@ -131,7 +131,7 @@ int mvebu_setup_boot_addr_wa(unsigned in
 			     phys_addr_t resume_addr_reg)
 {
 	void __iomem *sram_virt_base;
-	u32 code_len = &mvebu_boot_wa_end - &mvebu_boot_wa_start;
+	u32 code_len = mvebu_boot_wa_end - mvebu_boot_wa_start;
 
 	mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
 	mvebu_mbus_add_window_by_id(crypto_eng_target, crypto_eng_attribute,
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm64/include/asm/cpufeature.h linux-libre-4.4.160-gnu/arch/arm64/include/asm/cpufeature.h
--- linux-libre-4.4.159-gnu/arch/arm64/include/asm/cpufeature.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm64/include/asm/cpufeature.h	2018-10-10 02:52:13.000000000 -0400
@@ -31,8 +31,9 @@
 #define ARM64_WORKAROUND_CAVIUM_23154		6
 #define ARM64_WORKAROUND_834220			7
 #define ARM64_WORKAROUND_CAVIUM_27456		8
+#define ARM64_HAS_32BIT_EL0			9
 
-#define ARM64_NCAPS				9
+#define ARM64_NCAPS				10
 
 #ifndef __ASSEMBLY__
 
@@ -180,6 +181,11 @@ static inline bool cpu_supports_mixed_en
 	return id_aa64mmfr0_mixed_endian_el0(read_cpuid(ID_AA64MMFR0_EL1));
 }
 
+static inline bool system_supports_32bit_el0(void)
+{
+	return cpus_have_cap(ARM64_HAS_32BIT_EL0);
+}
+
 static inline bool system_supports_mixed_endian_el0(void)
 {
 	return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm64/include/asm/jump_label.h linux-libre-4.4.160-gnu/arch/arm64/include/asm/jump_label.h
--- linux-libre-4.4.159-gnu/arch/arm64/include/asm/jump_label.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm64/include/asm/jump_label.h	2018-10-10 02:52:13.000000000 -0400
@@ -28,7 +28,7 @@
 
 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
 {
-	asm goto("1: nop\n\t"
+	asm_volatile_goto("1: nop\n\t"
 		 ".pushsection __jump_table,  \"aw\"\n\t"
 		 ".align 3\n\t"
 		 ".quad 1b, %l[l_yes], %c0\n\t"
@@ -42,7 +42,7 @@ l_yes:
 
 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
 {
-	asm goto("1: b %l[l_yes]\n\t"
+	asm_volatile_goto("1: b %l[l_yes]\n\t"
 		 ".pushsection __jump_table,  \"aw\"\n\t"
 		 ".align 3\n\t"
 		 ".quad 1b, %l[l_yes], %c0\n\t"
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm64/include/asm/kvm_emulate.h linux-libre-4.4.160-gnu/arch/arm64/include/asm/kvm_emulate.h
--- linux-libre-4.4.159-gnu/arch/arm64/include/asm/kvm_emulate.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm64/include/asm/kvm_emulate.h	2018-10-10 02:52:13.000000000 -0400
@@ -41,6 +41,11 @@ void kvm_inject_undefined(struct kvm_vcp
 void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
 void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
 
+static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu)
+{
+	return !(vcpu->arch.hcr_el2 & HCR_RW);
+}
+
 static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
 {
 	vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm64/include/asm/sysreg.h linux-libre-4.4.160-gnu/arch/arm64/include/asm/sysreg.h
--- linux-libre-4.4.159-gnu/arch/arm64/include/asm/sysreg.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm64/include/asm/sysreg.h	2018-10-10 02:52:13.000000000 -0400
@@ -109,6 +109,7 @@
 #define ID_AA64PFR0_ASIMD_SUPPORTED	0x0
 #define ID_AA64PFR0_EL1_64BIT_ONLY	0x1
 #define ID_AA64PFR0_EL0_64BIT_ONLY	0x1
+#define ID_AA64PFR0_EL0_32BIT_64BIT	0x2
 
 /* id_aa64mmfr0 */
 #define ID_AA64MMFR0_TGRAN4_SHIFT	28
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm64/kernel/cpufeature.c linux-libre-4.4.160-gnu/arch/arm64/kernel/cpufeature.c
--- linux-libre-4.4.159-gnu/arch/arm64/kernel/cpufeature.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm64/kernel/cpufeature.c	2018-10-10 02:52:13.000000000 -0400
@@ -653,6 +653,14 @@ static const struct arm64_cpu_capabiliti
 		.min_field_value = 2,
 	},
 #endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
+	{
+		.desc = "32-bit EL0 Support",
+		.capability = ARM64_HAS_32BIT_EL0,
+		.matches = has_cpuid_feature,
+		.sys_reg = SYS_ID_AA64PFR0_EL1,
+		.field_pos = ID_AA64PFR0_EL0_SHIFT,
+		.min_field_value = ID_AA64PFR0_EL0_32BIT_64BIT,
+	},
 	{},
 };
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/arm64/kvm/guest.c linux-libre-4.4.160-gnu/arch/arm64/kvm/guest.c
--- linux-libre-4.4.159-gnu/arch/arm64/kvm/guest.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/arm64/kvm/guest.c	2018-10-10 02:52:13.000000000 -0400
@@ -48,6 +48,45 @@ static u64 core_reg_offset_from_id(u64 i
 	return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
 }
 
+static int validate_core_offset(const struct kvm_one_reg *reg)
+{
+	u64 off = core_reg_offset_from_id(reg->id);
+	int size;
+
+	switch (off) {
+	case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...
+	     KVM_REG_ARM_CORE_REG(regs.regs[30]):
+	case KVM_REG_ARM_CORE_REG(regs.sp):
+	case KVM_REG_ARM_CORE_REG(regs.pc):
+	case KVM_REG_ARM_CORE_REG(regs.pstate):
+	case KVM_REG_ARM_CORE_REG(sp_el1):
+	case KVM_REG_ARM_CORE_REG(elr_el1):
+	case KVM_REG_ARM_CORE_REG(spsr[0]) ...
+	     KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):
+		size = sizeof(__u64);
+		break;
+
+	case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
+	     KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
+		size = sizeof(__uint128_t);
+		break;
+
+	case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
+	case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
+		size = sizeof(__u32);
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	if (KVM_REG_SIZE(reg->id) == size &&
+	    IS_ALIGNED(off, size / sizeof(__u32)))
+		return 0;
+
+	return -EINVAL;
+}
+
 static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
 {
 	/*
@@ -67,6 +106,9 @@ static int get_core_reg(struct kvm_vcpu
 	    (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
 		return -ENOENT;
 
+	if (validate_core_offset(reg))
+		return -EINVAL;
+
 	if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))
 		return -EFAULT;
 
@@ -89,6 +131,9 @@ static int set_core_reg(struct kvm_vcpu
 	    (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
 		return -ENOENT;
 
+	if (validate_core_offset(reg))
+		return -EINVAL;
+
 	if (KVM_REG_SIZE(reg->id) > sizeof(tmp))
 		return -EINVAL;
 
@@ -98,17 +143,25 @@ static int set_core_reg(struct kvm_vcpu
 	}
 
 	if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) {
-		u32 mode = (*(u32 *)valp) & COMPAT_PSR_MODE_MASK;
+		u64 mode = (*(u64 *)valp) & COMPAT_PSR_MODE_MASK;
 		switch (mode) {
 		case COMPAT_PSR_MODE_USR:
+			if (!system_supports_32bit_el0())
+				return -EINVAL;
+			break;
 		case COMPAT_PSR_MODE_FIQ:
 		case COMPAT_PSR_MODE_IRQ:
 		case COMPAT_PSR_MODE_SVC:
 		case COMPAT_PSR_MODE_ABT:
 		case COMPAT_PSR_MODE_UND:
+			if (!vcpu_el1_is_32bit(vcpu))
+				return -EINVAL;
+			break;
 		case PSR_MODE_EL0t:
 		case PSR_MODE_EL1t:
 		case PSR_MODE_EL1h:
+			if (vcpu_el1_is_32bit(vcpu))
+				return -EINVAL;
 			break;
 		default:
 			err = -EINVAL;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/hexagon/include/asm/bitops.h linux-libre-4.4.160-gnu/arch/hexagon/include/asm/bitops.h
--- linux-libre-4.4.159-gnu/arch/hexagon/include/asm/bitops.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/hexagon/include/asm/bitops.h	2018-10-10 02:52:13.000000000 -0400
@@ -211,7 +211,7 @@ static inline long ffz(int x)
  * This is defined the same way as ffs.
  * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
  */
-static inline long fls(int x)
+static inline int fls(int x)
 {
 	int r;
 
@@ -232,7 +232,7 @@ static inline long fls(int x)
  * the libc and compiler builtin ffs routines, therefore
  * differs in spirit from the above ffz (man ffs).
  */
-static inline long ffs(int x)
+static inline int ffs(int x)
 {
 	int r;
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/hexagon/kernel/dma.c linux-libre-4.4.160-gnu/arch/hexagon/kernel/dma.c
--- linux-libre-4.4.159-gnu/arch/hexagon/kernel/dma.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/hexagon/kernel/dma.c	2018-10-10 02:52:13.000000000 -0400
@@ -68,7 +68,7 @@ static void *hexagon_dma_alloc_coherent(
 			panic("Can't create %s() memory pool!", __func__);
 		else
 			gen_pool_add(coherent_pool,
-				pfn_to_virt(max_low_pfn),
+				(unsigned long)pfn_to_virt(max_low_pfn),
 				hexagon_coherent_pool_size, -1);
 	}
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/powerpc/kernel/machine_kexec.c linux-libre-4.4.160-gnu/arch/powerpc/kernel/machine_kexec.c
--- linux-libre-4.4.159-gnu/arch/powerpc/kernel/machine_kexec.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/powerpc/kernel/machine_kexec.c	2018-10-10 02:52:13.000000000 -0400
@@ -186,7 +186,12 @@ void __init reserve_crashkernel(void)
 			(unsigned long)(crashk_res.start >> 20),
 			(unsigned long)(memblock_phys_mem_size() >> 20));
 
-	memblock_reserve(crashk_res.start, crash_size);
+	if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
+	    memblock_reserve(crashk_res.start, crash_size)) {
+		pr_err("Failed to reserve memory for crashkernel!\n");
+		crashk_res.start = crashk_res.end = 0;
+		return;
+	}
 }
 
 int overlaps_crashkernel(unsigned long start, unsigned long size)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/powerpc/kvm/book3s_64_mmu_hv.c linux-libre-4.4.160-gnu/arch/powerpc/kvm/book3s_64_mmu_hv.c
--- linux-libre-4.4.159-gnu/arch/powerpc/kvm/book3s_64_mmu_hv.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/powerpc/kvm/book3s_64_mmu_hv.c	2018-10-10 02:52:13.000000000 -0400
@@ -314,7 +314,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate
 	unsigned long pp, key;
 	unsigned long v, gr;
 	__be64 *hptep;
-	int index;
+	long int index;
 	int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR);
 
 	/* Get SLB entry */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/powerpc/platforms/powernv/pci-ioda.c linux-libre-4.4.160-gnu/arch/powerpc/platforms/powernv/pci-ioda.c
--- linux-libre-4.4.159-gnu/arch/powerpc/platforms/powernv/pci-ioda.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/powerpc/platforms/powernv/pci-ioda.c	2018-10-10 02:52:13.000000000 -0400
@@ -2270,7 +2270,7 @@ static long pnv_pci_ioda2_table_alloc_pa
 	level_shift = entries_shift + 3;
 	level_shift = max_t(unsigned, level_shift, PAGE_SHIFT);
 
-	if ((level_shift - 3) * levels + page_shift >= 60)
+	if ((level_shift - 3) * levels + page_shift >= 55)
 		return -EINVAL;
 
 	/* Allocate TCE table */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/s390/mm/extmem.c linux-libre-4.4.160-gnu/arch/s390/mm/extmem.c
--- linux-libre-4.4.159-gnu/arch/s390/mm/extmem.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/s390/mm/extmem.c	2018-10-10 02:52:13.000000000 -0400
@@ -79,7 +79,7 @@ struct qin64 {
 struct dcss_segment {
 	struct list_head list;
 	char dcss_name[8];
-	char res_name[15];
+	char res_name[16];
 	unsigned long start_addr;
 	unsigned long end;
 	atomic_t ref_count;
@@ -434,7 +434,7 @@ __segment_load (char *name, int do_nonsh
 	memcpy(&seg->res_name, seg->dcss_name, 8);
 	EBCASC(seg->res_name, 8);
 	seg->res_name[8] = '\0';
-	strncat(seg->res_name, " (DCSS)", 7);
+	strlcat(seg->res_name, " (DCSS)", sizeof(seg->res_name));
 	seg->res->name = seg->res_name;
 	rc = seg->vm_segtype;
 	if (rc == SEG_TYPE_SC ||
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/x86/entry/entry_64.S linux-libre-4.4.160-gnu/arch/x86/entry/entry_64.S
--- linux-libre-4.4.159-gnu/arch/x86/entry/entry_64.S	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/x86/entry/entry_64.S	2018-10-10 02:52:13.000000000 -0400
@@ -90,7 +90,7 @@ ENDPROC(native_usergs_sysret64)
 .endm
 
 .macro TRACE_IRQS_IRETQ_DEBUG
-	bt	$9, EFLAGS(%rsp)		/* interrupts off? */
+	btl	$9, EFLAGS(%rsp)		/* interrupts off? */
 	jnc	1f
 	TRACE_IRQS_ON_DEBUG
 1:
@@ -620,7 +620,7 @@ retint_kernel:
 #ifdef CONFIG_PREEMPT
 	/* Interrupts are off */
 	/* Check if we need preemption */
-	bt	$9, EFLAGS(%rsp)		/* were interrupts off? */
+	btl	$9, EFLAGS(%rsp)		/* were interrupts off? */
 	jnc	1f
 0:	cmpl	$0, PER_CPU_VAR(__preempt_count)
 	jnz	1f
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/x86/kernel/tsc_msr.c linux-libre-4.4.160-gnu/arch/x86/kernel/tsc_msr.c
--- linux-libre-4.4.159-gnu/arch/x86/kernel/tsc_msr.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/x86/kernel/tsc_msr.c	2018-10-10 02:52:13.000000000 -0400
@@ -21,6 +21,7 @@
 #include <asm/setup.h>
 #include <asm/apic.h>
 #include <asm/param.h>
+#include <asm/tsc.h>
 
 /* CPU reference clock frequency: in KHz */
 #define FREQ_83		83200
diff -druNp --no-dereference linux-libre-4.4.159-gnu/arch/x86/mm/numa_emulation.c linux-libre-4.4.160-gnu/arch/x86/mm/numa_emulation.c
--- linux-libre-4.4.159-gnu/arch/x86/mm/numa_emulation.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/arch/x86/mm/numa_emulation.c	2018-10-10 02:52:13.000000000 -0400
@@ -60,7 +60,7 @@ static int __init emu_setup_memblk(struc
 	eb->nid = nid;
 
 	if (emu_nid_to_phys[nid] == NUMA_NO_NODE)
-		emu_nid_to_phys[nid] = nid;
+		emu_nid_to_phys[nid] = pb->nid;
 
 	pb->start += size;
 	if (pb->start >= pb->end) {
diff -druNp --no-dereference linux-libre-4.4.159-gnu/crypto/ablkcipher.c linux-libre-4.4.160-gnu/crypto/ablkcipher.c
--- linux-libre-4.4.159-gnu/crypto/ablkcipher.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/crypto/ablkcipher.c	2018-10-10 02:52:13.000000000 -0400
@@ -384,6 +384,7 @@ static int crypto_ablkcipher_report(stru
 	strncpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type));
 	strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>",
 		sizeof(rblkcipher.geniv));
+	rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0';
 
 	rblkcipher.blocksize = alg->cra_blocksize;
 	rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
@@ -465,6 +466,7 @@ static int crypto_givcipher_report(struc
 	strncpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type));
 	strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>",
 		sizeof(rblkcipher.geniv));
+	rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0';
 
 	rblkcipher.blocksize = alg->cra_blocksize;
 	rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/crypto/blkcipher.c linux-libre-4.4.160-gnu/crypto/blkcipher.c
--- linux-libre-4.4.159-gnu/crypto/blkcipher.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/crypto/blkcipher.c	2018-10-10 02:52:13.000000000 -0400
@@ -515,6 +515,7 @@ static int crypto_blkcipher_report(struc
 	strncpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type));
 	strncpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>",
 		sizeof(rblkcipher.geniv));
+	rblkcipher.geniv[sizeof(rblkcipher.geniv) - 1] = '\0';
 
 	rblkcipher.blocksize = alg->cra_blocksize;
 	rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/Documentation/hwmon/ina2xx linux-libre-4.4.160-gnu/Documentation/hwmon/ina2xx
--- linux-libre-4.4.159-gnu/Documentation/hwmon/ina2xx	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/Documentation/hwmon/ina2xx	2018-10-10 02:52:13.000000000 -0400
@@ -32,7 +32,7 @@ Supported chips:
     Datasheet: Publicly available at the Texas Instruments website
                http://www.ti.com/
 
-Author: Lothar Felten <l-felten@ti.com>
+Author: Lothar Felten <lothar.felten@gmail.com>
 
 Description
 -----------
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/block/floppy.c linux-libre-4.4.160-gnu/drivers/block/floppy.c
--- linux-libre-4.4.159-gnu/drivers/block/floppy.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/block/floppy.c	2018-10-10 02:52:13.000000000 -0400
@@ -3459,6 +3459,9 @@ static int fd_locked_ioctl(struct block_
 					  (struct floppy_struct **)&outparam);
 		if (ret)
 			return ret;
+		memcpy(&inparam.g, outparam,
+				offsetof(struct floppy_struct, name));
+		outparam = &inparam.g;
 		break;
 	case FDMSGON:
 		UDP->flags |= FTD_MSG;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/bluetooth/btusb.c linux-libre-4.4.160-gnu/drivers/bluetooth/btusb.c
--- linux-libre-4.4.159-gnu/drivers/bluetooth/btusb.c	2018-09-29 11:37:32.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/bluetooth/btusb.c	2018-10-10 12:41:00.000000000 -0400
@@ -340,6 +340,7 @@ static const struct usb_device_id blackl
 	{ USB_DEVICE(0x7392, 0xa611), .driver_info = BTUSB_REALTEK },
 
 	/* Additional Realtek 8723DE Bluetooth devices */
+	{ USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK },
 	{ USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK },
 
 	/* Additional Realtek 8821AE Bluetooth devices */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/crypto/mxs-dcp.c linux-libre-4.4.160-gnu/drivers/crypto/mxs-dcp.c
--- linux-libre-4.4.159-gnu/drivers/crypto/mxs-dcp.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/crypto/mxs-dcp.c	2018-10-10 02:52:13.000000000 -0400
@@ -63,7 +63,7 @@ struct dcp {
 	struct dcp_coherent_block	*coh;
 
 	struct completion		completion[DCP_MAX_CHANS];
-	struct mutex			mutex[DCP_MAX_CHANS];
+	spinlock_t			lock[DCP_MAX_CHANS];
 	struct task_struct		*thread[DCP_MAX_CHANS];
 	struct crypto_queue		queue[DCP_MAX_CHANS];
 };
@@ -349,13 +349,20 @@ static int dcp_chan_thread_aes(void *dat
 
 	int ret;
 
-	do {
-		__set_current_state(TASK_INTERRUPTIBLE);
+	while (!kthread_should_stop()) {
+		set_current_state(TASK_INTERRUPTIBLE);
 
-		mutex_lock(&sdcp->mutex[chan]);
+		spin_lock(&sdcp->lock[chan]);
 		backlog = crypto_get_backlog(&sdcp->queue[chan]);
 		arq = crypto_dequeue_request(&sdcp->queue[chan]);
-		mutex_unlock(&sdcp->mutex[chan]);
+		spin_unlock(&sdcp->lock[chan]);
+
+		if (!backlog && !arq) {
+			schedule();
+			continue;
+		}
+
+		set_current_state(TASK_RUNNING);
 
 		if (backlog)
 			backlog->complete(backlog, -EINPROGRESS);
@@ -363,11 +370,8 @@ static int dcp_chan_thread_aes(void *dat
 		if (arq) {
 			ret = mxs_dcp_aes_block_crypt(arq);
 			arq->complete(arq, ret);
-			continue;
 		}
-
-		schedule();
-	} while (!kthread_should_stop());
+	}
 
 	return 0;
 }
@@ -407,9 +411,9 @@ static int mxs_dcp_aes_enqueue(struct ab
 	rctx->ecb = ecb;
 	actx->chan = DCP_CHAN_CRYPTO;
 
-	mutex_lock(&sdcp->mutex[actx->chan]);
+	spin_lock(&sdcp->lock[actx->chan]);
 	ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
-	mutex_unlock(&sdcp->mutex[actx->chan]);
+	spin_unlock(&sdcp->lock[actx->chan]);
 
 	wake_up_process(sdcp->thread[actx->chan]);
 
@@ -645,13 +649,20 @@ static int dcp_chan_thread_sha(void *dat
 	struct ahash_request *req;
 	int ret, fini;
 
-	do {
-		__set_current_state(TASK_INTERRUPTIBLE);
+	while (!kthread_should_stop()) {
+		set_current_state(TASK_INTERRUPTIBLE);
 
-		mutex_lock(&sdcp->mutex[chan]);
+		spin_lock(&sdcp->lock[chan]);
 		backlog = crypto_get_backlog(&sdcp->queue[chan]);
 		arq = crypto_dequeue_request(&sdcp->queue[chan]);
-		mutex_unlock(&sdcp->mutex[chan]);
+		spin_unlock(&sdcp->lock[chan]);
+
+		if (!backlog && !arq) {
+			schedule();
+			continue;
+		}
+
+		set_current_state(TASK_RUNNING);
 
 		if (backlog)
 			backlog->complete(backlog, -EINPROGRESS);
@@ -663,12 +674,8 @@ static int dcp_chan_thread_sha(void *dat
 			ret = dcp_sha_req_to_buf(arq);
 			fini = rctx->fini;
 			arq->complete(arq, ret);
-			if (!fini)
-				continue;
 		}
-
-		schedule();
-	} while (!kthread_should_stop());
+	}
 
 	return 0;
 }
@@ -726,9 +733,9 @@ static int dcp_sha_update_fx(struct ahas
 		rctx->init = 1;
 	}
 
-	mutex_lock(&sdcp->mutex[actx->chan]);
+	spin_lock(&sdcp->lock[actx->chan]);
 	ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
-	mutex_unlock(&sdcp->mutex[actx->chan]);
+	spin_unlock(&sdcp->lock[actx->chan]);
 
 	wake_up_process(sdcp->thread[actx->chan]);
 	mutex_unlock(&actx->mutex);
@@ -984,7 +991,7 @@ static int mxs_dcp_probe(struct platform
 	platform_set_drvdata(pdev, sdcp);
 
 	for (i = 0; i < DCP_MAX_CHANS; i++) {
-		mutex_init(&sdcp->mutex[i]);
+		spin_lock_init(&sdcp->lock[i]);
 		init_completion(&sdcp->completion[i]);
 		crypto_init_queue(&sdcp->queue[i], 50);
 	}
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/edac/i7core_edac.c linux-libre-4.4.160-gnu/drivers/edac/i7core_edac.c
--- linux-libre-4.4.159-gnu/drivers/edac/i7core_edac.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/edac/i7core_edac.c	2018-10-10 02:52:13.000000000 -0400
@@ -1187,15 +1187,14 @@ static int i7core_create_sysfs_devices(s
 
 	rc = device_add(pvt->addrmatch_dev);
 	if (rc < 0)
-		return rc;
+		goto err_put_addrmatch;
 
 	if (!pvt->is_registered) {
 		pvt->chancounts_dev = kzalloc(sizeof(*pvt->chancounts_dev),
 					      GFP_KERNEL);
 		if (!pvt->chancounts_dev) {
-			put_device(pvt->addrmatch_dev);
-			device_del(pvt->addrmatch_dev);
-			return -ENOMEM;
+			rc = -ENOMEM;
+			goto err_del_addrmatch;
 		}
 
 		pvt->chancounts_dev->type = &all_channel_counts_type;
@@ -1209,9 +1208,18 @@ static int i7core_create_sysfs_devices(s
 
 		rc = device_add(pvt->chancounts_dev);
 		if (rc < 0)
-			return rc;
+			goto err_put_chancounts;
 	}
 	return 0;
+
+err_put_chancounts:
+	put_device(pvt->chancounts_dev);
+err_del_addrmatch:
+	device_del(pvt->addrmatch_dev);
+err_put_addrmatch:
+	put_device(pvt->addrmatch_dev);
+
+	return rc;
 }
 
 static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci)
@@ -1221,11 +1229,11 @@ static void i7core_delete_sysfs_devices(
 	edac_dbg(1, "\n");
 
 	if (!pvt->is_registered) {
-		put_device(pvt->chancounts_dev);
 		device_del(pvt->chancounts_dev);
+		put_device(pvt->chancounts_dev);
 	}
-	put_device(pvt->addrmatch_dev);
 	device_del(pvt->addrmatch_dev);
+	put_device(pvt->addrmatch_dev);
 }
 
 /****************************************************************************
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/gpio/gpio-adp5588.c linux-libre-4.4.160-gnu/drivers/gpio/gpio-adp5588.c
--- linux-libre-4.4.159-gnu/drivers/gpio/gpio-adp5588.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/gpio/gpio-adp5588.c	2018-10-10 02:52:13.000000000 -0400
@@ -41,6 +41,8 @@ struct adp5588_gpio {
 	uint8_t int_en[3];
 	uint8_t irq_mask[3];
 	uint8_t irq_stat[3];
+	uint8_t int_input_en[3];
+	uint8_t int_lvl_cached[3];
 };
 
 static int adp5588_gpio_read(struct i2c_client *client, u8 reg)
@@ -177,12 +179,28 @@ static void adp5588_irq_bus_sync_unlock(
 	struct adp5588_gpio *dev = irq_data_get_irq_chip_data(d);
 	int i;
 
-	for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++)
+	for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) {
+		if (dev->int_input_en[i]) {
+			mutex_lock(&dev->lock);
+			dev->dir[i] &= ~dev->int_input_en[i];
+			dev->int_input_en[i] = 0;
+			adp5588_gpio_write(dev->client, GPIO_DIR1 + i,
+					   dev->dir[i]);
+			mutex_unlock(&dev->lock);
+		}
+
+		if (dev->int_lvl_cached[i] != dev->int_lvl[i]) {
+			dev->int_lvl_cached[i] = dev->int_lvl[i];
+			adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + i,
+					   dev->int_lvl[i]);
+		}
+
 		if (dev->int_en[i] ^ dev->irq_mask[i]) {
 			dev->int_en[i] = dev->irq_mask[i];
 			adp5588_gpio_write(dev->client, GPIO_INT_EN1 + i,
 					   dev->int_en[i]);
 		}
+	}
 
 	mutex_unlock(&dev->irq_lock);
 }
@@ -225,9 +243,7 @@ static int adp5588_irq_set_type(struct i
 	else
 		return -EINVAL;
 
-	adp5588_gpio_direction_input(&dev->gpio_chip, gpio);
-	adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + bank,
-			   dev->int_lvl[bank]);
+	dev->int_input_en[bank] |= bit;
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c linux-libre-4.4.160-gnu/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
--- linux-libre-4.4.159-gnu/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c	2018-10-10 02:52:13.000000000 -0400
@@ -161,7 +161,8 @@ gm204_devinit_post(struct nvkm_devinit *
 	}
 
 	/* load and execute some other ucode image (bios therm?) */
-	return pmu_load(init, 0x01, post, NULL, NULL);
+	pmu_load(init, 0x01, post, NULL, NULL);
+	return 0;
 }
 
 static const struct nvkm_devinit_func
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/hid/hid-ntrig.c linux-libre-4.4.160-gnu/drivers/hid/hid-ntrig.c
--- linux-libre-4.4.159-gnu/drivers/hid/hid-ntrig.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/hid/hid-ntrig.c	2018-10-10 02:52:13.000000000 -0400
@@ -955,6 +955,8 @@ static int ntrig_probe(struct hid_device
 
 	ret = sysfs_create_group(&hdev->dev.kobj,
 			&ntrig_attribute_group);
+	if (ret)
+		hid_err(hdev, "cannot create sysfs group\n");
 
 	return 0;
 err_free:
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/hwmon/adt7475.c linux-libre-4.4.160-gnu/drivers/hwmon/adt7475.c
--- linux-libre-4.4.159-gnu/drivers/hwmon/adt7475.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/hwmon/adt7475.c	2018-10-10 02:52:13.000000000 -0400
@@ -274,14 +274,18 @@ static inline u16 volt2reg(int channel,
 	return clamp_val(reg, 0, 1023) & (0xff << 2);
 }
 
-static u16 adt7475_read_word(struct i2c_client *client, int reg)
+static int adt7475_read_word(struct i2c_client *client, int reg)
 {
-	u16 val;
+	int val1, val2;
 
-	val = i2c_smbus_read_byte_data(client, reg);
-	val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8);
+	val1 = i2c_smbus_read_byte_data(client, reg);
+	if (val1 < 0)
+		return val1;
+	val2 = i2c_smbus_read_byte_data(client, reg + 1);
+	if (val2 < 0)
+		return val2;
 
-	return val;
+	return val1 | (val2 << 8);
 }
 
 static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/hwmon/ina2xx.c linux-libre-4.4.160-gnu/drivers/hwmon/ina2xx.c
--- linux-libre-4.4.159-gnu/drivers/hwmon/ina2xx.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/hwmon/ina2xx.c	2018-10-10 02:52:13.000000000 -0400
@@ -17,7 +17,7 @@
  * Bi-directional Current/Power Monitor with I2C Interface
  * Datasheet: http://www.ti.com/product/ina230
  *
- * Copyright (C) 2012 Lothar Felten <l-felten@ti.com>
+ * Copyright (C) 2012 Lothar Felten <lothar.felten@gmail.com>
  * Thanks to Jan Volkering
  *
  * This program is free software; you can redistribute it and/or modify
@@ -328,6 +328,15 @@ static int ina2xx_set_shunt(struct ina2x
 	return 0;
 }
 
+static ssize_t ina2xx_show_shunt(struct device *dev,
+			      struct device_attribute *da,
+			      char *buf)
+{
+	struct ina2xx_data *data = dev_get_drvdata(dev);
+
+	return snprintf(buf, PAGE_SIZE, "%li\n", data->rshunt);
+}
+
 static ssize_t ina2xx_store_shunt(struct device *dev,
 				  struct device_attribute *da,
 				  const char *buf, size_t count)
@@ -402,7 +411,7 @@ static SENSOR_DEVICE_ATTR(power1_input,
 
 /* shunt resistance */
 static SENSOR_DEVICE_ATTR(shunt_resistor, S_IRUGO | S_IWUSR,
-			  ina2xx_show_value, ina2xx_store_shunt,
+			  ina2xx_show_shunt, ina2xx_store_shunt,
 			  INA2XX_CALIBRATION);
 
 /* update interval (ina226 only) */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/i2c/busses/i2c-i801.c linux-libre-4.4.160-gnu/drivers/i2c/busses/i2c-i801.c
--- linux-libre-4.4.159-gnu/drivers/i2c/busses/i2c-i801.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/i2c/busses/i2c-i801.c	2018-10-10 02:52:13.000000000 -0400
@@ -1272,6 +1272,13 @@ static void i801_add_tco(struct i801_pri
 }
 
 #ifdef CONFIG_ACPI
+static bool i801_acpi_is_smbus_ioport(const struct i801_priv *priv,
+				      acpi_physical_address address)
+{
+	return address >= priv->smba &&
+	       address <= pci_resource_end(priv->pci_dev, SMBBAR);
+}
+
 static acpi_status
 i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
 		     u64 *value, void *handler_context, void *region_context)
@@ -1287,7 +1294,7 @@ i801_acpi_io_handler(u32 function, acpi_
 	 */
 	mutex_lock(&priv->acpi_lock);
 
-	if (!priv->acpi_reserved) {
+	if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) {
 		priv->acpi_reserved = true;
 
 		dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n");
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/i2c/busses/i2c-uniphier.c linux-libre-4.4.160-gnu/drivers/i2c/busses/i2c-uniphier.c
--- linux-libre-4.4.159-gnu/drivers/i2c/busses/i2c-uniphier.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/i2c/busses/i2c-uniphier.c	2018-10-10 02:52:13.000000000 -0400
@@ -247,11 +247,8 @@ static int uniphier_i2c_master_xfer(stru
 		return ret;
 
 	for (msg = msgs; msg < emsg; msg++) {
-		/* If next message is read, skip the stop condition */
-		bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
-		/* but, force it if I2C_M_STOP is set */
-		if (msg->flags & I2C_M_STOP)
-			stop = true;
+		/* Emit STOP if it is the last message or I2C_M_STOP is set. */
+		bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
 
 		ret = uniphier_i2c_master_xfer_one(adap, msg, stop);
 		if (ret)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/i2c/busses/i2c-uniphier-f.c linux-libre-4.4.160-gnu/drivers/i2c/busses/i2c-uniphier-f.c
--- linux-libre-4.4.159-gnu/drivers/i2c/busses/i2c-uniphier-f.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/i2c/busses/i2c-uniphier-f.c	2018-10-10 02:52:13.000000000 -0400
@@ -394,11 +394,8 @@ static int uniphier_fi2c_master_xfer(str
 		return ret;
 
 	for (msg = msgs; msg < emsg; msg++) {
-		/* If next message is read, skip the stop condition */
-		bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
-		/* but, force it if I2C_M_STOP is set */
-		if (msg->flags & I2C_M_STOP)
-			stop = true;
+		/* Emit STOP if it is the last message or I2C_M_STOP is set. */
+		bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
 
 		ret = uniphier_fi2c_master_xfer_one(adap, msg, stop);
 		if (ret)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/infiniband/core/ucma.c linux-libre-4.4.160-gnu/drivers/infiniband/core/ucma.c
--- linux-libre-4.4.159-gnu/drivers/infiniband/core/ucma.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/infiniband/core/ucma.c	2018-10-10 02:52:13.000000000 -0400
@@ -123,6 +123,8 @@ static DEFINE_MUTEX(mut);
 static DEFINE_IDR(ctx_idr);
 static DEFINE_IDR(multicast_idr);
 
+static const struct file_operations ucma_fops;
+
 static inline struct ucma_context *_ucma_find_context(int id,
 						      struct ucma_file *file)
 {
@@ -1535,6 +1537,10 @@ static ssize_t ucma_migrate_id(struct uc
 	f = fdget(cmd.fd);
 	if (!f.file)
 		return -ENOENT;
+	if (f.file->f_op != &ucma_fops) {
+		ret = -EINVAL;
+		goto file_put;
+	}
 
 	/* Validate current fd and prevent destruction of id. */
 	ctx = ucma_get_ctx(f.file->private_data, cmd.id);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/infiniband/ulp/srp/ib_srp.c linux-libre-4.4.160-gnu/drivers/infiniband/ulp/srp/ib_srp.c
--- linux-libre-4.4.159-gnu/drivers/infiniband/ulp/srp/ib_srp.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/infiniband/ulp/srp/ib_srp.c	2018-10-10 02:52:13.000000000 -0400
@@ -2594,7 +2594,7 @@ static int srp_reset_device(struct scsi_
 {
 	struct srp_target_port *target = host_to_target(scmnd->device->host);
 	struct srp_rdma_ch *ch;
-	int i;
+	int i, j;
 	u8 status;
 
 	shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
@@ -2608,8 +2608,8 @@ static int srp_reset_device(struct scsi_
 
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		for (i = 0; i < target->req_ring_size; ++i) {
-			struct srp_request *req = &ch->req_ring[i];
+		for (j = 0; j < target->req_ring_size; ++j) {
+			struct srp_request *req = &ch->req_ring[j];
 
 			srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
 		}
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/input/mouse/elantech.c linux-libre-4.4.160-gnu/drivers/input/mouse/elantech.c
--- linux-libre-4.4.159-gnu/drivers/input/mouse/elantech.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/input/mouse/elantech.c	2018-10-10 02:52:13.000000000 -0400
@@ -1180,6 +1180,8 @@ static const struct dmi_system_id elante
 static const char * const middle_button_pnp_ids[] = {
 	"LEN2131", /* ThinkPad P52 w/ NFC */
 	"LEN2132", /* ThinkPad P52 */
+	"LEN2133", /* ThinkPad P72 w/ NFC */
+	"LEN2134", /* ThinkPad P72 */
 	NULL
 };
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/md/dm-thin.c linux-libre-4.4.160-gnu/drivers/md/dm-thin.c
--- linux-libre-4.4.159-gnu/drivers/md/dm-thin.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/md/dm-thin.c	2018-10-10 02:52:13.000000000 -0400
@@ -200,7 +200,13 @@ struct dm_thin_new_mapping;
 enum pool_mode {
 	PM_WRITE,		/* metadata may be changed */
 	PM_OUT_OF_DATA_SPACE,	/* metadata may be changed, though data may not be allocated */
+
+	/*
+	 * Like READ_ONLY, except may switch back to WRITE on metadata resize. Reported as READ_ONLY.
+	 */
+	PM_OUT_OF_METADATA_SPACE,
 	PM_READ_ONLY,		/* metadata may not be changed */
+
 	PM_FAIL,		/* all I/O fails */
 };
 
@@ -1301,7 +1307,35 @@ static void set_pool_mode(struct pool *p
 
 static void requeue_bios(struct pool *pool);
 
-static void check_for_space(struct pool *pool)
+static bool is_read_only_pool_mode(enum pool_mode mode)
+{
+	return (mode == PM_OUT_OF_METADATA_SPACE || mode == PM_READ_ONLY);
+}
+
+static bool is_read_only(struct pool *pool)
+{
+	return is_read_only_pool_mode(get_pool_mode(pool));
+}
+
+static void check_for_metadata_space(struct pool *pool)
+{
+	int r;
+	const char *ooms_reason = NULL;
+	dm_block_t nr_free;
+
+	r = dm_pool_get_free_metadata_block_count(pool->pmd, &nr_free);
+	if (r)
+		ooms_reason = "Could not get free metadata blocks";
+	else if (!nr_free)
+		ooms_reason = "No free metadata blocks";
+
+	if (ooms_reason && !is_read_only(pool)) {
+		DMERR("%s", ooms_reason);
+		set_pool_mode(pool, PM_OUT_OF_METADATA_SPACE);
+	}
+}
+
+static void check_for_data_space(struct pool *pool)
 {
 	int r;
 	dm_block_t nr_free;
@@ -1327,14 +1361,16 @@ static int commit(struct pool *pool)
 {
 	int r;
 
-	if (get_pool_mode(pool) >= PM_READ_ONLY)
+	if (get_pool_mode(pool) >= PM_OUT_OF_METADATA_SPACE)
 		return -EINVAL;
 
 	r = dm_pool_commit_metadata(pool->pmd);
 	if (r)
 		metadata_operation_failed(pool, "dm_pool_commit_metadata", r);
-	else
-		check_for_space(pool);
+	else {
+		check_for_metadata_space(pool);
+		check_for_data_space(pool);
+	}
 
 	return r;
 }
@@ -1400,6 +1436,19 @@ static int alloc_data_block(struct thin_
 		return r;
 	}
 
+	r = dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks);
+	if (r) {
+		metadata_operation_failed(pool, "dm_pool_get_free_metadata_block_count", r);
+		return r;
+	}
+
+	if (!free_blocks) {
+		/* Let's commit before we use up the metadata reserve. */
+		r = commit(pool);
+		if (r)
+			return r;
+	}
+
 	return 0;
 }
 
@@ -1431,6 +1480,7 @@ static int should_error_unserviceable_bi
 	case PM_OUT_OF_DATA_SPACE:
 		return pool->pf.error_if_no_space ? -ENOSPC : 0;
 
+	case PM_OUT_OF_METADATA_SPACE:
 	case PM_READ_ONLY:
 	case PM_FAIL:
 		return -EIO;
@@ -2401,8 +2451,9 @@ static void set_pool_mode(struct pool *p
 		error_retry_list(pool);
 		break;
 
+	case PM_OUT_OF_METADATA_SPACE:
 	case PM_READ_ONLY:
-		if (old_mode != new_mode)
+		if (!is_read_only_pool_mode(old_mode))
 			notify_of_pool_mode_change(pool, "read-only");
 		dm_pool_metadata_read_only(pool->pmd);
 		pool->process_bio = process_bio_read_only;
@@ -3333,6 +3384,10 @@ static int maybe_resize_metadata_dev(str
 		DMINFO("%s: growing the metadata device from %llu to %llu blocks",
 		       dm_device_name(pool->pool_md),
 		       sb_metadata_dev_size, metadata_dev_size);
+
+		if (get_pool_mode(pool) == PM_OUT_OF_METADATA_SPACE)
+			set_pool_mode(pool, PM_WRITE);
+
 		r = dm_pool_resize_metadata_dev(pool->pmd, metadata_dev_size);
 		if (r) {
 			metadata_operation_failed(pool, "dm_pool_resize_metadata_dev", r);
@@ -3636,7 +3691,7 @@ static int pool_message(struct dm_target
 	struct pool_c *pt = ti->private;
 	struct pool *pool = pt->pool;
 
-	if (get_pool_mode(pool) >= PM_READ_ONLY) {
+	if (get_pool_mode(pool) >= PM_OUT_OF_METADATA_SPACE) {
 		DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode",
 		      dm_device_name(pool->pool_md));
 		return -EOPNOTSUPP;
@@ -3710,6 +3765,7 @@ static void pool_status(struct dm_target
 	dm_block_t nr_blocks_data;
 	dm_block_t nr_blocks_metadata;
 	dm_block_t held_root;
+	enum pool_mode mode;
 	char buf[BDEVNAME_SIZE];
 	char buf2[BDEVNAME_SIZE];
 	struct pool_c *pt = ti->private;
@@ -3780,9 +3836,10 @@ static void pool_status(struct dm_target
 		else
 			DMEMIT("- ");
 
-		if (pool->pf.mode == PM_OUT_OF_DATA_SPACE)
+		mode = get_pool_mode(pool);
+		if (mode == PM_OUT_OF_DATA_SPACE)
 			DMEMIT("out_of_data_space ");
-		else if (pool->pf.mode == PM_READ_ONLY)
+		else if (is_read_only_pool_mode(mode))
 			DMEMIT("ro ");
 		else
 			DMEMIT("rw ");
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/md/dm-thin-metadata.c linux-libre-4.4.160-gnu/drivers/md/dm-thin-metadata.c
--- linux-libre-4.4.159-gnu/drivers/md/dm-thin-metadata.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/md/dm-thin-metadata.c	2018-10-10 02:52:13.000000000 -0400
@@ -190,6 +190,12 @@ struct dm_pool_metadata {
 	sector_t data_block_size;
 
 	/*
+	 * We reserve a section of the metadata for commit overhead.
+	 * All reported space does *not* include this.
+	 */
+	dm_block_t metadata_reserve;
+
+	/*
 	 * Set if a transaction has to be aborted but the attempt to roll back
 	 * to the previous (good) transaction failed.  The only pool metadata
 	 * operation possible in this state is the closing of the device.
@@ -827,6 +833,20 @@ static int __commit_transaction(struct d
 	return dm_tm_commit(pmd->tm, sblock);
 }
 
+static void __set_metadata_reserve(struct dm_pool_metadata *pmd)
+{
+	int r;
+	dm_block_t total;
+	dm_block_t max_blocks = 4096; /* 16M */
+
+	r = dm_sm_get_nr_blocks(pmd->metadata_sm, &total);
+	if (r) {
+		DMERR("could not get size of metadata device");
+		pmd->metadata_reserve = max_blocks;
+	} else
+		pmd->metadata_reserve = min(max_blocks, div_u64(total, 10));
+}
+
 struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
 					       sector_t data_block_size,
 					       bool format_device)
@@ -860,6 +880,8 @@ struct dm_pool_metadata *dm_pool_metadat
 		return ERR_PTR(r);
 	}
 
+	__set_metadata_reserve(pmd);
+
 	return pmd;
 }
 
@@ -1763,6 +1785,13 @@ int dm_pool_get_free_metadata_block_coun
 	down_read(&pmd->root_lock);
 	if (!pmd->fail_io)
 		r = dm_sm_get_nr_free(pmd->metadata_sm, result);
+
+	if (!r) {
+		if (*result < pmd->metadata_reserve)
+			*result = 0;
+		else
+			*result -= pmd->metadata_reserve;
+	}
 	up_read(&pmd->root_lock);
 
 	return r;
@@ -1875,8 +1904,11 @@ int dm_pool_resize_metadata_dev(struct d
 	int r = -EINVAL;
 
 	down_write(&pmd->root_lock);
-	if (!pmd->fail_io)
+	if (!pmd->fail_io) {
 		r = __resize_space_map(pmd->metadata_sm, new_count);
+		if (!r)
+			__set_metadata_reserve(pmd);
+	}
 	up_write(&pmd->root_lock);
 
 	return r;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/md/md-cluster.c linux-libre-4.4.160-gnu/drivers/md/md-cluster.c
--- linux-libre-4.4.159-gnu/drivers/md/md-cluster.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/md/md-cluster.c	2018-10-10 02:52:13.000000000 -0400
@@ -239,15 +239,6 @@ static void recover_bitmaps(struct md_th
 	while (cinfo->recovery_map) {
 		slot = fls64((u64)cinfo->recovery_map) - 1;
 
-		/* Clear suspend_area associated with the bitmap */
-		spin_lock_irq(&cinfo->suspend_lock);
-		list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
-			if (slot == s->slot) {
-				list_del(&s->list);
-				kfree(s);
-			}
-		spin_unlock_irq(&cinfo->suspend_lock);
-
 		snprintf(str, 64, "bitmap%04d", slot);
 		bm_lockres = lockres_init(mddev, str, NULL, 1);
 		if (!bm_lockres) {
@@ -266,6 +257,16 @@ static void recover_bitmaps(struct md_th
 			pr_err("md-cluster: Could not copy data from bitmap %d\n", slot);
 			goto dlm_unlock;
 		}
+
+		/* Clear suspend_area associated with the bitmap */
+		spin_lock_irq(&cinfo->suspend_lock);
+		list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list)
+			if (slot == s->slot) {
+				list_del(&s->list);
+				kfree(s);
+			}
+		spin_unlock_irq(&cinfo->suspend_lock);
+
 		if (hi > 0) {
 			/* TODO:Wait for current resync to get over */
 			set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/md/raid10.c linux-libre-4.4.160-gnu/drivers/md/raid10.c
--- linux-libre-4.4.159-gnu/drivers/md/raid10.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/md/raid10.c	2018-10-10 02:52:13.000000000 -0400
@@ -4336,11 +4336,12 @@ static sector_t reshape_request(struct m
 		allow_barrier(conf);
 	}
 
+	raise_barrier(conf, 0);
 read_more:
 	/* Now schedule reads for blocks from sector_nr to last */
 	r10_bio = mempool_alloc(conf->r10buf_pool, GFP_NOIO);
 	r10_bio->state = 0;
-	raise_barrier(conf, sectors_done != 0);
+	raise_barrier(conf, 1);
 	atomic_set(&r10_bio->remaining, 0);
 	r10_bio->mddev = mddev;
 	r10_bio->sector = sector_nr;
@@ -4445,6 +4446,8 @@ bio_full:
 	if (sector_nr <= last)
 		goto read_more;
 
+	lower_barrier(conf);
+
 	/* Now that we have done the whole section we can
 	 * update reshape_progress
 	 */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/i2c/soc_camera/ov772x.c linux-libre-4.4.160-gnu/drivers/media/i2c/soc_camera/ov772x.c
--- linux-libre-4.4.159-gnu/drivers/media/i2c/soc_camera/ov772x.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/i2c/soc_camera/ov772x.c	2018-10-10 02:52:13.000000000 -0400
@@ -834,7 +834,7 @@ static int ov772x_set_params(struct ov77
 	 * set COM8
 	 */
 	if (priv->band_filter) {
-		ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, 1);
+		ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, BNDF_ON_OFF);
 		if (!ret)
 			ret = ov772x_mask_set(client, BDBASE,
 					      0xff, 256 - priv->band_filter);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/platform/exynos4-is/fimc-isp-video.c linux-libre-4.4.160-gnu/drivers/media/platform/exynos4-is/fimc-isp-video.c
--- linux-libre-4.4.159-gnu/drivers/media/platform/exynos4-is/fimc-isp-video.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/platform/exynos4-is/fimc-isp-video.c	2018-10-10 02:52:13.000000000 -0400
@@ -391,12 +391,17 @@ static void __isp_video_try_fmt(struct f
 				struct v4l2_pix_format_mplane *pixm,
 				const struct fimc_fmt **fmt)
 {
-	*fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
+	const struct fimc_fmt *__fmt;
+
+	__fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
+
+	if (fmt)
+		*fmt = __fmt;
 
 	pixm->colorspace = V4L2_COLORSPACE_SRGB;
 	pixm->field = V4L2_FIELD_NONE;
-	pixm->num_planes = (*fmt)->memplanes;
-	pixm->pixelformat = (*fmt)->fourcc;
+	pixm->num_planes = __fmt->memplanes;
+	pixm->pixelformat = __fmt->fourcc;
 	/*
 	 * TODO: double check with the docmentation these width/height
 	 * constraints are correct.
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/platform/fsl-viu.c linux-libre-4.4.160-gnu/drivers/media/platform/fsl-viu.c
--- linux-libre-4.4.159-gnu/drivers/media/platform/fsl-viu.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/platform/fsl-viu.c	2018-10-10 02:52:13.000000000 -0400
@@ -1417,7 +1417,7 @@ static int viu_of_probe(struct platform_
 				     sizeof(struct viu_reg), DRV_NAME)) {
 		dev_err(&op->dev, "Error while requesting mem region\n");
 		ret = -EBUSY;
-		goto err;
+		goto err_irq;
 	}
 
 	/* remap registers */
@@ -1425,7 +1425,7 @@ static int viu_of_probe(struct platform_
 	if (!viu_regs) {
 		dev_err(&op->dev, "Can't map register set\n");
 		ret = -ENOMEM;
-		goto err;
+		goto err_irq;
 	}
 
 	/* Prepare our private structure */
@@ -1433,7 +1433,7 @@ static int viu_of_probe(struct platform_
 	if (!viu_dev) {
 		dev_err(&op->dev, "Can't allocate private structure\n");
 		ret = -ENOMEM;
-		goto err;
+		goto err_irq;
 	}
 
 	viu_dev->vr = viu_regs;
@@ -1449,16 +1449,21 @@ static int viu_of_probe(struct platform_
 	ret = v4l2_device_register(viu_dev->dev, &viu_dev->v4l2_dev);
 	if (ret < 0) {
 		dev_err(&op->dev, "v4l2_device_register() failed: %d\n", ret);
-		goto err;
+		goto err_irq;
 	}
 
 	ad = i2c_get_adapter(0);
+	if (!ad) {
+		ret = -EFAULT;
+		dev_err(&op->dev, "couldn't get i2c adapter\n");
+		goto err_v4l2;
+	}
 
 	v4l2_ctrl_handler_init(&viu_dev->hdl, 5);
 	if (viu_dev->hdl.error) {
 		ret = viu_dev->hdl.error;
 		dev_err(&op->dev, "couldn't register control\n");
-		goto err_vdev;
+		goto err_i2c;
 	}
 	/* This control handler will inherit the control(s) from the
 	   sub-device(s). */
@@ -1476,7 +1481,7 @@ static int viu_of_probe(struct platform_
 	vdev = video_device_alloc();
 	if (vdev == NULL) {
 		ret = -ENOMEM;
-		goto err_vdev;
+		goto err_hdl;
 	}
 
 	*vdev = viu_template;
@@ -1497,7 +1502,7 @@ static int viu_of_probe(struct platform_
 	ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1);
 	if (ret < 0) {
 		video_device_release(viu_dev->vdev);
-		goto err_vdev;
+		goto err_unlock;
 	}
 
 	/* enable VIU clock */
@@ -1505,12 +1510,12 @@ static int viu_of_probe(struct platform_
 	if (IS_ERR(clk)) {
 		dev_err(&op->dev, "failed to lookup the clock!\n");
 		ret = PTR_ERR(clk);
-		goto err_clk;
+		goto err_vdev;
 	}
 	ret = clk_prepare_enable(clk);
 	if (ret) {
 		dev_err(&op->dev, "failed to enable the clock!\n");
-		goto err_clk;
+		goto err_vdev;
 	}
 	viu_dev->clk = clk;
 
@@ -1521,7 +1526,7 @@ static int viu_of_probe(struct platform_
 	if (request_irq(viu_dev->irq, viu_intr, 0, "viu", (void *)viu_dev)) {
 		dev_err(&op->dev, "Request VIU IRQ failed.\n");
 		ret = -ENODEV;
-		goto err_irq;
+		goto err_clk;
 	}
 
 	mutex_unlock(&viu_dev->lock);
@@ -1529,16 +1534,19 @@ static int viu_of_probe(struct platform_
 	dev_info(&op->dev, "Freescale VIU Video Capture Board\n");
 	return ret;
 
-err_irq:
-	clk_disable_unprepare(viu_dev->clk);
 err_clk:
-	video_unregister_device(viu_dev->vdev);
+	clk_disable_unprepare(viu_dev->clk);
 err_vdev:
-	v4l2_ctrl_handler_free(&viu_dev->hdl);
+	video_unregister_device(viu_dev->vdev);
+err_unlock:
 	mutex_unlock(&viu_dev->lock);
+err_hdl:
+	v4l2_ctrl_handler_free(&viu_dev->hdl);
+err_i2c:
 	i2c_put_adapter(ad);
+err_v4l2:
 	v4l2_device_unregister(&viu_dev->v4l2_dev);
-err:
+err_irq:
 	irq_dispose_mapping(viu_irq);
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/platform/omap3isp/isp.c linux-libre-4.4.160-gnu/drivers/media/platform/omap3isp/isp.c
--- linux-libre-4.4.159-gnu/drivers/media/platform/omap3isp/isp.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/platform/omap3isp/isp.c	2018-10-10 02:52:13.000000000 -0400
@@ -303,7 +303,7 @@ static struct clk *isp_xclk_src_get(stru
 static int isp_xclk_init(struct isp_device *isp)
 {
 	struct device_node *np = isp->dev->of_node;
-	struct clk_init_data init;
+	struct clk_init_data init = { 0 };
 	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/platform/s3c-camif/camif-capture.c linux-libre-4.4.160-gnu/drivers/media/platform/s3c-camif/camif-capture.c
--- linux-libre-4.4.159-gnu/drivers/media/platform/s3c-camif/camif-capture.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/platform/s3c-camif/camif-capture.c	2018-10-10 02:52:13.000000000 -0400
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
 	if (camif->sensor.power_count == !on)
 		err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+	if (err == -ENOIOCTLCMD)
+		err = 0;
 	if (!err)
 		sensor->power_count += on ? 1 : -1;
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/usb/tm6000/tm6000-dvb.c linux-libre-4.4.160-gnu/drivers/media/usb/tm6000/tm6000-dvb.c
--- linux-libre-4.4.159-gnu/drivers/media/usb/tm6000/tm6000-dvb.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/usb/tm6000/tm6000-dvb.c	2018-10-10 02:52:13.000000000 -0400
@@ -275,6 +275,11 @@ static int register_dvb(struct tm6000_co
 
 	ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T",
 					THIS_MODULE, &dev->udev->dev, adapter_nr);
+	if (ret < 0) {
+		pr_err("tm6000: couldn't register the adapter!\n");
+		goto err;
+	}
+
 	dvb->adapter.priv = dev;
 
 	if (dvb->frontend) {
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/usb/uvc/uvc_video.c linux-libre-4.4.160-gnu/drivers/media/usb/uvc/uvc_video.c
--- linux-libre-4.4.159-gnu/drivers/media/usb/uvc/uvc_video.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/usb/uvc/uvc_video.c	2018-10-10 02:52:13.000000000 -0400
@@ -163,14 +163,27 @@ static void uvc_fixup_video_ctrl(struct
 	}
 }
 
+static size_t uvc_video_ctrl_size(struct uvc_streaming *stream)
+{
+	/*
+	 * Return the size of the video probe and commit controls, which depends
+	 * on the protocol version.
+	 */
+	if (stream->dev->uvc_version < 0x0110)
+		return 26;
+	else if (stream->dev->uvc_version < 0x0150)
+		return 34;
+	else
+		return 48;
+}
+
 static int uvc_get_video_ctrl(struct uvc_streaming *stream,
 	struct uvc_streaming_control *ctrl, int probe, __u8 query)
 {
+	__u16 size = uvc_video_ctrl_size(stream);
 	__u8 *data;
-	__u16 size;
 	int ret;
 
-	size = stream->dev->uvc_version >= 0x0110 ? 34 : 26;
 	if ((stream->dev->quirks & UVC_QUIRK_PROBE_DEF) &&
 			query == UVC_GET_DEF)
 		return -EIO;
@@ -225,7 +238,7 @@ static int uvc_get_video_ctrl(struct uvc
 	ctrl->dwMaxVideoFrameSize = get_unaligned_le32(&data[18]);
 	ctrl->dwMaxPayloadTransferSize = get_unaligned_le32(&data[22]);
 
-	if (size == 34) {
+	if (size >= 34) {
 		ctrl->dwClockFrequency = get_unaligned_le32(&data[26]);
 		ctrl->bmFramingInfo = data[30];
 		ctrl->bPreferedVersion = data[31];
@@ -254,11 +267,10 @@ out:
 static int uvc_set_video_ctrl(struct uvc_streaming *stream,
 	struct uvc_streaming_control *ctrl, int probe)
 {
+	__u16 size = uvc_video_ctrl_size(stream);
 	__u8 *data;
-	__u16 size;
 	int ret;
 
-	size = stream->dev->uvc_version >= 0x0110 ? 34 : 26;
 	data = kzalloc(size, GFP_KERNEL);
 	if (data == NULL)
 		return -ENOMEM;
@@ -275,7 +287,7 @@ static int uvc_set_video_ctrl(struct uvc
 	put_unaligned_le32(ctrl->dwMaxVideoFrameSize, &data[18]);
 	put_unaligned_le32(ctrl->dwMaxPayloadTransferSize, &data[22]);
 
-	if (size == 34) {
+	if (size >= 34) {
 		put_unaligned_le32(ctrl->dwClockFrequency, &data[26]);
 		data[30] = ctrl->bmFramingInfo;
 		data[31] = ctrl->bPreferedVersion;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/v4l2-core/v4l2-event.c linux-libre-4.4.160-gnu/drivers/media/v4l2-core/v4l2-event.c
--- linux-libre-4.4.159-gnu/drivers/media/v4l2-core/v4l2-event.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/v4l2-core/v4l2-event.c	2018-10-10 02:52:13.000000000 -0400
@@ -119,14 +119,6 @@ static void __v4l2_event_queue_fh(struct
 	if (sev == NULL)
 		return;
 
-	/*
-	 * If the event has been added to the fh->subscribed list, but its
-	 * add op has not completed yet elems will be 0, treat this as
-	 * not being subscribed.
-	 */
-	if (!sev->elems)
-		return;
-
 	/* Increase event sequence number on fh. */
 	fh->sequence++;
 
@@ -212,6 +204,7 @@ int v4l2_event_subscribe(struct v4l2_fh
 	struct v4l2_subscribed_event *sev, *found_ev;
 	unsigned long flags;
 	unsigned i;
+	int ret = 0;
 
 	if (sub->type == V4L2_EVENT_ALL)
 		return -EINVAL;
@@ -229,31 +222,36 @@ int v4l2_event_subscribe(struct v4l2_fh
 	sev->flags = sub->flags;
 	sev->fh = fh;
 	sev->ops = ops;
+	sev->elems = elems;
+
+	mutex_lock(&fh->subscribe_lock);
 
 	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
 	found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
-	if (!found_ev)
-		list_add(&sev->list, &fh->subscribed);
 	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
 
 	if (found_ev) {
+		/* Already listening */
 		kfree(sev);
-		return 0; /* Already listening */
+		goto out_unlock;
 	}
 
 	if (sev->ops && sev->ops->add) {
-		int ret = sev->ops->add(sev, elems);
+		ret = sev->ops->add(sev, elems);
 		if (ret) {
-			sev->ops = NULL;
-			v4l2_event_unsubscribe(fh, sub);
-			return ret;
+			kfree(sev);
+			goto out_unlock;
 		}
 	}
 
-	/* Mark as ready for use */
-	sev->elems = elems;
+	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
+	list_add(&sev->list, &fh->subscribed);
+	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
 
-	return 0;
+out_unlock:
+	mutex_unlock(&fh->subscribe_lock);
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(v4l2_event_subscribe);
 
@@ -292,6 +290,8 @@ int v4l2_event_unsubscribe(struct v4l2_f
 		return 0;
 	}
 
+	mutex_lock(&fh->subscribe_lock);
+
 	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
 
 	sev = v4l2_event_subscribed(fh, sub->type, sub->id);
@@ -310,6 +310,7 @@ int v4l2_event_unsubscribe(struct v4l2_f
 		sev->ops->del(sev);
 
 	kfree(sev);
+	mutex_unlock(&fh->subscribe_lock);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/media/v4l2-core/v4l2-fh.c linux-libre-4.4.160-gnu/drivers/media/v4l2-core/v4l2-fh.c
--- linux-libre-4.4.159-gnu/drivers/media/v4l2-core/v4l2-fh.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/media/v4l2-core/v4l2-fh.c	2018-10-10 02:52:13.000000000 -0400
@@ -49,6 +49,7 @@ void v4l2_fh_init(struct v4l2_fh *fh, st
 	INIT_LIST_HEAD(&fh->available);
 	INIT_LIST_HEAD(&fh->subscribed);
 	fh->sequence = -1;
+	mutex_init(&fh->subscribe_lock);
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_init);
 
@@ -93,6 +94,7 @@ void v4l2_fh_exit(struct v4l2_fh *fh)
 	if (fh->vdev == NULL)
 		return;
 	v4l2_event_unsubscribe_all(fh);
+	mutex_destroy(&fh->subscribe_lock);
 	fh->vdev = NULL;
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_exit);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/misc/tsl2550.c linux-libre-4.4.160-gnu/drivers/misc/tsl2550.c
--- linux-libre-4.4.159-gnu/drivers/misc/tsl2550.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/misc/tsl2550.c	2018-10-10 02:52:13.000000000 -0400
@@ -177,7 +177,7 @@ static int tsl2550_calculate_lux(u8 ch0,
 		} else
 			lux = 0;
 	else
-		return -EAGAIN;
+		return 0;
 
 	/* LUX range check */
 	return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/misc/vmw_vmci/vmci_queue_pair.c linux-libre-4.4.160-gnu/drivers/misc/vmw_vmci/vmci_queue_pair.c
--- linux-libre-4.4.159-gnu/drivers/misc/vmw_vmci/vmci_queue_pair.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/misc/vmw_vmci/vmci_queue_pair.c	2018-10-10 02:52:13.000000000 -0400
@@ -755,7 +755,7 @@ static int qp_host_get_user_memory(u64 p
 	retval = get_user_pages_fast((uintptr_t) produce_uva,
 				     produce_q->kernel_if->num_pages, 1,
 				     produce_q->kernel_if->u.h.header_page);
-	if (retval < produce_q->kernel_if->num_pages) {
+	if (retval < (int)produce_q->kernel_if->num_pages) {
 		pr_debug("get_user_pages_fast(produce) failed (retval=%d)",
 			retval);
 		qp_release_pages(produce_q->kernel_if->u.h.header_page,
@@ -767,7 +767,7 @@ static int qp_host_get_user_memory(u64 p
 	retval = get_user_pages_fast((uintptr_t) consume_uva,
 				     consume_q->kernel_if->num_pages, 1,
 				     consume_q->kernel_if->u.h.header_page);
-	if (retval < consume_q->kernel_if->num_pages) {
+	if (retval < (int)consume_q->kernel_if->num_pages) {
 		pr_debug("get_user_pages_fast(consume) failed (retval=%d)",
 			retval);
 		qp_release_pages(consume_q->kernel_if->u.h.header_page,
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/ethernet/cadence/macb.c linux-libre-4.4.160-gnu/drivers/net/ethernet/cadence/macb.c
--- linux-libre-4.4.159-gnu/drivers/net/ethernet/cadence/macb.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/ethernet/cadence/macb.c	2018-10-10 02:52:13.000000000 -0400
@@ -523,7 +523,7 @@ static int macb_halt_tx(struct macb *bp)
 		if (!(status & MACB_BIT(TGO)))
 			return 0;
 
-		usleep_range(10, 250);
+		udelay(250);
 	} while (time_before(halt_time, timeout));
 
 	return -ETIMEDOUT;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/ethernet/hisilicon/hns/hnae.h linux-libre-4.4.160-gnu/drivers/net/ethernet/hisilicon/hns/hnae.h
--- linux-libre-4.4.159-gnu/drivers/net/ethernet/hisilicon/hns/hnae.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/ethernet/hisilicon/hns/hnae.h	2018-10-10 02:52:13.000000000 -0400
@@ -171,10 +171,10 @@ struct hnae_desc_cb {
 
 	/* priv data for the desc, e.g. skb when use with ip stack*/
 	void *priv;
-	u16 page_offset;
-	u16 reuse_flag;
+	u32 page_offset;
+	u32 length;     /* length of the buffer */
 
-	u16 length;     /* length of the buffer */
+	u16 reuse_flag;
 
        /* desc type, used by the ring user to mark the type of the priv data */
 	u16 type;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/ethernet/intel/e1000/e1000_ethtool.c linux-libre-4.4.160-gnu/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
--- linux-libre-4.4.159-gnu/drivers/net/ethernet/intel/e1000/e1000_ethtool.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/ethernet/intel/e1000/e1000_ethtool.c	2018-10-10 02:52:13.000000000 -0400
@@ -645,14 +645,14 @@ static int e1000_set_ringparam(struct ne
 		adapter->tx_ring = tx_old;
 		e1000_free_all_rx_resources(adapter);
 		e1000_free_all_tx_resources(adapter);
-		kfree(tx_old);
-		kfree(rx_old);
 		adapter->rx_ring = rxdr;
 		adapter->tx_ring = txdr;
 		err = e1000_up(adapter);
 		if (err)
 			goto err_setup;
 	}
+	kfree(tx_old);
+	kfree(rx_old);
 
 	clear_bit(__E1000_RESETTING, &adapter->flags);
 	return 0;
@@ -665,7 +665,8 @@ err_setup_rx:
 err_alloc_rx:
 	kfree(txdr);
 err_alloc_tx:
-	e1000_up(adapter);
+	if (netif_running(adapter->netdev))
+		e1000_up(adapter);
 err_setup:
 	clear_bit(__E1000_RESETTING, &adapter->flags);
 	return err;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/ethernet/realtek/r8169.c linux-libre-4.4.160-gnu/drivers/net/ethernet/realtek/r8169.c
--- linux-libre-4.4.159-gnu/drivers/net/ethernet/realtek/r8169.c	2018-09-29 11:31:22.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/ethernet/realtek/r8169.c	2018-10-10 12:31:20.000000000 -0400
@@ -759,7 +759,7 @@ struct rtl8169_tc_offsets {
 };
 
 enum rtl_flag {
-	RTL_FLAG_TASK_ENABLED,
+	RTL_FLAG_TASK_ENABLED = 0,
 	RTL_FLAG_TASK_SLOW_PENDING,
 	RTL_FLAG_TASK_RESET_PENDING,
 	RTL_FLAG_TASK_PHY_PENDING,
@@ -7600,7 +7600,8 @@ static int rtl8169_close(struct net_devi
 	rtl8169_update_counters(dev);
 
 	rtl_lock_work(tp);
-	clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
+	/* Clear all task flags */
+	bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
 
 	rtl8169_down(dev);
 	rtl_unlock_work(tp);
@@ -7777,7 +7778,9 @@ static void rtl8169_net_suspend(struct n
 
 	rtl_lock_work(tp);
 	napi_disable(&tp->napi);
-	clear_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags);
+	/* Clear all task flags */
+	bitmap_zero(tp->wk.flags, RTL_FLAG_MAX);
+
 	rtl_unlock_work(tp);
 
 	rtl_pll_power_down(tp);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/wireless/ath/ath10k/htt_rx.c linux-libre-4.4.160-gnu/drivers/net/wireless/ath/ath10k/htt_rx.c
--- linux-libre-4.4.159-gnu/drivers/net/wireless/ath/ath10k/htt_rx.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/wireless/ath/ath10k/htt_rx.c	2018-10-10 02:52:13.000000000 -0400
@@ -212,11 +212,12 @@ int ath10k_htt_rx_ring_refill(struct ath
 	spin_lock_bh(&htt->rx_ring.lock);
 	ret = ath10k_htt_rx_ring_fill_n(htt, (htt->rx_ring.fill_level -
 					      htt->rx_ring.fill_cnt));
-	spin_unlock_bh(&htt->rx_ring.lock);
 
 	if (ret)
 		ath10k_htt_rx_ring_free(htt);
 
+	spin_unlock_bh(&htt->rx_ring.lock);
+
 	return ret;
 }
 
@@ -230,7 +231,9 @@ void ath10k_htt_rx_free(struct ath10k_ht
 	skb_queue_purge(&htt->rx_compl_q);
 	skb_queue_purge(&htt->rx_in_ord_compl_q);
 
+	spin_lock_bh(&htt->rx_ring.lock);
 	ath10k_htt_rx_ring_free(htt);
+	spin_unlock_bh(&htt->rx_ring.lock);
 
 	dma_free_coherent(htt->ar->dev,
 			  (htt->rx_ring.size *
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/wireless/mac80211_hwsim.c linux-libre-4.4.160-gnu/drivers/net/wireless/mac80211_hwsim.c
--- linux-libre-4.4.159-gnu/drivers/net/wireless/mac80211_hwsim.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/wireless/mac80211_hwsim.c	2018-10-10 02:52:13.000000000 -0400
@@ -2453,9 +2453,6 @@ static int mac80211_hwsim_new_radio(stru
 				IEEE80211_VHT_CAP_SHORT_GI_80 |
 				IEEE80211_VHT_CAP_SHORT_GI_160 |
 				IEEE80211_VHT_CAP_TXSTBC |
-				IEEE80211_VHT_CAP_RXSTBC_1 |
-				IEEE80211_VHT_CAP_RXSTBC_2 |
-				IEEE80211_VHT_CAP_RXSTBC_3 |
 				IEEE80211_VHT_CAP_RXSTBC_4 |
 				IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
 			sband->vht_cap.vht_mcs.rx_mcs_map =
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/wireless/rndis_wlan.c linux-libre-4.4.160-gnu/drivers/net/wireless/rndis_wlan.c
--- linux-libre-4.4.159-gnu/drivers/net/wireless/rndis_wlan.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/wireless/rndis_wlan.c	2018-10-10 02:52:13.000000000 -0400
@@ -2919,6 +2919,8 @@ static void rndis_wlan_auth_indication(s
 
 	while (buflen >= sizeof(*auth_req)) {
 		auth_req = (void *)buf;
+		if (buflen < le32_to_cpu(auth_req->length))
+			return;
 		type = "unknown";
 		flags = le32_to_cpu(auth_req->flags);
 		pairwise_error = false;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/net/wireless/ti/wlcore/cmd.c linux-libre-4.4.160-gnu/drivers/net/wireless/ti/wlcore/cmd.c
--- linux-libre-4.4.159-gnu/drivers/net/wireless/ti/wlcore/cmd.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/net/wireless/ti/wlcore/cmd.c	2018-10-10 02:52:13.000000000 -0400
@@ -35,6 +35,7 @@
 #include "wl12xx_80211.h"
 #include "cmd.h"
 #include "event.h"
+#include "ps.h"
 #include "tx.h"
 #include "hw_ops.h"
 
@@ -191,6 +192,10 @@ int wlcore_cmd_wait_for_event_or_timeout
 
 	timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
 
+	ret = wl1271_ps_elp_wakeup(wl);
+	if (ret < 0)
+		return ret;
+
 	do {
 		if (time_after(jiffies, timeout_time)) {
 			wl1271_debug(DEBUG_CMD, "timeout waiting for event %d",
@@ -222,6 +227,7 @@ int wlcore_cmd_wait_for_event_or_timeout
 	} while (!event);
 
 out:
+	wl1271_ps_elp_sleep(wl);
 	kfree(events_vector);
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/power/reset/vexpress-poweroff.c linux-libre-4.4.160-gnu/drivers/power/reset/vexpress-poweroff.c
--- linux-libre-4.4.159-gnu/drivers/power/reset/vexpress-poweroff.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/power/reset/vexpress-poweroff.c	2018-10-10 02:52:13.000000000 -0400
@@ -35,6 +35,7 @@ static void vexpress_reset_do(struct dev
 }
 
 static struct device *vexpress_power_off_device;
+static atomic_t vexpress_restart_nb_refcnt = ATOMIC_INIT(0);
 
 static void vexpress_power_off(void)
 {
@@ -99,10 +100,13 @@ static int _vexpress_register_restart_ha
 	int err;
 
 	vexpress_restart_device = dev;
-	err = register_restart_handler(&vexpress_restart_nb);
-	if (err) {
-		dev_err(dev, "cannot register restart handler (err=%d)\n", err);
-		return err;
+	if (atomic_inc_return(&vexpress_restart_nb_refcnt) == 1) {
+		err = register_restart_handler(&vexpress_restart_nb);
+		if (err) {
+			dev_err(dev, "cannot register restart handler (err=%d)\n", err);
+			atomic_dec(&vexpress_restart_nb_refcnt);
+			return err;
+		}
 	}
 	device_create_file(dev, &dev_attr_active);
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/s390/net/qeth_l2_main.c linux-libre-4.4.160-gnu/drivers/s390/net/qeth_l2_main.c
--- linux-libre-4.4.159-gnu/drivers/s390/net/qeth_l2_main.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/s390/net/qeth_l2_main.c	2018-10-10 02:52:13.000000000 -0400
@@ -523,7 +523,7 @@ static int qeth_l2_process_inbound_buffe
 		default:
 			dev_kfree_skb_any(skb);
 			QETH_CARD_TEXT(card, 3, "inbunkno");
-			QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
+			QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
 			continue;
 		}
 		work_done++;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/s390/net/qeth_l3_main.c linux-libre-4.4.160-gnu/drivers/s390/net/qeth_l3_main.c
--- linux-libre-4.4.159-gnu/drivers/s390/net/qeth_l3_main.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/s390/net/qeth_l3_main.c	2018-10-10 02:52:13.000000000 -0400
@@ -1902,7 +1902,7 @@ static int qeth_l3_process_inbound_buffe
 		default:
 			dev_kfree_skb_any(skb);
 			QETH_CARD_TEXT(card, 3, "inbunkno");
-			QETH_DBF_HEX(CTRL, 3, hdr, QETH_DBF_CTRL_LEN);
+			QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
 			continue;
 		}
 		work_done++;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/scsi/bnx2i/bnx2i_hwi.c linux-libre-4.4.160-gnu/drivers/scsi/bnx2i/bnx2i_hwi.c
--- linux-libre-4.4.159-gnu/drivers/scsi/bnx2i/bnx2i_hwi.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/scsi/bnx2i/bnx2i_hwi.c	2018-10-10 02:52:13.000000000 -0400
@@ -2742,6 +2742,8 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i
 					      BNX2X_DOORBELL_PCI_BAR);
 		reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF);
 		ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
+		if (!ep->qp.ctx_base)
+			return -ENOMEM;
 		goto arm_cq;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/scsi/ibmvscsi/ibmvscsi.c linux-libre-4.4.160-gnu/drivers/scsi/ibmvscsi/ibmvscsi.c
--- linux-libre-4.4.159-gnu/drivers/scsi/ibmvscsi/ibmvscsi.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/scsi/ibmvscsi/ibmvscsi.c	2018-10-10 02:52:13.000000000 -0400
@@ -93,7 +93,7 @@ static int max_requests = IBMVSCSI_MAX_R
 static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2;
 static int fast_fail = 1;
 static int client_reserve = 1;
-static char partition_name[97] = "UNKNOWN";
+static char partition_name[96] = "UNKNOWN";
 static unsigned int partition_number = -1;
 
 static struct scsi_transport_template *ibmvscsi_transport_template;
@@ -261,7 +261,7 @@ static void gather_partition_info(void)
 
 	ppartition_name = of_get_property(rootdn, "ibm,partition-name", NULL);
 	if (ppartition_name)
-		strncpy(partition_name, ppartition_name,
+		strlcpy(partition_name, ppartition_name,
 				sizeof(partition_name));
 	p_number_ptr = of_get_property(rootdn, "ibm,partition-no", NULL);
 	if (p_number_ptr)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/spi/spi-rspi.c linux-libre-4.4.160-gnu/drivers/spi/spi-rspi.c
--- linux-libre-4.4.159-gnu/drivers/spi/spi-rspi.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/spi/spi-rspi.c	2018-10-10 02:52:13.000000000 -0400
@@ -587,11 +587,13 @@ static int rspi_dma_transfer(struct rspi
 
 	ret = wait_event_interruptible_timeout(rspi->wait,
 					       rspi->dma_callbacked, HZ);
-	if (ret > 0 && rspi->dma_callbacked)
+	if (ret > 0 && rspi->dma_callbacked) {
 		ret = 0;
-	else if (!ret) {
-		dev_err(&rspi->master->dev, "DMA timeout\n");
-		ret = -ETIMEDOUT;
+	} else {
+		if (!ret) {
+			dev_err(&rspi->master->dev, "DMA timeout\n");
+			ret = -ETIMEDOUT;
+		}
 		if (tx)
 			dmaengine_terminate_all(rspi->master->dma_tx);
 		if (rx)
@@ -1303,12 +1305,36 @@ static const struct platform_device_id s
 
 MODULE_DEVICE_TABLE(platform, spi_driver_ids);
 
+#ifdef CONFIG_PM_SLEEP
+static int rspi_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct rspi_data *rspi = platform_get_drvdata(pdev);
+
+	return spi_master_suspend(rspi->master);
+}
+
+static int rspi_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct rspi_data *rspi = platform_get_drvdata(pdev);
+
+	return spi_master_resume(rspi->master);
+}
+
+static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume);
+#define DEV_PM_OPS	&rspi_pm_ops
+#else
+#define DEV_PM_OPS	NULL
+#endif /* CONFIG_PM_SLEEP */
+
 static struct platform_driver rspi_driver = {
 	.probe =	rspi_probe,
 	.remove =	rspi_remove,
 	.id_table =	spi_driver_ids,
 	.driver		= {
 		.name = "renesas_spi",
+		.pm = DEV_PM_OPS,
 		.of_match_table = of_match_ptr(rspi_of_match),
 	},
 };
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/spi/spi-sh-msiof.c linux-libre-4.4.160-gnu/drivers/spi/spi-sh-msiof.c
--- linux-libre-4.4.159-gnu/drivers/spi/spi-sh-msiof.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/spi/spi-sh-msiof.c	2018-10-10 02:52:13.000000000 -0400
@@ -374,7 +374,8 @@ static void sh_msiof_spi_set_mode_regs(s
 
 static void sh_msiof_reset_str(struct sh_msiof_spi_priv *p)
 {
-	sh_msiof_write(p, STR, sh_msiof_read(p, STR));
+	sh_msiof_write(p, STR,
+		       sh_msiof_read(p, STR) & ~(STR_TDREQ | STR_RDREQ));
 }
 
 static void sh_msiof_spi_write_fifo_8(struct sh_msiof_spi_priv *p,
@@ -1275,12 +1276,37 @@ static const struct platform_device_id s
 };
 MODULE_DEVICE_TABLE(platform, spi_driver_ids);
 
+#ifdef CONFIG_PM_SLEEP
+static int sh_msiof_spi_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
+
+	return spi_master_suspend(p->master);
+}
+
+static int sh_msiof_spi_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
+
+	return spi_master_resume(p->master);
+}
+
+static SIMPLE_DEV_PM_OPS(sh_msiof_spi_pm_ops, sh_msiof_spi_suspend,
+			 sh_msiof_spi_resume);
+#define DEV_PM_OPS	&sh_msiof_spi_pm_ops
+#else
+#define DEV_PM_OPS	NULL
+#endif /* CONFIG_PM_SLEEP */
+
 static struct platform_driver sh_msiof_spi_drv = {
 	.probe		= sh_msiof_spi_probe,
 	.remove		= sh_msiof_spi_remove,
 	.id_table	= spi_driver_ids,
 	.driver		= {
 		.name		= "spi_sh_msiof",
+		.pm		= DEV_PM_OPS,
 		.of_match_table = of_match_ptr(sh_msiof_match),
 	},
 };
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/spi/spi-tegra20-slink.c linux-libre-4.4.160-gnu/drivers/spi/spi-tegra20-slink.c
--- linux-libre-4.4.159-gnu/drivers/spi/spi-tegra20-slink.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/spi/spi-tegra20-slink.c	2018-10-10 02:52:13.000000000 -0400
@@ -1063,6 +1063,24 @@ static int tegra_slink_probe(struct plat
 		goto exit_free_master;
 	}
 
+	/* disabled clock may cause interrupt storm upon request */
+	tspi->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(tspi->clk)) {
+		ret = PTR_ERR(tspi->clk);
+		dev_err(&pdev->dev, "Can not get clock %d\n", ret);
+		goto exit_free_master;
+	}
+	ret = clk_prepare(tspi->clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Clock prepare failed %d\n", ret);
+		goto exit_free_master;
+	}
+	ret = clk_enable(tspi->clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Clock enable failed %d\n", ret);
+		goto exit_free_master;
+	}
+
 	spi_irq = platform_get_irq(pdev, 0);
 	tspi->irq = spi_irq;
 	ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
@@ -1071,14 +1089,7 @@ static int tegra_slink_probe(struct plat
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
 					tspi->irq);
-		goto exit_free_master;
-	}
-
-	tspi->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(tspi->clk)) {
-		dev_err(&pdev->dev, "can not get clock\n");
-		ret = PTR_ERR(tspi->clk);
-		goto exit_free_irq;
+		goto exit_clk_disable;
 	}
 
 	tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
@@ -1138,6 +1149,8 @@ exit_rx_dma_free:
 	tegra_slink_deinit_dma_param(tspi, true);
 exit_free_irq:
 	free_irq(spi_irq, tspi);
+exit_clk_disable:
+	clk_disable(tspi->clk);
 exit_free_master:
 	spi_master_put(master);
 	return ret;
@@ -1150,6 +1163,8 @@ static int tegra_slink_remove(struct pla
 
 	free_irq(tspi->irq, tspi);
 
+	clk_disable(tspi->clk);
+
 	if (tspi->tx_dma_chan)
 		tegra_slink_deinit_dma_param(tspi, false);
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/staging/android/ashmem.c linux-libre-4.4.160-gnu/drivers/staging/android/ashmem.c
--- linux-libre-4.4.159-gnu/drivers/staging/android/ashmem.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/staging/android/ashmem.c	2018-10-10 02:52:13.000000000 -0400
@@ -370,6 +370,12 @@ static int ashmem_mmap(struct file *file
 		goto out;
 	}
 
+	/* requested mapping size larger than object size */
+	if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
+		ret = -EINVAL;
+		goto out;
+	}
+
 	/* requested protection bits must match our allowed protection mask */
 	if (unlikely((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask)) &
 		     calc_vm_prot_bits(PROT_MASK))) {
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/staging/rts5208/sd.c linux-libre-4.4.160-gnu/drivers/staging/rts5208/sd.c
--- linux-libre-4.4.159-gnu/drivers/staging/rts5208/sd.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/staging/rts5208/sd.c	2018-10-10 02:52:13.000000000 -0400
@@ -5031,7 +5031,7 @@ int sd_execute_write_data(struct scsi_cm
 			goto SD_Execute_Write_Cmd_Failed;
 		}
 
-		rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
+		retval = rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
 		if (retval != STATUS_SUCCESS) {
 			rtsx_trace(chip);
 			goto SD_Execute_Write_Cmd_Failed;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/target/iscsi/iscsi_target_auth.c linux-libre-4.4.160-gnu/drivers/target/iscsi/iscsi_target_auth.c
--- linux-libre-4.4.159-gnu/drivers/target/iscsi/iscsi_target_auth.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/target/iscsi/iscsi_target_auth.c	2018-10-10 02:52:13.000000000 -0400
@@ -26,15 +26,6 @@
 #include "iscsi_target_nego.h"
 #include "iscsi_target_auth.h"
 
-static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len)
-{
-	int i;
-
-	for (i = 0; i < src_len; i++) {
-		sprintf(&dst[i*2], "%02x", (int) src[i] & 0xff);
-	}
-}
-
 static void chap_gen_challenge(
 	struct iscsi_conn *conn,
 	int caller,
@@ -47,7 +38,7 @@ static void chap_gen_challenge(
 	memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1);
 
 	get_random_bytes(chap->challenge, CHAP_CHALLENGE_LENGTH);
-	chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge,
+	bin2hex(challenge_asciihex, chap->challenge,
 				CHAP_CHALLENGE_LENGTH);
 	/*
 	 * Set CHAP_C, and copy the generated challenge into c_str.
@@ -287,7 +278,7 @@ static int chap_server_compute_md5(
 	}
 	crypto_free_hash(tfm);
 
-	chap_binaryhex_to_asciihex(response, server_digest, MD5_SIGNATURE_SIZE);
+	bin2hex(response, server_digest, MD5_SIGNATURE_SIZE);
 	pr_debug("[server] MD5 Server Digest: %s\n", response);
 
 	if (memcmp(server_digest, client_digest, MD5_SIGNATURE_SIZE) != 0) {
@@ -431,7 +422,7 @@ static int chap_server_compute_md5(
 	/*
 	 * Convert response from binary hex to ascii hext.
 	 */
-	chap_binaryhex_to_asciihex(response, digest, MD5_SIGNATURE_SIZE);
+	bin2hex(response, digest, MD5_SIGNATURE_SIZE);
 	*nr_out_len += sprintf(nr_out_ptr + *nr_out_len, "CHAP_R=0x%s",
 			response);
 	*nr_out_len += 1;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/target/iscsi/iscsi_target_tpg.c linux-libre-4.4.160-gnu/drivers/target/iscsi/iscsi_target_tpg.c
--- linux-libre-4.4.159-gnu/drivers/target/iscsi/iscsi_target_tpg.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/target/iscsi/iscsi_target_tpg.c	2018-10-10 02:52:13.000000000 -0400
@@ -637,8 +637,7 @@ int iscsit_ta_authentication(struct iscs
 		none = strstr(buf1, NONE);
 		if (none)
 			goto out;
-		strncat(buf1, ",", strlen(","));
-		strncat(buf1, NONE, strlen(NONE));
+		strlcat(buf1, "," NONE, sizeof(buf1));
 		if (iscsi_update_param_value(param, buf1) < 0)
 			return -EINVAL;
 	}
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/thermal/of-thermal.c linux-libre-4.4.160-gnu/drivers/thermal/of-thermal.c
--- linux-libre-4.4.159-gnu/drivers/thermal/of-thermal.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/thermal/of-thermal.c	2018-10-10 02:52:13.000000000 -0400
@@ -284,10 +284,13 @@ static int of_thermal_set_mode(struct th
 
 	mutex_lock(&tz->lock);
 
-	if (mode == THERMAL_DEVICE_ENABLED)
+	if (mode == THERMAL_DEVICE_ENABLED) {
 		tz->polling_delay = data->polling_delay;
-	else
+		tz->passive_delay = data->passive_delay;
+	} else {
 		tz->polling_delay = 0;
+		tz->passive_delay = 0;
+	}
 
 	mutex_unlock(&tz->lock);
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/tty/serial/8250/serial_cs.c linux-libre-4.4.160-gnu/drivers/tty/serial/8250/serial_cs.c
--- linux-libre-4.4.159-gnu/drivers/tty/serial/8250/serial_cs.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/tty/serial/8250/serial_cs.c	2018-10-10 02:52:13.000000000 -0400
@@ -629,8 +629,10 @@ static int serial_config(struct pcmcia_d
 	    (link->has_func_id) &&
 	    (link->socket->pcmcia_pfc == 0) &&
 	    ((link->func_id == CISTPL_FUNCID_MULTI) ||
-	     (link->func_id == CISTPL_FUNCID_SERIAL)))
-		pcmcia_loop_config(link, serial_check_for_multi, info);
+	     (link->func_id == CISTPL_FUNCID_SERIAL))) {
+		if (pcmcia_loop_config(link, serial_check_for_multi, info))
+			goto failed;
+	}
 
 	/*
 	 * Apply any multi-port quirk.
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/tty/serial/cpm_uart/cpm_uart_core.c linux-libre-4.4.160-gnu/drivers/tty/serial/cpm_uart/cpm_uart_core.c
--- linux-libre-4.4.159-gnu/drivers/tty/serial/cpm_uart/cpm_uart_core.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/tty/serial/cpm_uart/cpm_uart_core.c	2018-10-10 02:52:13.000000000 -0400
@@ -1068,8 +1068,8 @@ static int poll_wait_key(char *obuf, str
 	/* Get the address of the host memory buffer.
 	 */
 	bdp = pinfo->rx_cur;
-	while (bdp->cbd_sc & BD_SC_EMPTY)
-		;
+	if (bdp->cbd_sc & BD_SC_EMPTY)
+		return NO_POLL_CHAR;
 
 	/* If the buffer address is in the CPM DPRAM, don't
 	 * convert it.
@@ -1104,7 +1104,11 @@ static int cpm_get_poll_char(struct uart
 		poll_chars = 0;
 	}
 	if (poll_chars <= 0) {
-		poll_chars = poll_wait_key(poll_buf, pinfo);
+		int ret = poll_wait_key(poll_buf, pinfo);
+
+		if (ret == NO_POLL_CHAR)
+			return ret;
+		poll_chars = ret;
 		pollp = poll_buf;
 	}
 	poll_chars--;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/tty/serial/imx.c linux-libre-4.4.160-gnu/drivers/tty/serial/imx.c
--- linux-libre-4.4.159-gnu/drivers/tty/serial/imx.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/tty/serial/imx.c	2018-10-10 02:52:13.000000000 -0400
@@ -1997,6 +1997,14 @@ static int serial_imx_probe(struct platf
 				       dev_name(&pdev->dev), sport);
 		if (ret)
 			return ret;
+
+		ret = devm_request_irq(&pdev->dev, rtsirq, imx_rtsint, 0,
+				       dev_name(&pdev->dev), sport);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to request rts irq: %d\n",
+				ret);
+			return ret;
+		}
 	} else {
 		ret = devm_request_irq(&pdev->dev, rxirq, imx_int, 0,
 				       dev_name(&pdev->dev), sport);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/class/cdc-wdm.c linux-libre-4.4.160-gnu/drivers/usb/class/cdc-wdm.c
--- linux-libre-4.4.159-gnu/drivers/usb/class/cdc-wdm.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/class/cdc-wdm.c	2018-10-10 02:52:13.000000000 -0400
@@ -453,7 +453,7 @@ static int clear_wdm_read_flag(struct wd
 
 	set_bit(WDM_RESPONDING, &desc->flags);
 	spin_unlock_irq(&desc->iuspin);
-	rv = usb_submit_urb(desc->response, GFP_ATOMIC);
+	rv = usb_submit_urb(desc->response, GFP_KERNEL);
 	spin_lock_irq(&desc->iuspin);
 	if (rv) {
 		dev_err(&desc->intf->dev,
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/core/devio.c linux-libre-4.4.160-gnu/drivers/usb/core/devio.c
--- linux-libre-4.4.159-gnu/drivers/usb/core/devio.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/core/devio.c	2018-10-10 02:52:13.000000000 -0400
@@ -1289,10 +1289,13 @@ static int proc_do_submiturb(struct usb_
 	struct async *as = NULL;
 	struct usb_ctrlrequest *dr = NULL;
 	unsigned int u, totlen, isofrmlen;
-	int i, ret, is_in, num_sgs = 0, ifnum = -1;
+	int i, ret, num_sgs = 0, ifnum = -1;
 	int number_of_packets = 0;
 	unsigned int stream_id = 0;
 	void *buf;
+	bool is_in;
+	bool allow_short = false;
+	bool allow_zero = false;
 	unsigned long mask =	USBDEVFS_URB_SHORT_NOT_OK |
 				USBDEVFS_URB_BULK_CONTINUATION |
 				USBDEVFS_URB_NO_FSBR |
@@ -1326,6 +1329,8 @@ static int proc_do_submiturb(struct usb_
 	u = 0;
 	switch (uurb->type) {
 	case USBDEVFS_URB_TYPE_CONTROL:
+		if (is_in)
+			allow_short = true;
 		if (!usb_endpoint_xfer_control(&ep->desc))
 			return -EINVAL;
 		/* min 8 byte setup packet */
@@ -1366,6 +1371,10 @@ static int proc_do_submiturb(struct usb_
 		break;
 
 	case USBDEVFS_URB_TYPE_BULK:
+		if (!is_in)
+			allow_zero = true;
+		else
+			allow_short = true;
 		switch (usb_endpoint_type(&ep->desc)) {
 		case USB_ENDPOINT_XFER_CONTROL:
 		case USB_ENDPOINT_XFER_ISOC:
@@ -1386,6 +1395,10 @@ static int proc_do_submiturb(struct usb_
 		if (!usb_endpoint_xfer_int(&ep->desc))
 			return -EINVAL;
  interrupt_urb:
+		if (!is_in)
+			allow_zero = true;
+		else
+			allow_short = true;
 		break;
 
 	case USBDEVFS_URB_TYPE_ISO:
@@ -1512,16 +1525,21 @@ static int proc_do_submiturb(struct usb_
 	u = (is_in ? URB_DIR_IN : URB_DIR_OUT);
 	if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
 		u |= URB_ISO_ASAP;
-	if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in)
+	if (allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
 		u |= URB_SHORT_NOT_OK;
 	if (uurb->flags & USBDEVFS_URB_NO_FSBR)
 		u |= URB_NO_FSBR;
-	if (uurb->flags & USBDEVFS_URB_ZERO_PACKET)
+	if (allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
 		u |= URB_ZERO_PACKET;
 	if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT)
 		u |= URB_NO_INTERRUPT;
 	as->urb->transfer_flags = u;
 
+	if (!allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
+		dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_SHORT_NOT_OK.\n");
+	if (!allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
+		dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_ZERO_PACKET.\n");
+
 	as->urb->transfer_buffer_length = uurb->buffer_length;
 	as->urb->setup_packet = (unsigned char *)dr;
 	dr = NULL;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/core/driver.c linux-libre-4.4.160-gnu/drivers/usb/core/driver.c
--- linux-libre-4.4.159-gnu/drivers/usb/core/driver.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/core/driver.c	2018-10-10 02:52:13.000000000 -0400
@@ -509,7 +509,6 @@ int usb_driver_claim_interface(struct us
 	struct device *dev;
 	struct usb_device *udev;
 	int retval = 0;
-	int lpm_disable_error = -ENODEV;
 
 	if (!iface)
 		return -ENODEV;
@@ -530,16 +529,6 @@ int usb_driver_claim_interface(struct us
 
 	iface->condition = USB_INTERFACE_BOUND;
 
-	/* See the comment about disabling LPM in usb_probe_interface(). */
-	if (driver->disable_hub_initiated_lpm) {
-		lpm_disable_error = usb_unlocked_disable_lpm(udev);
-		if (lpm_disable_error) {
-			dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.",
-					__func__, driver->name);
-			return -ENOMEM;
-		}
-	}
-
 	/* Claimed interfaces are initially inactive (suspended) and
 	 * runtime-PM-enabled, but only if the driver has autosuspend
 	 * support.  Otherwise they are marked active, to prevent the
@@ -558,9 +547,20 @@ int usb_driver_claim_interface(struct us
 	if (device_is_registered(dev))
 		retval = device_bind_driver(dev);
 
-	/* Attempt to re-enable USB3 LPM, if the disable was successful. */
-	if (!lpm_disable_error)
-		usb_unlocked_enable_lpm(udev);
+	if (retval) {
+		dev->driver = NULL;
+		usb_set_intfdata(iface, NULL);
+		iface->needs_remote_wakeup = 0;
+		iface->condition = USB_INTERFACE_UNBOUND;
+
+		/*
+		 * Unbound interfaces are always runtime-PM-disabled
+		 * and runtime-PM-suspended
+		 */
+		if (driver->supports_autosuspend)
+			pm_runtime_disable(dev);
+		pm_runtime_set_suspended(dev);
+	}
 
 	return retval;
 }
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/core/usb.c linux-libre-4.4.160-gnu/drivers/usb/core/usb.c
--- linux-libre-4.4.159-gnu/drivers/usb/core/usb.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/core/usb.c	2018-10-10 02:52:13.000000000 -0400
@@ -95,6 +95,8 @@ struct usb_host_interface *usb_find_alt_
 	struct usb_interface_cache *intf_cache = NULL;
 	int i;
 
+	if (!config)
+		return NULL;
 	for (i = 0; i < config->desc.bNumInterfaces; i++) {
 		if (config->intf_cache[i]->altsetting[0].desc.bInterfaceNumber
 				== iface_num) {
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/gadget/udc/fotg210-udc.c linux-libre-4.4.160-gnu/drivers/usb/gadget/udc/fotg210-udc.c
--- linux-libre-4.4.159-gnu/drivers/usb/gadget/udc/fotg210-udc.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/gadget/udc/fotg210-udc.c	2018-10-10 02:52:13.000000000 -0400
@@ -1066,12 +1066,15 @@ static struct usb_gadget_ops fotg210_gad
 static int fotg210_udc_remove(struct platform_device *pdev)
 {
 	struct fotg210_udc *fotg210 = platform_get_drvdata(pdev);
+	int i;
 
 	usb_del_gadget_udc(&fotg210->gadget);
 	iounmap(fotg210->reg);
 	free_irq(platform_get_irq(pdev, 0), fotg210);
 
 	fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
+	for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
+		kfree(fotg210->ep[i]);
 	kfree(fotg210);
 
 	return 0;
@@ -1102,7 +1105,7 @@ static int fotg210_udc_probe(struct plat
 	/* initialize udc */
 	fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL);
 	if (fotg210 == NULL)
-		goto err_alloc;
+		goto err;
 
 	for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
 		_ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
@@ -1114,7 +1117,7 @@ static int fotg210_udc_probe(struct plat
 	fotg210->reg = ioremap(res->start, resource_size(res));
 	if (fotg210->reg == NULL) {
 		pr_err("ioremap error.\n");
-		goto err_map;
+		goto err_alloc;
 	}
 
 	spin_lock_init(&fotg210->lock);
@@ -1162,7 +1165,7 @@ static int fotg210_udc_probe(struct plat
 	fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep,
 				GFP_KERNEL);
 	if (fotg210->ep0_req == NULL)
-		goto err_req;
+		goto err_map;
 
 	fotg210_init(fotg210);
 
@@ -1190,12 +1193,14 @@ err_req:
 	fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req);
 
 err_map:
-	if (fotg210->reg)
-		iounmap(fotg210->reg);
+	iounmap(fotg210->reg);
 
 err_alloc:
+	for (i = 0; i < FOTG210_MAX_NUM_EP; i++)
+		kfree(fotg210->ep[i]);
 	kfree(fotg210);
 
+err:
 	return ret;
 }
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/misc/yurex.c linux-libre-4.4.160-gnu/drivers/usb/misc/yurex.c
--- linux-libre-4.4.159-gnu/drivers/usb/misc/yurex.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/misc/yurex.c	2018-10-10 02:52:13.000000000 -0400
@@ -431,6 +431,9 @@ static ssize_t yurex_read(struct file *f
 	spin_unlock_irqrestore(&dev->lock, flags);
 	mutex_unlock(&dev->io_mutex);
 
+	if (WARN_ON_ONCE(len >= sizeof(in_buffer)))
+		return -EIO;
+
 	return simple_read_from_buffer(buffer, count, ppos, in_buffer, len);
 }
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/serial/kobil_sct.c linux-libre-4.4.160-gnu/drivers/usb/serial/kobil_sct.c
--- linux-libre-4.4.159-gnu/drivers/usb/serial/kobil_sct.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/serial/kobil_sct.c	2018-10-10 02:52:13.000000000 -0400
@@ -408,12 +408,20 @@ static int kobil_tiocmget(struct tty_str
 			  transfer_buffer_length,
 			  KOBIL_TIMEOUT);
 
-	dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n",
-		__func__, result, transfer_buffer[0]);
+	dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n",
+			result);
+	if (result < 1) {
+		if (result >= 0)
+			result = -EIO;
+		goto out_free;
+	}
+
+	dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]);
 
 	result = 0;
 	if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
 		result = TIOCM_DSR;
+out_free:
 	kfree(transfer_buffer);
 	return result;
 }
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/usb/wusbcore/security.c linux-libre-4.4.160-gnu/drivers/usb/wusbcore/security.c
--- linux-libre-4.4.159-gnu/drivers/usb/wusbcore/security.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/usb/wusbcore/security.c	2018-10-10 02:52:13.000000000 -0400
@@ -230,7 +230,7 @@ int wusb_dev_sec_add(struct wusbhc *wusb
 
 	result = usb_get_descriptor(usb_dev, USB_DT_SECURITY,
 				    0, secd, sizeof(*secd));
-	if (result < sizeof(*secd)) {
+	if (result < (int)sizeof(*secd)) {
 		dev_err(dev, "Can't read security descriptor or "
 			"not enough data: %d\n", result);
 		goto out;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/uwb/hwa-rc.c linux-libre-4.4.160-gnu/drivers/uwb/hwa-rc.c
--- linux-libre-4.4.159-gnu/drivers/uwb/hwa-rc.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/uwb/hwa-rc.c	2018-10-10 02:52:13.000000000 -0400
@@ -875,6 +875,7 @@ error_get_version:
 error_rc_add:
 	usb_put_intf(iface);
 	usb_put_dev(hwarc->usb_dev);
+	kfree(hwarc);
 error_alloc:
 	uwb_rc_put(uwb_rc);
 error_rc_alloc:
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/xen/cpu_hotplug.c linux-libre-4.4.160-gnu/drivers/xen/cpu_hotplug.c
--- linux-libre-4.4.159-gnu/drivers/xen/cpu_hotplug.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/xen/cpu_hotplug.c	2018-10-10 02:52:13.000000000 -0400
@@ -18,15 +18,16 @@ static void enable_hotplug_cpu(int cpu)
 
 static void disable_hotplug_cpu(int cpu)
 {
-	if (cpu_online(cpu)) {
-		lock_device_hotplug();
+	if (!cpu_is_hotpluggable(cpu))
+		return;
+	lock_device_hotplug();
+	if (cpu_online(cpu))
 		device_offline(get_cpu_device(cpu));
-		unlock_device_hotplug();
-	}
-	if (cpu_present(cpu))
+	if (!cpu_online(cpu) && cpu_present(cpu)) {
 		xen_arch_unregister_cpu(cpu);
-
-	set_cpu_present(cpu, false);
+		set_cpu_present(cpu, false);
+	}
+	unlock_device_hotplug();
 }
 
 static int vcpu_online(unsigned int cpu)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/xen/events/events_base.c linux-libre-4.4.160-gnu/drivers/xen/events/events_base.c
--- linux-libre-4.4.159-gnu/drivers/xen/events/events_base.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/xen/events/events_base.c	2018-10-10 02:52:13.000000000 -0400
@@ -139,7 +139,7 @@ static int set_evtchn_to_irq(unsigned ev
 		clear_evtchn_to_irq_row(row);
 	}
 
-	evtchn_to_irq[EVTCHN_ROW(evtchn)][EVTCHN_COL(evtchn)] = irq;
+	evtchn_to_irq[row][col] = irq;
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/drivers/xen/manage.c linux-libre-4.4.160-gnu/drivers/xen/manage.c
--- linux-libre-4.4.159-gnu/drivers/xen/manage.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/drivers/xen/manage.c	2018-10-10 02:52:13.000000000 -0400
@@ -280,9 +280,11 @@ static void sysrq_handler(struct xenbus_
 		/*
 		 * The Xenstore watch fires directly after registering it and
 		 * after a suspend/resume cycle. So ENOENT is no error but
-		 * might happen in those cases.
+		 * might happen in those cases. ERANGE is observed when we get
+		 * an empty value (''), this happens when we acknowledge the
+		 * request by writing '\0' below.
 		 */
-		if (err != -ENOENT)
+		if (err != -ENOENT && err != -ERANGE)
 			pr_err("Error %d reading sysrq code in control/sysrq\n",
 			       err);
 		xenbus_transaction_end(xbt, 1);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/cifs/cifssmb.c linux-libre-4.4.160-gnu/fs/cifs/cifssmb.c
--- linux-libre-4.4.159-gnu/fs/cifs/cifssmb.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/cifs/cifssmb.c	2018-10-10 02:52:13.000000000 -0400
@@ -577,10 +577,15 @@ CIFSSMBNegotiate(const unsigned int xid,
 	}
 
 	count = 0;
+	/*
+	 * We know that all the name entries in the protocols array
+	 * are short (< 16 bytes anyway) and are NUL terminated.
+	 */
 	for (i = 0; i < CIFS_NUM_PROT; i++) {
-		strncpy(pSMB->DialectsArray+count, protocols[i].name, 16);
-		count += strlen(protocols[i].name) + 1;
-		/* null at end of source and target buffers anyway */
+		size_t len = strlen(protocols[i].name) + 1;
+
+		memcpy(pSMB->DialectsArray+count, protocols[i].name, len);
+		count += len;
 	}
 	inc_rfc1001_len(pSMB, count);
 	pSMB->ByteCount = cpu_to_le16(count);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/cifs/cifs_unicode.c linux-libre-4.4.160-gnu/fs/cifs/cifs_unicode.c
--- linux-libre-4.4.159-gnu/fs/cifs/cifs_unicode.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/cifs/cifs_unicode.c	2018-10-10 02:52:13.000000000 -0400
@@ -101,9 +101,6 @@ convert_sfm_char(const __u16 src_char, c
 	case SFM_LESSTHAN:
 		*target = '<';
 		break;
-	case SFM_SLASH:
-		*target = '\\';
-		break;
 	case SFM_SPACE:
 		*target = ' ';
 		break;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/cifs/misc.c linux-libre-4.4.160-gnu/fs/cifs/misc.c
--- linux-libre-4.4.159-gnu/fs/cifs/misc.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/cifs/misc.c	2018-10-10 02:52:13.000000000 -0400
@@ -406,9 +406,17 @@ is_valid_oplock_break(char *buffer, stru
 			(struct smb_com_transaction_change_notify_rsp *)buf;
 		struct file_notify_information *pnotify;
 		__u32 data_offset = 0;
+		size_t len = srv->total_read - sizeof(pSMBr->hdr.smb_buf_length);
+
 		if (get_bcc(buf) > sizeof(struct file_notify_information)) {
 			data_offset = le32_to_cpu(pSMBr->DataOffset);
 
+			if (data_offset >
+			    len - sizeof(struct file_notify_information)) {
+				cifs_dbg(FYI, "invalid data_offset %u\n",
+					 data_offset);
+				return true;
+			}
 			pnotify = (struct file_notify_information *)
 				((char *)&pSMBr->hdr.Protocol + data_offset);
 			cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n",
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/cifs/smb2ops.c linux-libre-4.4.160-gnu/fs/cifs/smb2ops.c
--- linux-libre-4.4.159-gnu/fs/cifs/smb2ops.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/cifs/smb2ops.c	2018-10-10 02:52:13.000000000 -0400
@@ -914,7 +914,7 @@ smb2_query_dir_first(const unsigned int
 	}
 
 	srch_inf->entries_in_buffer = 0;
-	srch_inf->index_of_last_entry = 0;
+	srch_inf->index_of_last_entry = 2;
 
 	rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
 				  fid->volatile_fid, 0, srch_inf);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/ext4/xattr.c linux-libre-4.4.160-gnu/fs/ext4/xattr.c
--- linux-libre-4.4.159-gnu/fs/ext4/xattr.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/ext4/xattr.c	2018-10-10 02:52:13.000000000 -0400
@@ -1386,6 +1386,11 @@ retry:
 		/* Find the entry best suited to be pushed into EA block */
 		entry = NULL;
 		for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) {
+			/* never move system.data out of the inode */
+			if ((last->e_name_len == 4) &&
+			    (last->e_name_index == EXT4_XATTR_INDEX_SYSTEM) &&
+			    !memcmp(last->e_name, "data", 4))
+				continue;
 			total_size =
 			EXT4_XATTR_SIZE(le32_to_cpu(last->e_value_size)) +
 					EXT4_XATTR_LEN(last->e_name_len);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/nfsd/nfs4proc.c linux-libre-4.4.160-gnu/fs/nfsd/nfs4proc.c
--- linux-libre-4.4.159-gnu/fs/nfsd/nfs4proc.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/nfsd/nfs4proc.c	2018-10-10 02:52:13.000000000 -0400
@@ -1632,6 +1632,7 @@ nfsd4_proc_compound(struct svc_rqst *rqs
 	if (status) {
 		op = &args->ops[0];
 		op->status = status;
+		resp->opcnt = 1;
 		goto encode_op;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/ocfs2/dlm/dlmmaster.c linux-libre-4.4.160-gnu/fs/ocfs2/dlm/dlmmaster.c
--- linux-libre-4.4.159-gnu/fs/ocfs2/dlm/dlmmaster.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/ocfs2/dlm/dlmmaster.c	2018-10-10 02:52:13.000000000 -0400
@@ -589,9 +589,9 @@ static void dlm_init_lockres(struct dlm_
 
 	res->last_used = 0;
 
-	spin_lock(&dlm->spinlock);
+	spin_lock(&dlm->track_lock);
 	list_add_tail(&res->tracking, &dlm->tracking_list);
-	spin_unlock(&dlm->spinlock);
+	spin_unlock(&dlm->track_lock);
 
 	memset(res->lvb, 0, DLM_LVB_LEN);
 	memset(res->refmap, 0, sizeof(res->refmap));
diff -druNp --no-dereference linux-libre-4.4.159-gnu/fs/proc/base.c linux-libre-4.4.160-gnu/fs/proc/base.c
--- linux-libre-4.4.159-gnu/fs/proc/base.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/fs/proc/base.c	2018-10-10 02:52:13.000000000 -0400
@@ -471,6 +471,20 @@ static int proc_pid_stack(struct seq_fil
 	int err;
 	int i;
 
+	/*
+	 * The ability to racily run the kernel stack unwinder on a running task
+	 * and then observe the unwinder output is scary; while it is useful for
+	 * debugging kernel issues, it can also allow an attacker to leak kernel
+	 * stack contents.
+	 * Doing this in a manner that is at least safe from races would require
+	 * some work to ensure that the remote task can not be scheduled; and
+	 * even then, this would still expose the unwinder as local attack
+	 * surface.
+	 * Therefore, this interface is restricted to root.
+	 */
+	if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))
+		return -EACCES;
+
 	entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL);
 	if (!entries)
 		return -ENOMEM;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/include/linux/platform_data/ina2xx.h linux-libre-4.4.160-gnu/include/linux/platform_data/ina2xx.h
--- linux-libre-4.4.159-gnu/include/linux/platform_data/ina2xx.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/include/linux/platform_data/ina2xx.h	2018-10-10 02:52:13.000000000 -0400
@@ -1,7 +1,7 @@
 /*
  * Driver for Texas Instruments INA219, INA226 power monitor chips
  *
- * Copyright (C) 2012 Lothar Felten <l-felten@ti.com>
+ * Copyright (C) 2012 Lothar Felten <lothar.felten@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
diff -druNp --no-dereference linux-libre-4.4.159-gnu/include/linux/slub_def.h linux-libre-4.4.160-gnu/include/linux/slub_def.h
--- linux-libre-4.4.159-gnu/include/linux/slub_def.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/include/linux/slub_def.h	2018-10-10 02:52:13.000000000 -0400
@@ -67,7 +67,8 @@ struct kmem_cache {
 	int size;		/* The size of an object including meta data */
 	int object_size;	/* The size of an object without meta data */
 	int offset;		/* Free pointer offset. */
-	int cpu_partial;	/* Number of per cpu partial objects to keep around */
+	/* Number of per cpu partial objects to keep around */
+	unsigned int cpu_partial;
 	struct kmem_cache_order_objects oo;
 
 	/* Allocation and freeing of slabs */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/include/media/v4l2-fh.h linux-libre-4.4.160-gnu/include/media/v4l2-fh.h
--- linux-libre-4.4.159-gnu/include/media/v4l2-fh.h	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/include/media/v4l2-fh.h	2018-10-10 02:52:13.000000000 -0400
@@ -43,6 +43,7 @@ struct v4l2_fh {
 	wait_queue_head_t	wait;
 	struct list_head	subscribed; /* Subscribed events */
 	struct list_head	available; /* Dequeueable event */
+	struct mutex		subscribe_lock;
 	unsigned int		navailable;
 	u32			sequence;
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/kernel/module.c linux-libre-4.4.160-gnu/kernel/module.c
--- linux-libre-4.4.159-gnu/kernel/module.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/kernel/module.c	2018-10-10 02:52:13.000000000 -0400
@@ -3860,7 +3860,7 @@ static unsigned long mod_find_symname(st
 
 	for (i = 0; i < kallsyms->num_symtab; i++)
 		if (strcmp(name, symname(kallsyms, i)) == 0 &&
-		    kallsyms->symtab[i].st_info != 'U')
+		    kallsyms->symtab[i].st_shndx != SHN_UNDEF)
 			return kallsyms->symtab[i].st_value;
 	return 0;
 }
@@ -3906,6 +3906,10 @@ int module_kallsyms_on_each_symbol(int (
 		if (mod->state == MODULE_STATE_UNFORMED)
 			continue;
 		for (i = 0; i < kallsyms->num_symtab; i++) {
+
+			if (kallsyms->symtab[i].st_shndx == SHN_UNDEF)
+				continue;
+
 			ret = fn(data, symname(kallsyms, i),
 				 mod, kallsyms->symtab[i].st_value);
 			if (ret != 0)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/kernel/time/alarmtimer.c linux-libre-4.4.160-gnu/kernel/time/alarmtimer.c
--- linux-libre-4.4.159-gnu/kernel/time/alarmtimer.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/kernel/time/alarmtimer.c	2018-10-10 02:52:13.000000000 -0400
@@ -773,7 +773,8 @@ static int alarm_timer_nsleep(const cloc
 	/* Convert (if necessary) to absolute time */
 	if (flags != TIMER_ABSTIME) {
 		ktime_t now = alarm_bases[type].gettime();
-		exp = ktime_add(now, exp);
+
+		exp = ktime_add_safe(now, exp);
 	}
 
 	if (alarmtimer_do_nsleep(&alarm, exp))
diff -druNp --no-dereference linux-libre-4.4.159-gnu/lib/klist.c linux-libre-4.4.160-gnu/lib/klist.c
--- linux-libre-4.4.159-gnu/lib/klist.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/lib/klist.c	2018-10-10 02:52:13.000000000 -0400
@@ -336,8 +336,9 @@ struct klist_node *klist_prev(struct kli
 	void (*put)(struct klist_node *) = i->i_klist->put;
 	struct klist_node *last = i->i_cur;
 	struct klist_node *prev;
+	unsigned long flags;
 
-	spin_lock(&i->i_klist->k_lock);
+	spin_lock_irqsave(&i->i_klist->k_lock, flags);
 
 	if (last) {
 		prev = to_klist_node(last->n_node.prev);
@@ -356,7 +357,7 @@ struct klist_node *klist_prev(struct kli
 		prev = to_klist_node(prev->n_node.prev);
 	}
 
-	spin_unlock(&i->i_klist->k_lock);
+	spin_unlock_irqrestore(&i->i_klist->k_lock, flags);
 
 	if (put && last)
 		put(last);
@@ -377,8 +378,9 @@ struct klist_node *klist_next(struct kli
 	void (*put)(struct klist_node *) = i->i_klist->put;
 	struct klist_node *last = i->i_cur;
 	struct klist_node *next;
+	unsigned long flags;
 
-	spin_lock(&i->i_klist->k_lock);
+	spin_lock_irqsave(&i->i_klist->k_lock, flags);
 
 	if (last) {
 		next = to_klist_node(last->n_node.next);
@@ -397,7 +399,7 @@ struct klist_node *klist_next(struct kli
 		next = to_klist_node(next->n_node.next);
 	}
 
-	spin_unlock(&i->i_klist->k_lock);
+	spin_unlock_irqrestore(&i->i_klist->k_lock, flags);
 
 	if (put && last)
 		put(last);
diff -druNp --no-dereference linux-libre-4.4.159-gnu/Makefile linux-libre-4.4.160-gnu/Makefile
--- linux-libre-4.4.159-gnu/Makefile	2018-09-29 11:18:05.000000000 -0400
+++ linux-libre-4.4.160-gnu/Makefile	2018-10-10 12:11:11.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 159
+SUBLEVEL = 160
 EXTRAVERSION = -gnu
 NAME = Blurry Fish Butt
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/mm/madvise.c linux-libre-4.4.160-gnu/mm/madvise.c
--- linux-libre-4.4.159-gnu/mm/madvise.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/mm/madvise.c	2018-10-10 02:52:13.000000000 -0400
@@ -76,7 +76,7 @@ static long madvise_behavior(struct vm_a
 		new_flags |= VM_DONTDUMP;
 		break;
 	case MADV_DODUMP:
-		if (new_flags & VM_SPECIAL) {
+		if (!is_vm_hugetlb_page(vma) && new_flags & VM_SPECIAL) {
 			error = -EINVAL;
 			goto out;
 		}
diff -druNp --no-dereference linux-libre-4.4.159-gnu/mm/slub.c linux-libre-4.4.160-gnu/mm/slub.c
--- linux-libre-4.4.159-gnu/mm/slub.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/mm/slub.c	2018-10-10 02:52:13.000000000 -0400
@@ -1661,7 +1661,7 @@ static void *get_partial_node(struct kme
 {
 	struct page *page, *page2;
 	void *object = NULL;
-	int available = 0;
+	unsigned int available = 0;
 	int objects;
 
 	/*
@@ -4674,10 +4674,10 @@ static ssize_t cpu_partial_show(struct k
 static ssize_t cpu_partial_store(struct kmem_cache *s, const char *buf,
 				 size_t length)
 {
-	unsigned long objects;
+	unsigned int objects;
 	int err;
 
-	err = kstrtoul(buf, 10, &objects);
+	err = kstrtouint(buf, 10, &objects);
 	if (err)
 		return err;
 	if (objects && !kmem_cache_has_cpu_partial(s))
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/6lowpan/iphc.c linux-libre-4.4.160-gnu/net/6lowpan/iphc.c
--- linux-libre-4.4.159-gnu/net/6lowpan/iphc.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/6lowpan/iphc.c	2018-10-10 02:52:13.000000000 -0400
@@ -569,6 +569,7 @@ int lowpan_header_decompress(struct sk_b
 		hdr.hop_limit, &hdr.daddr);
 
 	skb_push(skb, sizeof(hdr));
+	skb_reset_mac_header(skb);
 	skb_reset_network_header(skb);
 	skb_copy_to_linear_data(skb, &hdr, sizeof(hdr));
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/mac80211/ibss.c linux-libre-4.4.160-gnu/net/mac80211/ibss.c
--- linux-libre-4.4.159-gnu/net/mac80211/ibss.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/mac80211/ibss.c	2018-10-10 02:52:13.000000000 -0400
@@ -948,8 +948,8 @@ static void ieee80211_rx_mgmt_deauth_ibs
 	if (len < IEEE80211_DEAUTH_FRAME_LEN)
 		return;
 
-	ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM BSSID=%pM (reason: %d)\n",
-		 mgmt->sa, mgmt->da, mgmt->bssid, reason);
+	ibss_dbg(sdata, "RX DeAuth SA=%pM DA=%pM\n", mgmt->sa, mgmt->da);
+	ibss_dbg(sdata, "\tBSSID=%pM (reason: %d)\n", mgmt->bssid, reason);
 	sta_info_destroy_addr(sdata, mgmt->sa);
 }
 
@@ -967,9 +967,9 @@ static void ieee80211_rx_mgmt_auth_ibss(
 	auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
 	auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
 
-	ibss_dbg(sdata,
-		 "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
-		 mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
+	ibss_dbg(sdata, "RX Auth SA=%pM DA=%pM\n", mgmt->sa, mgmt->da);
+	ibss_dbg(sdata, "\tBSSID=%pM (auth_transaction=%d)\n",
+		 mgmt->bssid, auth_transaction);
 
 	if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
 		return;
@@ -1174,10 +1174,10 @@ static void ieee80211_rx_bss_info(struct
 		rx_timestamp = drv_get_tsf(local, sdata);
 	}
 
-	ibss_dbg(sdata,
-		 "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
+	ibss_dbg(sdata, "RX beacon SA=%pM BSSID=%pM TSF=0x%llx\n",
 		 mgmt->sa, mgmt->bssid,
-		 (unsigned long long)rx_timestamp,
+		 (unsigned long long)rx_timestamp);
+	ibss_dbg(sdata, "\tBCN=0x%llx diff=%lld @%lu\n",
 		 (unsigned long long)beacon_timestamp,
 		 (unsigned long long)(rx_timestamp - beacon_timestamp),
 		 jiffies);
@@ -1536,9 +1536,9 @@ static void ieee80211_rx_mgmt_probe_req(
 
 	tx_last_beacon = drv_tx_last_beacon(local);
 
-	ibss_dbg(sdata,
-		 "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
-		 mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
+	ibss_dbg(sdata, "RX ProbeReq SA=%pM DA=%pM\n", mgmt->sa, mgmt->da);
+	ibss_dbg(sdata, "\tBSSID=%pM (tx_last_beacon=%d)\n",
+		 mgmt->bssid, tx_last_beacon);
 
 	if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
 		return;
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/mac80211/main.c linux-libre-4.4.160-gnu/net/mac80211/main.c
--- linux-libre-4.4.159-gnu/net/mac80211/main.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/mac80211/main.c	2018-10-10 02:52:13.000000000 -0400
@@ -253,8 +253,27 @@ static void ieee80211_restart_work(struc
 	     "%s called with hardware scan in progress\n", __func__);
 
 	rtnl_lock();
-	list_for_each_entry(sdata, &local->interfaces, list)
+	list_for_each_entry(sdata, &local->interfaces, list) {
+		/*
+		 * XXX: there may be more work for other vif types and even
+		 * for station mode: a good thing would be to run most of
+		 * the iface type's dependent _stop (ieee80211_mg_stop,
+		 * ieee80211_ibss_stop) etc...
+		 * For now, fix only the specific bug that was seen: race
+		 * between csa_connection_drop_work and us.
+		 */
+		if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+			/*
+			 * This worker is scheduled from the iface worker that
+			 * runs on mac80211's workqueue, so we can't be
+			 * scheduling this worker after the cancel right here.
+			 * The exception is ieee80211_chswitch_done.
+			 * Then we can have a race...
+			 */
+			cancel_work_sync(&sdata->u.mgd.csa_connection_drop_work);
+		}
 		flush_delayed_work(&sdata->dec_tailroom_needed_wk);
+	}
 	ieee80211_scan_cancel(local);
 	ieee80211_reconfig(local);
 	rtnl_unlock();
@@ -460,10 +479,7 @@ static const struct ieee80211_vht_cap ma
 		cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC |
 			    IEEE80211_VHT_CAP_SHORT_GI_80 |
 			    IEEE80211_VHT_CAP_SHORT_GI_160 |
-			    IEEE80211_VHT_CAP_RXSTBC_1 |
-			    IEEE80211_VHT_CAP_RXSTBC_2 |
-			    IEEE80211_VHT_CAP_RXSTBC_3 |
-			    IEEE80211_VHT_CAP_RXSTBC_4 |
+			    IEEE80211_VHT_CAP_RXSTBC_MASK |
 			    IEEE80211_VHT_CAP_TXSTBC |
 			    IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
 			    IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/mac80211/mesh_hwmp.c linux-libre-4.4.160-gnu/net/mac80211/mesh_hwmp.c
--- linux-libre-4.4.159-gnu/net/mac80211/mesh_hwmp.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/mac80211/mesh_hwmp.c	2018-10-10 02:52:13.000000000 -0400
@@ -552,6 +552,10 @@ static void hwmp_preq_frame_process(stru
 		forward = false;
 		reply = true;
 		target_metric = 0;
+
+		if (SN_GT(target_sn, ifmsh->sn))
+			ifmsh->sn = target_sn;
+
 		if (time_after(jiffies, ifmsh->last_sn_update +
 					net_traversal_jiffies(sdata)) ||
 		    time_before(jiffies, ifmsh->last_sn_update)) {
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/mac80211/mlme.c linux-libre-4.4.160-gnu/net/mac80211/mlme.c
--- linux-libre-4.4.159-gnu/net/mac80211/mlme.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/mac80211/mlme.c	2018-10-10 02:52:13.000000000 -0400
@@ -1021,6 +1021,10 @@ static void ieee80211_chswitch_work(stru
 	 */
 
 	if (sdata->reserved_chanctx) {
+		struct ieee80211_supported_band *sband = NULL;
+		struct sta_info *mgd_sta = NULL;
+		enum ieee80211_sta_rx_bandwidth bw = IEEE80211_STA_RX_BW_20;
+
 		/*
 		 * with multi-vif csa driver may call ieee80211_csa_finish()
 		 * many times while waiting for other interfaces to use their
@@ -1029,6 +1033,48 @@ static void ieee80211_chswitch_work(stru
 		if (sdata->reserved_ready)
 			goto out;
 
+		if (sdata->vif.bss_conf.chandef.width !=
+		    sdata->csa_chandef.width) {
+			/*
+			 * For managed interface, we need to also update the AP
+			 * station bandwidth and align the rate scale algorithm
+			 * on the bandwidth change. Here we only consider the
+			 * bandwidth of the new channel definition (as channel
+			 * switch flow does not have the full HT/VHT/HE
+			 * information), assuming that if additional changes are
+			 * required they would be done as part of the processing
+			 * of the next beacon from the AP.
+			 */
+			switch (sdata->csa_chandef.width) {
+			case NL80211_CHAN_WIDTH_20_NOHT:
+			case NL80211_CHAN_WIDTH_20:
+			default:
+				bw = IEEE80211_STA_RX_BW_20;
+				break;
+			case NL80211_CHAN_WIDTH_40:
+				bw = IEEE80211_STA_RX_BW_40;
+				break;
+			case NL80211_CHAN_WIDTH_80:
+				bw = IEEE80211_STA_RX_BW_80;
+				break;
+			case NL80211_CHAN_WIDTH_80P80:
+			case NL80211_CHAN_WIDTH_160:
+				bw = IEEE80211_STA_RX_BW_160;
+				break;
+			}
+
+			mgd_sta = sta_info_get(sdata, ifmgd->bssid);
+			sband =
+				local->hw.wiphy->bands[sdata->csa_chandef.chan->band];
+		}
+
+		if (sdata->vif.bss_conf.chandef.width >
+		    sdata->csa_chandef.width) {
+			mgd_sta->sta.bandwidth = bw;
+			rate_control_rate_update(local, sband, mgd_sta,
+						 IEEE80211_RC_BW_CHANGED);
+		}
+
 		ret = ieee80211_vif_use_reserved_context(sdata);
 		if (ret) {
 			sdata_info(sdata,
@@ -1039,6 +1085,13 @@ static void ieee80211_chswitch_work(stru
 			goto out;
 		}
 
+		if (sdata->vif.bss_conf.chandef.width <
+		    sdata->csa_chandef.width) {
+			mgd_sta->sta.bandwidth = bw;
+			rate_control_rate_update(local, sband, mgd_sta,
+						 IEEE80211_RC_BW_CHANGED);
+		}
+
 		goto out;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/wireless/nl80211.c linux-libre-4.4.160-gnu/net/wireless/nl80211.c
--- linux-libre-4.4.159-gnu/net/wireless/nl80211.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/wireless/nl80211.c	2018-10-10 02:52:13.000000000 -0400
@@ -10014,6 +10014,7 @@ static int nl80211_update_ft_ies(struct
 		return -EOPNOTSUPP;
 
 	if (!info->attrs[NL80211_ATTR_MDID] ||
+	    !info->attrs[NL80211_ATTR_IE] ||
 	    !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
 		return -EINVAL;
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/net/wireless/util.c linux-libre-4.4.160-gnu/net/wireless/util.c
--- linux-libre-4.4.159-gnu/net/wireless/util.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/net/wireless/util.c	2018-10-10 02:52:13.000000000 -0400
@@ -1360,7 +1360,7 @@ bool ieee80211_chandef_to_operating_clas
 					  u8 *op_class)
 {
 	u8 vht_opclass;
-	u16 freq = chandef->center_freq1;
+	u32 freq = chandef->center_freq1;
 
 	if (freq >= 2412 && freq <= 2472) {
 		if (chandef->width > NL80211_CHAN_WIDTH_40)
diff -druNp --no-dereference linux-libre-4.4.159-gnu/sound/aoa/core/gpio-feature.c linux-libre-4.4.160-gnu/sound/aoa/core/gpio-feature.c
--- linux-libre-4.4.159-gnu/sound/aoa/core/gpio-feature.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/sound/aoa/core/gpio-feature.c	2018-10-10 02:52:13.000000000 -0400
@@ -88,8 +88,10 @@ static struct device_node *get_gpio(char
 	}
 
 	reg = of_get_property(np, "reg", NULL);
-	if (!reg)
+	if (!reg) {
+		of_node_put(np);
 		return NULL;
+	}
 
 	*gpioptr = *reg;
 
diff -druNp --no-dereference linux-libre-4.4.159-gnu/sound/pci/hda/hda_intel.c linux-libre-4.4.160-gnu/sound/pci/hda/hda_intel.c
--- linux-libre-4.4.159-gnu/sound/pci/hda/hda_intel.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/sound/pci/hda/hda_intel.c	2018-10-10 02:52:13.000000000 -0400
@@ -2360,7 +2360,8 @@ static const struct pci_device_id azx_id
 	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
 	/* AMD Raven */
 	{ PCI_DEVICE(0x1022, 0x15e3),
-	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
+	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
+			 AZX_DCAPS_PM_RUNTIME },
 	/* ATI HDMI */
 	{ PCI_DEVICE(0x1002, 0x0002),
 	  .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS },
diff -druNp --no-dereference linux-libre-4.4.159-gnu/sound/pci/hda/patch_realtek.c linux-libre-4.4.160-gnu/sound/pci/hda/patch_realtek.c
--- linux-libre-4.4.159-gnu/sound/pci/hda/patch_realtek.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/sound/pci/hda/patch_realtek.c	2018-10-10 02:52:13.000000000 -0400
@@ -5642,6 +5642,7 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
 	SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
 	SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
+	SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
 	SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
 	SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
 	SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
diff -druNp --no-dereference linux-libre-4.4.159-gnu/sound/soc/soc-dapm.c linux-libre-4.4.160-gnu/sound/soc/soc-dapm.c
--- linux-libre-4.4.159-gnu/sound/soc/soc-dapm.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/sound/soc/soc-dapm.c	2018-10-10 02:52:13.000000000 -0400
@@ -3864,6 +3864,13 @@ int snd_soc_dapm_link_dai_widgets(struct
 			continue;
 		}
 
+		/* let users know there is no DAI to link */
+		if (!dai_w->priv) {
+			dev_dbg(card->dev, "dai widget %s has no DAI\n",
+				dai_w->name);
+			continue;
+		}
+
 		dai = dai_w->priv;
 
 		/* ...find all widgets with the same stream and link them */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/tools/perf/arch/powerpc/util/sym-handling.c linux-libre-4.4.160-gnu/tools/perf/arch/powerpc/util/sym-handling.c
--- linux-libre-4.4.159-gnu/tools/perf/arch/powerpc/util/sym-handling.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/tools/perf/arch/powerpc/util/sym-handling.c	2018-10-10 02:52:13.000000000 -0400
@@ -27,15 +27,16 @@ void arch__elf_sym_adjust(GElf_Sym *sym)
 #endif
 #endif
 
-#if !defined(_CALL_ELF) || _CALL_ELF != 2
 int arch__choose_best_symbol(struct symbol *syma,
 			     struct symbol *symb __maybe_unused)
 {
 	char *sym = syma->name;
 
+#if !defined(_CALL_ELF) || _CALL_ELF != 2
 	/* Skip over any initial dot */
 	if (*sym == '.')
 		sym++;
+#endif
 
 	/* Avoid "SyS" kernel syscall aliases */
 	if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3))
@@ -46,6 +47,7 @@ int arch__choose_best_symbol(struct symb
 	return SYMBOL_A;
 }
 
+#if !defined(_CALL_ELF) || _CALL_ELF != 2
 /* Allow matching against dot variants */
 int arch__compare_symbol_names(const char *namea, const char *nameb)
 {
diff -druNp --no-dereference linux-libre-4.4.159-gnu/tools/vm/page-types.c linux-libre-4.4.160-gnu/tools/vm/page-types.c
--- linux-libre-4.4.159-gnu/tools/vm/page-types.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/tools/vm/page-types.c	2018-10-10 02:52:13.000000000 -0400
@@ -150,12 +150,6 @@ static const char * const page_flag_name
 };
 
 
-static const char * const debugfs_known_mountpoints[] = {
-	"/sys/kernel/debug",
-	"/debug",
-	0,
-};
-
 /*
  * data structures
  */
diff -druNp --no-dereference linux-libre-4.4.159-gnu/tools/vm/slabinfo.c linux-libre-4.4.160-gnu/tools/vm/slabinfo.c
--- linux-libre-4.4.159-gnu/tools/vm/slabinfo.c	2018-09-29 06:08:55.000000000 -0400
+++ linux-libre-4.4.160-gnu/tools/vm/slabinfo.c	2018-10-10 02:52:13.000000000 -0400
@@ -29,8 +29,8 @@ struct slabinfo {
 	int alias;
 	int refs;
 	int aliases, align, cache_dma, cpu_slabs, destroy_by_rcu;
-	int hwcache_align, object_size, objs_per_slab;
-	int sanity_checks, slab_size, store_user, trace;
+	unsigned int hwcache_align, object_size, objs_per_slab;
+	unsigned int sanity_checks, slab_size, store_user, trace;
 	int order, poison, reclaim_account, red_zone;
 	unsigned long partial, objects, slabs, objects_partial, objects_total;
 	unsigned long alloc_fastpath, alloc_slowpath;
