diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/arm/boot/compressed/head.S linux-libre-3.12.66-gnu/arch/arm/boot/compressed/head.S
--- linux-libre-3.12.64-gnu/arch/arm/boot/compressed/head.S	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/arm/boot/compressed/head.S	2016-10-20 04:49:58.000000000 -0400
@@ -734,7 +734,7 @@ __armv7_mmu_cache_on:
 		orrne	r0, r0, #1		@ MMU enabled
 		movne	r1, #0xfffffffd		@ domain 0 = client
 		bic     r6, r6, #1 << 31        @ 32-bit translation system
-		bic     r6, r6, #3 << 0         @ use only ttbr0
+		bic     r6, r6, #(7 << 0) | (1 << 4)	@ use only ttbr0
 		mcrne	p15, 0, r3, c2, c0, 0	@ load page table pointer
 		mcrne	p15, 0, r1, c3, c0, 0	@ load domain access control
 		mcrne   p15, 0, r6, c2, c0, 2   @ load ttb control
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/arm/common/sa1111.c linux-libre-3.12.66-gnu/arch/arm/common/sa1111.c
--- linux-libre-3.12.64-gnu/arch/arm/common/sa1111.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/arm/common/sa1111.c	2016-10-20 04:49:58.000000000 -0400
@@ -872,9 +872,9 @@ struct sa1111_save_data {
 
 #ifdef CONFIG_PM
 
-static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
+static int sa1111_suspend_noirq(struct device *dev)
 {
-	struct sa1111 *sachip = platform_get_drvdata(dev);
+	struct sa1111 *sachip = dev_get_drvdata(dev);
 	struct sa1111_save_data *save;
 	unsigned long flags;
 	unsigned int val;
@@ -937,9 +937,9 @@ static int sa1111_suspend(struct platfor
  *	restored by their respective drivers, and must be called
  *	via LDM after this function.
  */
-static int sa1111_resume(struct platform_device *dev)
+static int sa1111_resume_noirq(struct device *dev)
 {
-	struct sa1111 *sachip = platform_get_drvdata(dev);
+	struct sa1111 *sachip = dev_get_drvdata(dev);
 	struct sa1111_save_data *save;
 	unsigned long flags, id;
 	void __iomem *base;
@@ -955,7 +955,7 @@ static int sa1111_resume(struct platform
 	id = sa1111_readl(sachip->base + SA1111_SKID);
 	if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
 		__sa1111_remove(sachip);
-		platform_set_drvdata(dev, NULL);
+		dev_set_drvdata(dev, NULL);
 		kfree(save);
 		return 0;
 	}
@@ -1006,8 +1006,8 @@ static int sa1111_resume(struct platform
 }
 
 #else
-#define sa1111_suspend NULL
-#define sa1111_resume  NULL
+#define sa1111_suspend_noirq NULL
+#define sa1111_resume_noirq  NULL
 #endif
 
 static int sa1111_probe(struct platform_device *pdev)
@@ -1041,6 +1041,11 @@ static int sa1111_remove(struct platform
 	return 0;
 }
 
+static struct dev_pm_ops sa1111_pm_ops = {
+	.suspend_noirq = sa1111_suspend_noirq,
+	.resume_noirq = sa1111_resume_noirq,
+};
+
 /*
  *	Not sure if this should be on the system bus or not yet.
  *	We really want some way to register a system device at
@@ -1053,11 +1058,10 @@ static int sa1111_remove(struct platform
 static struct platform_driver sa1111_device_driver = {
 	.probe		= sa1111_probe,
 	.remove		= sa1111_remove,
-	.suspend	= sa1111_suspend,
-	.resume		= sa1111_resume,
 	.driver		= {
 		.name	= "sa1111",
 		.owner	= THIS_MODULE,
+		.pm	= &sa1111_pm_ops,
 	},
 };
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/arm/kernel/devtree.c linux-libre-3.12.66-gnu/arch/arm/kernel/devtree.c
--- linux-libre-3.12.64-gnu/arch/arm/kernel/devtree.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/arm/kernel/devtree.c	2016-10-20 04:49:58.000000000 -0400
@@ -90,6 +90,8 @@ void __init arm_dt_init_cpu_maps(void)
 		return;
 
 	for_each_child_of_node(cpus, cpu) {
+		const __be32 *cell;
+		int prop_bytes;
 		u32 hwid;
 
 		if (of_node_cmp(cpu->type, "cpu"))
@@ -101,17 +103,23 @@ void __init arm_dt_init_cpu_maps(void)
 		 * properties is considered invalid to build the
 		 * cpu_logical_map.
 		 */
-		if (of_property_read_u32(cpu, "reg", &hwid)) {
+		cell = of_get_property(cpu, "reg", &prop_bytes);
+		if (!cell || prop_bytes < sizeof(*cell)) {
 			pr_debug(" * %s missing reg property\n",
 				     cpu->full_name);
 			return;
 		}
 
 		/*
-		 * 8 MSBs must be set to 0 in the DT since the reg property
+		 * Bits n:24 must be set to 0 in the DT since the reg property
 		 * defines the MPIDR[23:0].
 		 */
-		if (hwid & ~MPIDR_HWID_BITMASK)
+		do {
+			hwid = be32_to_cpu(*cell++);
+			prop_bytes -= sizeof(*cell);
+		} while (!hwid && prop_bytes > 0);
+
+		if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK))
 			return;
 
 		/*
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/arm/mach-sa1100/generic.c linux-libre-3.12.66-gnu/arch/arm/mach-sa1100/generic.c
--- linux-libre-3.12.64-gnu/arch/arm/mach-sa1100/generic.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/arm/mach-sa1100/generic.c	2016-10-20 04:49:58.000000000 -0400
@@ -31,6 +31,7 @@
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
+#include <mach/reset.h>
 
 #include "generic.h"
 
@@ -134,6 +135,8 @@ static void sa1100_power_off(void)
 
 void sa11x0_restart(enum reboot_mode mode, const char *cmd)
 {
+	clear_reset_status(RESET_STATUS_ALL);
+
 	if (mode == REBOOT_SOFT) {
 		/* Jump into ROM at address 0 */
 		soft_restart(0);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/arm64/kernel/debug-monitors.c linux-libre-3.12.66-gnu/arch/arm64/kernel/debug-monitors.c
--- linux-libre-3.12.64-gnu/arch/arm64/kernel/debug-monitors.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/arm64/kernel/debug-monitors.c	2016-10-20 04:49:58.000000000 -0400
@@ -338,8 +338,10 @@ int kernel_active_single_step(void)
 /* ptrace API */
 void user_enable_single_step(struct task_struct *task)
 {
-	set_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP);
-	set_regs_spsr_ss(task_pt_regs(task));
+	struct thread_info *ti = task_thread_info(task);
+
+	if (!test_and_set_ti_thread_flag(ti, TIF_SINGLESTEP))
+		set_regs_spsr_ss(task_pt_regs(task));
 }
 
 void user_disable_single_step(struct task_struct *task)
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/avr32/mach-at32ap/pio.c linux-libre-3.12.66-gnu/arch/avr32/mach-at32ap/pio.c
--- linux-libre-3.12.64-gnu/arch/avr32/mach-at32ap/pio.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/avr32/mach-at32ap/pio.c	2016-10-20 04:49:58.000000000 -0400
@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platfor
 	struct resource *regs;
 	struct pio_device *pio;
 
-	if (pdev->id > MAX_NR_PIO_DEVICES) {
+	if (pdev->id >= MAX_NR_PIO_DEVICES) {
 		dev_err(&pdev->dev, "only %d PIO devices supported\n",
 			MAX_NR_PIO_DEVICES);
 		return;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/cris/include/asm/Kbuild linux-libre-3.12.66-gnu/arch/cris/include/asm/Kbuild
--- linux-libre-3.12.64-gnu/arch/cris/include/asm/Kbuild	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/cris/include/asm/Kbuild	2016-10-20 04:49:58.000000000 -0400
@@ -1,8 +1,4 @@
 
-header-y += arch-v10/
-header-y += arch-v32/
-
-
 generic-y += clkdev.h
 generic-y += exec.h
 generic-y += kvm_para.h
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/cris/include/uapi/asm/Kbuild linux-libre-3.12.66-gnu/arch/cris/include/uapi/asm/Kbuild
--- linux-libre-3.12.64-gnu/arch/cris/include/uapi/asm/Kbuild	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/cris/include/uapi/asm/Kbuild	2016-10-20 04:49:58.000000000 -0400
@@ -1,8 +1,8 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-header-y += arch-v10/
-header-y += arch-v32/
+header-y += ../arch-v10/arch/
+header-y += ../arch-v32/arch/
 header-y += auxvec.h
 header-y += bitsperlong.h
 header-y += byteorder.h
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/mips/kvm/kvm_mips_emul.c linux-libre-3.12.66-gnu/arch/mips/kvm/kvm_mips_emul.c
--- linux-libre-3.12.64-gnu/arch/mips/kvm/kvm_mips_emul.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/mips/kvm/kvm_mips_emul.c	2016-10-20 04:49:58.000000000 -0400
@@ -310,6 +310,47 @@ enum emulation_result kvm_mips_emul_tlbr
 	return er;
 }
 
+/**
+ * kvm_mips_invalidate_guest_tlb() - Indicates a change in guest MMU map.
+ * @vcpu:	VCPU with changed mappings.
+ * @tlb:	TLB entry being removed.
+ *
+ * This is called to indicate a single change in guest MMU mappings, so that we
+ * can arrange TLB flushes on this and other CPUs.
+ */
+static void kvm_mips_invalidate_guest_tlb(struct kvm_vcpu *vcpu,
+					  struct kvm_mips_tlb *tlb)
+{
+	int cpu, i;
+	bool user;
+
+	/* No need to flush for entries which are already invalid */
+	if (!((tlb->tlb_lo[0] | tlb->tlb_lo[1]) & ENTRYLO_V))
+		return;
+	/* User address space doesn't need flushing for KSeg2/3 changes */
+	user = tlb->tlb_hi < KVM_GUEST_KSEG0;
+
+	preempt_disable();
+
+	/*
+	 * Probe the shadow host TLB for the entry being overwritten, if one
+	 * matches, invalidate it
+	 */
+	kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi);
+
+	/* Invalidate the whole ASID on other CPUs */
+	cpu = smp_processor_id();
+	for_each_possible_cpu(i) {
+		if (i == cpu)
+			continue;
+		if (user)
+			vcpu->arch.guest_user_asid[i] = 0;
+		vcpu->arch.guest_kernel_asid[i] = 0;
+	}
+
+	preempt_enable();
+}
+
 /* Write Guest TLB Entry @ Index */
 enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
 {
@@ -332,8 +373,8 @@ enum emulation_result kvm_mips_emul_tlbw
 
 	tlb = &vcpu->arch.guest_tlb[index];
 #if 1
-	/* Probe the shadow host TLB for the entry being overwritten, if one matches, invalidate it */
-	kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi);
+
+	kvm_mips_invalidate_guest_tlb(vcpu, tlb);
 #endif
 
 	tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0);
@@ -374,8 +415,7 @@ enum emulation_result kvm_mips_emul_tlbw
 	tlb = &vcpu->arch.guest_tlb[index];
 
 #if 1
-	/* Probe the shadow host TLB for the entry being overwritten, if one matches, invalidate it */
-	kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi);
+	kvm_mips_invalidate_guest_tlb(vcpu, tlb);
 #endif
 
 	tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0);
@@ -419,6 +459,7 @@ kvm_mips_emulate_CP0(uint32_t inst, uint
 	int32_t rt, rd, copz, sel, co_bit, op;
 	uint32_t pc = vcpu->arch.pc;
 	unsigned long curr_pc;
+	int cpu, i;
 
 	/*
 	 * Update PC and hold onto current PC in case there is
@@ -538,8 +579,16 @@ kvm_mips_emulate_CP0(uint32_t inst, uint
 					     ASID_MASK,
 					     vcpu->arch.gprs[rt] & ASID_MASK);
 
+					preempt_disable();
 					/* Blow away the shadow host TLBs */
 					kvm_mips_flush_host_tlb(1);
+					cpu = smp_processor_id();
+					for_each_possible_cpu(i)
+						if (i != cpu) {
+							vcpu->arch.guest_user_asid[i] = 0;
+							vcpu->arch.guest_kernel_asid[i] = 0;
+						}
+					preempt_enable();
 				}
 				kvm_write_c0_guest_entryhi(cop0,
 							   vcpu->arch.gprs[rt]);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/mips/mti-malta/malta-setup.c linux-libre-3.12.66-gnu/arch/mips/mti-malta/malta-setup.c
--- linux-libre-3.12.64-gnu/arch/mips/mti-malta/malta-setup.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/mips/mti-malta/malta-setup.c	2016-10-20 04:49:58.000000000 -0400
@@ -36,6 +36,9 @@
 #include <linux/console.h>
 #endif
 
+#define ROCIT_CONFIG_GEN0		0x1f403000
+#define  ROCIT_CONFIG_GEN0_PCI_IOCU	BIT(7)
+
 extern void malta_be_init(void);
 extern int malta_be_handler(struct pt_regs *regs, int is_fixup);
 
@@ -108,6 +111,8 @@ static void __init fd_activate(void)
 static int __init plat_enable_iocoherency(void)
 {
 	int supported = 0;
+	u32 cfg;
+
 	if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
 		if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
 			BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
@@ -130,7 +135,8 @@ static int __init plat_enable_iocoherenc
 	} else if (gcmp_niocu() != 0) {
 		/* Nothing special needs to be done to enable coherency */
 		pr_info("CMP IOCU detected\n");
-		if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) {
+		cfg = __raw_readl((u32 *)CKSEG1ADDR(ROCIT_CONFIG_GEN0));
+		if (!(cfg & ROCIT_CONFIG_GEN0_PCI_IOCU)) {
 			pr_crit("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n");
 			return 0;
 		}
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/powerpc/include/asm/reg.h linux-libre-3.12.66-gnu/arch/powerpc/include/asm/reg.h
--- linux-libre-3.12.64-gnu/arch/powerpc/include/asm/reg.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/powerpc/include/asm/reg.h	2016-10-20 04:49:58.000000000 -0400
@@ -648,6 +648,7 @@
 #define   MMCR0_FCHV	0x00000001UL /* freeze conditions in hypervisor mode */
 #define SPRN_MMCR1	798
 #define SPRN_MMCR2	785
+#define SPRN_UMMCR2	769
 #define SPRN_MMCRA	0x312
 #define   MMCRA_SDSYNC	0x80000000UL /* SDAR synced with SIAR */
 #define   MMCRA_SDAR_DCACHE_MISS 0x40000000UL
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/powerpc/kernel/prom_init.c linux-libre-3.12.66-gnu/arch/powerpc/kernel/prom_init.c
--- linux-libre-3.12.64-gnu/arch/powerpc/kernel/prom_init.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/powerpc/kernel/prom_init.c	2016-10-20 04:49:58.000000000 -0400
@@ -642,6 +642,15 @@ static void __init early_cmdline_parse(v
 #define W(x)	((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
 		((x) >> 8) & 0xff, (x) & 0xff
 
+/* Firmware expects the value to be n - 1, where n is the # of vectors */
+#define NUM_VECTORS(n)		((n) - 1)
+
+/*
+ * Firmware expects 1 + n - 2, where n is the length of the option vector in
+ * bytes. The 1 accounts for the length byte itself, the - 2 .. ?
+ */
+#define VECTOR_LENGTH(n)	(1 + (n) - 2)
+
 unsigned char ibm_architecture_vec[] = {
 	W(0xfffe0000), W(0x003a0000),	/* POWER5/POWER5+ */
 	W(0xffff0000), W(0x003e0000),	/* POWER6 */
@@ -652,16 +661,16 @@ unsigned char ibm_architecture_vec[] = {
 	W(0xffffffff), W(0x0f000003),	/* all 2.06-compliant */
 	W(0xffffffff), W(0x0f000002),	/* all 2.05-compliant */
 	W(0xfffffffe), W(0x0f000001),	/* all 2.04-compliant and earlier */
-	6 - 1,				/* 6 option vectors */
+	NUM_VECTORS(6),			/* 6 option vectors */
 
 	/* option vector 1: processor architectures supported */
-	3 - 2,				/* length */
+	VECTOR_LENGTH(2),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
 	OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
 
 	/* option vector 2: Open Firmware options supported */
-	34 - 2,				/* length */
+	VECTOR_LENGTH(33),		/* length */
 	OV2_REAL_MODE,
 	0, 0,
 	W(0xffffffff),			/* real_base */
@@ -675,17 +684,17 @@ unsigned char ibm_architecture_vec[] = {
 	48,				/* max log_2(hash table size) */
 
 	/* option vector 3: processor options supported */
-	3 - 2,				/* length */
+	VECTOR_LENGTH(2),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV3_FP | OV3_VMX | OV3_DFP,
 
 	/* option vector 4: IBM PAPR implementation */
-	3 - 2,				/* length */
+	VECTOR_LENGTH(2),		/* length */
 	0,				/* don't halt */
 	OV4_MIN_ENT_CAP,		/* minimum VP entitled capacity */
 
 	/* option vector 5: PAPR/OF options */
-	19 - 2,				/* length */
+	VECTOR_LENGTH(21),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
 	OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
@@ -716,14 +725,17 @@ unsigned char ibm_architecture_vec[] = {
 	0,
 	0,
 	OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
-	OV5_FEAT(OV5_PFO_HW_842),
-	OV5_FEAT(OV5_SUB_PROCESSORS),
+	OV5_FEAT(OV5_PFO_HW_842),				/* Byte 17 */
+	0,							/* Byte 18 */
+	0,							/* Byte 19 */
+	0,							/* Byte 20 */
+	OV5_FEAT(OV5_SUB_PROCESSORS),				/* Byte 21 */
+
 	/* option vector 6: IBM PAPR hints */
-	4 - 2,				/* length */
+	VECTOR_LENGTH(3),		/* length */
 	0,
 	0,
 	OV6_LINUX,
-
 };
 
 /* Old method - ELF header with PT_NOTE sections only works on BE */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/powerpc/kernel/ptrace.c linux-libre-3.12.66-gnu/arch/powerpc/kernel/ptrace.c
--- linux-libre-3.12.64-gnu/arch/powerpc/kernel/ptrace.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/powerpc/kernel/ptrace.c	2016-10-20 04:49:58.000000000 -0400
@@ -376,7 +376,7 @@ static int fpr_get(struct task_struct *t
 
 #else
 	BUILD_BUG_ON(offsetof(struct thread_struct, fpscr) !=
-		     offsetof(struct thread_struct, TS_FPR(32)));
+		     offsetof(struct thread_struct, fpr[32]));
 
 	return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 				   &target->thread.fpr, 0, -1);
@@ -404,7 +404,7 @@ static int fpr_set(struct task_struct *t
 	return 0;
 #else
 	BUILD_BUG_ON(offsetof(struct thread_struct, fpscr) !=
-		     offsetof(struct thread_struct, TS_FPR(32)));
+		     offsetof(struct thread_struct, fpr[32]));
 
 	return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				  &target->thread.fpr, 0, -1);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/powerpc/kvm/book3s_emulate.c linux-libre-3.12.66-gnu/arch/powerpc/kvm/book3s_emulate.c
--- linux-libre-3.12.64-gnu/arch/powerpc/kvm/book3s_emulate.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/powerpc/kvm/book3s_emulate.c	2016-10-20 04:49:58.000000000 -0400
@@ -459,6 +459,14 @@ int kvmppc_core_emulate_mtspr(struct kvm
 	case SPRN_WPAR_GEKKO:
 	case SPRN_MSSSR0:
 	case SPRN_DABR:
+#ifdef CONFIG_PPC_BOOK3S_64
+	case SPRN_MMCRS:
+	case SPRN_MMCRA:
+	case SPRN_MMCR0:
+	case SPRN_MMCR1:
+	case SPRN_MMCR2:
+	case SPRN_UMMCR2:
+#endif
 		break;
 unprivileged:
 	default:
@@ -557,6 +565,15 @@ int kvmppc_core_emulate_mfspr(struct kvm
 	case SPRN_WPAR_GEKKO:
 	case SPRN_MSSSR0:
 	case SPRN_DABR:
+#ifdef CONFIG_PPC_BOOK3S_64
+	case SPRN_MMCRS:
+	case SPRN_MMCRA:
+	case SPRN_MMCR0:
+	case SPRN_MMCR1:
+	case SPRN_MMCR2:
+	case SPRN_UMMCR2:
+	case SPRN_TIR:
+#endif
 		*spr_val = 0;
 		break;
 	default:
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/powerpc/platforms/ps3/os-area.c linux-libre-3.12.66-gnu/arch/powerpc/platforms/ps3/os-area.c
--- linux-libre-3.12.64-gnu/arch/powerpc/platforms/ps3/os-area.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/powerpc/platforms/ps3/os-area.c	2016-10-20 04:49:58.000000000 -0400
@@ -194,11 +194,6 @@ static const struct os_area_db_id os_are
 	.key = OS_AREA_DB_KEY_RTC_DIFF
 };
 
-static const struct os_area_db_id os_area_db_id_video_mode = {
-	.owner = OS_AREA_DB_OWNER_LINUX,
-	.key = OS_AREA_DB_KEY_VIDEO_MODE
-};
-
 #define SECONDS_FROM_1970_TO_2000 946684800LL
 
 /**
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/tile/include/asm/elf.h linux-libre-3.12.66-gnu/arch/tile/include/asm/elf.h
--- linux-libre-3.12.64-gnu/arch/tile/include/asm/elf.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/tile/include/asm/elf.h	2016-10-20 04:49:58.000000000 -0400
@@ -131,6 +131,7 @@ extern int dump_task_regs(struct task_st
 struct linux_binprm;
 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 				       int executable_stack);
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO \
 do { \
 	NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/tile/include/uapi/asm/auxvec.h linux-libre-3.12.66-gnu/arch/tile/include/uapi/asm/auxvec.h
--- linux-libre-3.12.64-gnu/arch/tile/include/uapi/asm/auxvec.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/tile/include/uapi/asm/auxvec.h	2016-10-20 04:49:58.000000000 -0400
@@ -18,4 +18,6 @@
 /* The vDSO location. */
 #define AT_SYSINFO_EHDR         33
 
+#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
+
 #endif /* _ASM_TILE_AUXVEC_H */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/x86/boot/compressed/head_32.S linux-libre-3.12.66-gnu/arch/x86/boot/compressed/head_32.S
--- linux-libre-3.12.64-gnu/arch/x86/boot/compressed/head_32.S	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/x86/boot/compressed/head_32.S	2016-10-20 04:49:58.000000000 -0400
@@ -30,6 +30,34 @@
 #include <asm/boot.h>
 #include <asm/asm-offsets.h>
 
+/*
+ * The 32-bit x86 assembler in binutils 2.26 will generate R_386_GOT32X
+ * relocation to get the symbol address in PIC.  When the compressed x86
+ * kernel isn't built as PIC, the linker optimizes R_386_GOT32X
+ * relocations to their fixed symbol addresses.  However, when the
+ * compressed x86 kernel is loaded at a different address, it leads
+ * to the following load failure:
+ *
+ *   Failed to allocate space for phdrs
+ *
+ * during the decompression stage.
+ *
+ * If the compressed x86 kernel is relocatable at run-time, it should be
+ * compiled with -fPIE, instead of -fPIC, if possible and should be built as
+ * Position Independent Executable (PIE) so that linker won't optimize
+ * R_386_GOT32X relocation to its fixed symbol address.  Older
+ * linkers generate R_386_32 relocations against locally defined symbols,
+ * _bss, _ebss, _got and _egot, in PIE.  It isn't wrong, just less
+ * optimal than R_386_RELATIVE.  But the x86 kernel fails to properly handle
+ * R_386_32 relocations when relocating the kernel.  To generate
+ * R_386_RELATIVE relocations, we mark _bss, _ebss, _got and _egot as
+ * hidden:
+ */
+	.hidden _bss
+	.hidden _ebss
+	.hidden _got
+	.hidden _egot
+
 	__HEAD
 ENTRY(startup_32)
 #ifdef CONFIG_EFI_STUB
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/x86/boot/compressed/head_64.S linux-libre-3.12.66-gnu/arch/x86/boot/compressed/head_64.S
--- linux-libre-3.12.64-gnu/arch/x86/boot/compressed/head_64.S	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/x86/boot/compressed/head_64.S	2016-10-20 04:49:58.000000000 -0400
@@ -32,6 +32,14 @@
 #include <asm/processor-flags.h>
 #include <asm/asm-offsets.h>
 
+/*
+ * Locally defined symbols should be marked hidden:
+ */
+	.hidden _bss
+	.hidden _ebss
+	.hidden _got
+	.hidden _egot
+
 	__HEAD
 	.code32
 ENTRY(startup_32)
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/x86/boot/compressed/Makefile linux-libre-3.12.66-gnu/arch/x86/boot/compressed/Makefile
--- linux-libre-3.12.64-gnu/arch/x86/boot/compressed/Makefile	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/x86/boot/compressed/Makefile	2016-10-20 04:49:58.000000000 -0400
@@ -8,7 +8,7 @@ targets := vmlinux vmlinux.bin vmlinux.b
 	vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
 
 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
-KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
+KBUILD_CFLAGS += -fno-strict-aliasing $(call cc-option, -fPIE, -fPIC)
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
 cflags-$(CONFIG_X86_32) := -march=i386
 cflags-$(CONFIG_X86_64) := -mcmodel=small
@@ -21,6 +21,18 @@ KBUILD_AFLAGS  := $(KBUILD_CFLAGS) -D__A
 GCOV_PROFILE := n
 
 LDFLAGS := -m elf_$(UTS_MACHINE)
+ifeq ($(CONFIG_RELOCATABLE),y)
+# If kernel is relocatable, build compressed kernel as PIE.
+ifeq ($(CONFIG_X86_32),y)
+LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
+else
+# To build 64-bit compressed kernel as PIE, we disable relocation
+# overflow check to avoid relocation overflow error with a new linker
+# command-line option, -z noreloc-overflow.
+LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
+	&& echo "-z noreloc-overflow -pie --no-dynamic-linker")
+endif
+endif
 LDFLAGS_vmlinux := -T
 
 hostprogs-y	:= mkpiggy
diff -druNp --no-dereference linux-libre-3.12.64-gnu/arch/x86/kvm/vmx.c linux-libre-3.12.66-gnu/arch/x86/kvm/vmx.c
--- linux-libre-3.12.64-gnu/arch/x86/kvm/vmx.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/arch/x86/kvm/vmx.c	2016-10-20 04:49:58.000000000 -0400
@@ -366,6 +366,7 @@ struct nested_vmx {
 	struct list_head vmcs02_pool;
 	int vmcs02_num;
 	u64 vmcs01_tsc_offset;
+	bool change_vmcs01_virtual_x2apic_mode;
 	/* L2 must run next, and mustn't decide to exit to L1. */
 	bool nested_run_pending;
 	/*
@@ -6861,6 +6862,12 @@ static void vmx_set_virtual_x2apic_mode(
 {
 	u32 sec_exec_control;
 
+	/* Postpone execution until vmcs01 is the current VMCS. */
+	if (is_guest_mode(vcpu)) {
+		to_vmx(vcpu)->nested.change_vmcs01_virtual_x2apic_mode = true;
+		return;
+	}
+
 	/*
 	 * There is not point to enable virtualize x2apic without enable
 	 * apicv
@@ -8367,6 +8374,12 @@ static void nested_vmx_vmexit(struct kvm
 	/* Update TSC_OFFSET if TSC was changed while L2 ran */
 	vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset);
 
+	if (vmx->nested.change_vmcs01_virtual_x2apic_mode) {
+		vmx->nested.change_vmcs01_virtual_x2apic_mode = false;
+		vmx_set_virtual_x2apic_mode(vcpu,
+				vcpu->arch.apic_base & X2APIC_ENABLE);
+	}
+
 	/* This is needed for same reason as it was needed in prepare_vmcs02 */
 	vmx->host_rsp = 0;
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/crypto/blkcipher.c linux-libre-3.12.66-gnu/crypto/blkcipher.c
--- linux-libre-3.12.64-gnu/crypto/blkcipher.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/crypto/blkcipher.c	2016-10-20 04:49:58.000000000 -0400
@@ -238,6 +238,8 @@ static int blkcipher_walk_next(struct bl
 		return blkcipher_walk_done(desc, walk, -EINVAL);
 	}
 
+	bsize = min(walk->blocksize, n);
+
 	walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY |
 			 BLKCIPHER_WALK_DIFF);
 	if (!scatterwalk_aligned(&walk->in, alignmask) ||
@@ -250,7 +252,6 @@ static int blkcipher_walk_next(struct bl
 		}
 	}
 
-	bsize = min(walk->blocksize, n);
 	n = scatterwalk_clamp(&walk->in, n);
 	n = scatterwalk_clamp(&walk->out, n);
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/acpi/acpica/hwxface.c linux-libre-3.12.66-gnu/drivers/acpi/acpica/hwxface.c
--- linux-libre-3.12.64-gnu/drivers/acpi/acpica/hwxface.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/acpi/acpica/hwxface.c	2016-10-20 04:49:58.000000000 -0400
@@ -495,11 +495,20 @@ acpi_get_sleep_type_data(u8 sleep_state,
 	 * Evaluate the \_Sx namespace object containing the register values
 	 * for this state
 	 */
-	info->relative_pathname =
-	    ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
+	info->relative_pathname = ACPI_CAST_PTR(char,
+						acpi_gbl_sleep_state_names
+						[sleep_state]);
+
 	status = acpi_ns_evaluate(info);
 	if (ACPI_FAILURE(status)) {
-		goto cleanup;
+		if (status == AE_NOT_FOUND) {
+
+			/* The _Sx states are optional, ignore NOT_FOUND */
+
+			goto final_cleanup;
+		}
+
+		goto warning_cleanup;
 	}
 
 	/* Must have a return object */
@@ -508,7 +517,7 @@ acpi_get_sleep_type_data(u8 sleep_state,
 		ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
 			    info->relative_pathname));
 		status = AE_AML_NO_RETURN_VALUE;
-		goto cleanup;
+		goto warning_cleanup;
 	}
 
 	/* Return object must be of type Package */
@@ -517,7 +526,7 @@ acpi_get_sleep_type_data(u8 sleep_state,
 		ACPI_ERROR((AE_INFO,
 			    "Sleep State return object is not a Package"));
 		status = AE_AML_OPERAND_TYPE;
-		goto cleanup1;
+		goto return_value_cleanup;
 	}
 
 	/*
@@ -561,16 +570,17 @@ acpi_get_sleep_type_data(u8 sleep_state,
 		break;
 	}
 
-      cleanup1:
+return_value_cleanup:
 	acpi_ut_remove_reference(info->return_object);
 
-      cleanup:
+warning_cleanup:
 	if (ACPI_FAILURE(status)) {
 		ACPI_EXCEPTION((AE_INFO, status,
 				"While evaluating Sleep State [%s]",
 				info->relative_pathname));
 	}
 
+final_cleanup:
 	ACPI_FREE(info);
 	return_ACPI_STATUS(status);
 }
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/char/hw_random/omap-rng.c linux-libre-3.12.66-gnu/drivers/char/hw_random/omap-rng.c
--- linux-libre-3.12.64-gnu/drivers/char/hw_random/omap-rng.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/char/hw_random/omap-rng.c	2016-10-20 04:49:58.000000000 -0400
@@ -386,7 +386,12 @@ static int omap_rng_probe(struct platfor
 	}
 
 	pm_runtime_enable(&pdev->dev);
-	pm_runtime_get_sync(&pdev->dev);
+	ret = pm_runtime_get_sync(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
+		pm_runtime_put_noidle(&pdev->dev);
+		goto err_ioremap;
+	}
 
 	ret = (dev->of_node) ? of_get_omap_rng_device_details(priv, pdev) :
 				get_omap_rng_device_details(priv);
@@ -439,8 +444,15 @@ static int omap_rng_suspend(struct devic
 static int omap_rng_resume(struct device *dev)
 {
 	struct omap_rng_dev *priv = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pm_runtime_get_sync(dev);
+	if (ret) {
+		dev_err(dev, "Failed to runtime_get device: %d\n", ret);
+		pm_runtime_put_noidle(dev);
+		return ret;
+	}
 
-	pm_runtime_get_sync(dev);
 	priv->pdata->init(priv);
 
 	return 0;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/gpu/drm/qxl/qxl_draw.c linux-libre-3.12.66-gnu/drivers/gpu/drm/qxl/qxl_draw.c
--- linux-libre-3.12.64-gnu/drivers/gpu/drm/qxl/qxl_draw.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/gpu/drm/qxl/qxl_draw.c	2016-10-20 04:49:58.000000000 -0400
@@ -136,6 +136,8 @@ static int qxl_palette_create_1bit(struc
 				 * correctly globaly, since that would require
 				 * tracking all of our palettes. */
 	ret = qxl_bo_kmap(palette_bo, (void **)&pal);
+	if (ret)
+		return ret;
 	pal->num_ents = 2;
 	pal->unique = unique++;
 	if (visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) {
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/gpu/drm/radeon/si_dpm.c linux-libre-3.12.66-gnu/drivers/gpu/drm/radeon/si_dpm.c
--- linux-libre-3.12.64-gnu/drivers/gpu/drm/radeon/si_dpm.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/gpu/drm/radeon/si_dpm.c	2016-10-20 04:49:58.000000000 -0400
@@ -3012,6 +3012,12 @@ static void si_apply_state_adjust_rules(
 	if (rdev->pdev->device == 0x6811 &&
 	    rdev->pdev->revision == 0x81)
 		max_mclk = 120000;
+	/* limit sclk/mclk on Jet parts for stability */
+	if (rdev->pdev->device == 0x6665 &&
+	    rdev->pdev->revision == 0xc3) {
+		max_sclk = 75000;
+		max_mclk = 80000;
+	}
 
 	/* XXX validate the min clocks required for display */
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/hwmon/adt7411.c linux-libre-3.12.66-gnu/drivers/hwmon/adt7411.c
--- linux-libre-3.12.64-gnu/drivers/hwmon/adt7411.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/hwmon/adt7411.c	2016-10-20 04:49:58.000000000 -0400
@@ -30,6 +30,7 @@
 
 #define ADT7411_REG_CFG1			0x18
 #define ADT7411_CFG1_START_MONITOR		(1 << 0)
+#define ADT7411_CFG1_RESERVED_BIT3		(1 << 3)
 
 #define ADT7411_REG_CFG2			0x19
 #define ADT7411_CFG2_DISABLE_AVG		(1 << 5)
@@ -292,8 +293,10 @@ static int adt7411_probe(struct i2c_clie
 	mutex_init(&data->device_lock);
 	mutex_init(&data->update_lock);
 
+	/* According to the datasheet, we must only write 1 to bit 3 */
 	ret = adt7411_modify_bit(client, ADT7411_REG_CFG1,
-				 ADT7411_CFG1_START_MONITOR, 1);
+				 ADT7411_CFG1_RESERVED_BIT3
+				 | ADT7411_CFG1_START_MONITOR, 1);
 	if (ret < 0)
 		return ret;
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/i2c/busses/i2c-eg20t.c linux-libre-3.12.66-gnu/drivers/i2c/busses/i2c-eg20t.c
--- linux-libre-3.12.64-gnu/drivers/i2c/busses/i2c-eg20t.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/i2c/busses/i2c-eg20t.c	2016-10-20 04:49:58.000000000 -0400
@@ -798,13 +798,6 @@ static int pch_i2c_probe(struct pci_dev
 	/* Set the number of I2C channel instance */
 	adap_info->ch_num = id->driver_data;
 
-	ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED,
-		  KBUILD_MODNAME, adap_info);
-	if (ret) {
-		pch_pci_err(pdev, "request_irq FAILED\n");
-		goto err_request_irq;
-	}
-
 	for (i = 0; i < adap_info->ch_num; i++) {
 		pch_adap = &adap_info->pch_data[i].pch_adapter;
 		adap_info->pch_i2c_suspended = false;
@@ -821,6 +814,17 @@ static int pch_i2c_probe(struct pci_dev
 		adap_info->pch_data[i].pch_base_address = base_addr + 0x100 * i;
 
 		pch_adap->dev.parent = &pdev->dev;
+	}
+
+	ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED,
+		  KBUILD_MODNAME, adap_info);
+	if (ret) {
+		pch_pci_err(pdev, "request_irq FAILED\n");
+		goto err_request_irq;
+	}
+
+	for (i = 0; i < adap_info->ch_num; i++) {
+		pch_adap = &adap_info->pch_data[i].pch_adapter;
 
 		pch_i2c_init(&adap_info->pch_data[i]);
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/core/multicast.c linux-libre-3.12.66-gnu/drivers/infiniband/core/multicast.c
--- linux-libre-3.12.64-gnu/drivers/infiniband/core/multicast.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/core/multicast.c	2016-10-20 04:49:58.000000000 -0400
@@ -106,7 +106,6 @@ struct mcast_group {
 	atomic_t		refcount;
 	enum mcast_group_state	state;
 	struct ib_sa_query	*query;
-	int			query_id;
 	u16			pkey_index;
 	u8			leave_state;
 	int			retries;
@@ -339,11 +338,7 @@ static int send_join(struct mcast_group
 				       member->multicast.comp_mask,
 				       3000, GFP_KERNEL, join_handler, group,
 				       &group->query);
-	if (ret >= 0) {
-		group->query_id = ret;
-		ret = 0;
-	}
-	return ret;
+	return (ret > 0) ? 0 : ret;
 }
 
 static int send_leave(struct mcast_group *group, u8 leave_state)
@@ -363,11 +358,7 @@ static int send_leave(struct mcast_group
 				       IB_SA_MCMEMBER_REC_JOIN_STATE,
 				       3000, GFP_KERNEL, leave_handler,
 				       group, &group->query);
-	if (ret >= 0) {
-		group->query_id = ret;
-		ret = 0;
-	}
-	return ret;
+	return (ret > 0) ? 0 : ret;
 }
 
 static void join_group(struct mcast_group *group, struct mcast_member *member,
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/hw/mlx4/mcg.c linux-libre-3.12.66-gnu/drivers/infiniband/hw/mlx4/mcg.c
--- linux-libre-3.12.64-gnu/drivers/infiniband/hw/mlx4/mcg.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/hw/mlx4/mcg.c	2016-10-20 04:49:58.000000000 -0400
@@ -483,7 +483,7 @@ static u8 get_leave_state(struct mcast_g
 		if (!group->members[i])
 			leave_state |= (1 << i);
 
-	return leave_state & (group->rec.scope_join_state & 7);
+	return leave_state & (group->rec.scope_join_state & 0xf);
 }
 
 static int join_group(struct mcast_group *group, int slave, u8 join_mask)
@@ -558,8 +558,8 @@ static void mlx4_ib_mcg_timeout_handler(
 		} else
 			mcg_warn_group(group, "DRIVER BUG\n");
 	} else if (group->state == MCAST_LEAVE_SENT) {
-		if (group->rec.scope_join_state & 7)
-			group->rec.scope_join_state &= 0xf8;
+		if (group->rec.scope_join_state & 0xf)
+			group->rec.scope_join_state &= 0xf0;
 		group->state = MCAST_IDLE;
 		mutex_unlock(&group->lock);
 		if (release_group(group, 1))
@@ -599,7 +599,7 @@ static int handle_leave_req(struct mcast
 static int handle_join_req(struct mcast_group *group, u8 join_mask,
 			   struct mcast_req *req)
 {
-	u8 group_join_state = group->rec.scope_join_state & 7;
+	u8 group_join_state = group->rec.scope_join_state & 0xf;
 	int ref = 0;
 	u16 status;
 	struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
@@ -684,8 +684,8 @@ static void mlx4_ib_mcg_work_handler(str
 			u8 cur_join_state;
 
 			resp_join_state = ((struct ib_sa_mcmember_data *)
-						group->response_sa_mad.data)->scope_join_state & 7;
-			cur_join_state = group->rec.scope_join_state & 7;
+						group->response_sa_mad.data)->scope_join_state & 0xf;
+			cur_join_state = group->rec.scope_join_state & 0xf;
 
 			if (method == IB_MGMT_METHOD_GET_RESP) {
 				/* successfull join */
@@ -704,7 +704,7 @@ process_requests:
 		req = list_first_entry(&group->pending_list, struct mcast_req,
 				       group_list);
 		sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
-		req_join_state = sa_data->scope_join_state & 0x7;
+		req_join_state = sa_data->scope_join_state & 0xf;
 
 		/* For a leave request, we will immediately answer the VF, and
 		 * update our internal counters. The actual leave will be sent
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib_cm.c linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib_cm.c
--- linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib_cm.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib_cm.c	2016-10-20 04:49:58.000000000 -0400
@@ -1288,6 +1288,8 @@ void ipoib_cm_destroy_tx(struct ipoib_cm
 	}
 }
 
+#define QPN_AND_OPTIONS_OFFSET	4
+
 static void ipoib_cm_tx_start(struct work_struct *work)
 {
 	struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
@@ -1296,6 +1298,7 @@ static void ipoib_cm_tx_start(struct wor
 	struct ipoib_neigh *neigh;
 	struct ipoib_cm_tx *p;
 	unsigned long flags;
+	struct ipoib_path *path;
 	int ret;
 
 	struct ib_sa_path_rec pathrec;
@@ -1308,7 +1311,19 @@ static void ipoib_cm_tx_start(struct wor
 		p = list_entry(priv->cm.start_list.next, typeof(*p), list);
 		list_del_init(&p->list);
 		neigh = p->neigh;
+
 		qpn = IPOIB_QPN(neigh->daddr);
+		/*
+		 * As long as the search is with these 2 locks,
+		 * path existence indicates its validity.
+		 */
+		path = __path_find(dev, neigh->daddr + QPN_AND_OPTIONS_OFFSET);
+		if (!path) {
+			pr_info("%s ignore not valid path %pI6\n",
+				__func__,
+				neigh->daddr + QPN_AND_OPTIONS_OFFSET);
+			goto free_neigh;
+		}
 		memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);
 
 		spin_unlock_irqrestore(&priv->lock, flags);
@@ -1320,6 +1335,7 @@ static void ipoib_cm_tx_start(struct wor
 		spin_lock_irqsave(&priv->lock, flags);
 
 		if (ret) {
+free_neigh:
 			neigh = p->neigh;
 			if (neigh) {
 				neigh->cm = NULL;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib.h linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib.h
--- linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib.h	2016-10-20 04:49:58.000000000 -0400
@@ -460,6 +460,7 @@ void ipoib_send(struct net_device *dev,
 		struct ipoib_ah *address, u32 qpn);
 void ipoib_reap_ah(struct work_struct *work);
 
+struct ipoib_path *__path_find(struct net_device *dev, void *gid);
 void ipoib_mark_paths_invalid(struct net_device *dev);
 void ipoib_flush_paths(struct net_device *dev);
 struct ipoib_dev_priv *ipoib_intf_alloc(const char *format);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib_ib.c linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib_ib.c
--- linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2016-10-20 04:49:58.000000000 -0400
@@ -1029,8 +1029,17 @@ static void __ipoib_ib_dev_flush(struct
 	}
 
 	if (level == IPOIB_FLUSH_LIGHT) {
+		int oper_up;
 		ipoib_mark_paths_invalid(dev);
+		/* Set IPoIB operation as down to prevent races between:
+		 * the flush flow which leaves MCG and on the fly joins
+		 * which can happen during that time. mcast restart task
+		 * should deal with join requests we missed.
+		 */
+		oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
 		ipoib_mcast_dev_flush(dev);
+		if (oper_up)
+			set_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
 	}
 
 	if (level >= IPOIB_FLUSH_NORMAL)
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c
--- linux-libre-3.12.64-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/ulp/ipoib/ipoib_main.c	2016-10-20 04:49:58.000000000 -0400
@@ -251,7 +251,7 @@ int ipoib_set_mode(struct net_device *de
 	return -EINVAL;
 }
 
-static struct ipoib_path *__path_find(struct net_device *dev, void *gid)
+struct ipoib_path *__path_find(struct net_device *dev, void *gid)
 {
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	struct rb_node *n = priv->path_tree.rb_node;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/infiniband/ulp/srpt/ib_srpt.c linux-libre-3.12.66-gnu/drivers/infiniband/ulp/srpt/ib_srpt.c
--- linux-libre-3.12.64-gnu/drivers/infiniband/ulp/srpt/ib_srpt.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/infiniband/ulp/srpt/ib_srpt.c	2016-10-20 04:49:58.000000000 -0400
@@ -1754,47 +1754,6 @@ send_sense:
 	return -1;
 }
 
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management request.
- * @mgmt_ioctx: I/O context of the task management request.
- *
- * Returns zero if the target core will process the task management
- * request asynchronously.
- *
- * Note: It is assumed that the initiator serializes tag-based task management
- * requests.
- */
-static int srpt_rx_mgmt_fn_tag(struct srpt_send_ioctx *ioctx, u64 tag)
-{
-	struct srpt_device *sdev;
-	struct srpt_rdma_ch *ch;
-	struct srpt_send_ioctx *target;
-	int ret, i;
-
-	ret = -EINVAL;
-	ch = ioctx->ch;
-	BUG_ON(!ch);
-	BUG_ON(!ch->sport);
-	sdev = ch->sport->sdev;
-	BUG_ON(!sdev);
-	spin_lock_irq(&sdev->spinlock);
-	for (i = 0; i < ch->rq_size; ++i) {
-		target = ch->ioctx_ring[i];
-		if (target->cmd.se_lun == ioctx->cmd.se_lun &&
-		    target->tag == tag &&
-		    srpt_get_cmd_state(target) != SRPT_STATE_DONE) {
-			ret = 0;
-			/* now let the target core abort &target->cmd; */
-			break;
-		}
-	}
-	spin_unlock_irq(&sdev->spinlock);
-	return ret;
-}
-
 static int srp_tmr_to_tcm(int fn)
 {
 	switch (fn) {
@@ -1829,7 +1788,6 @@ static void srpt_handle_tsk_mgmt(struct
 	struct se_cmd *cmd;
 	struct se_session *sess = ch->sess;
 	uint64_t unpacked_lun;
-	uint32_t tag = 0;
 	int tcm_tmr;
 	int rc;
 
@@ -1845,25 +1803,10 @@ static void srpt_handle_tsk_mgmt(struct
 	srpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT);
 	send_ioctx->tag = srp_tsk->tag;
 	tcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func);
-	if (tcm_tmr < 0) {
-		send_ioctx->cmd.se_tmr_req->response =
-			TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED;
-		goto fail;
-	}
 	unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,
 				       sizeof(srp_tsk->lun));
-
-	if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) {
-		rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag);
-		if (rc < 0) {
-			send_ioctx->cmd.se_tmr_req->response =
-					TMR_TASK_DOES_NOT_EXIST;
-			goto fail;
-		}
-		tag = srp_tsk->task_tag;
-	}
 	rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,
-				srp_tsk, tcm_tmr, GFP_KERNEL, tag,
+				srp_tsk, tcm_tmr, GFP_KERNEL, srp_tsk->task_tag,
 				TARGET_SCF_ACK_KREF);
 	if (rc != 0) {
 		send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/iommu/amd_iommu.c linux-libre-3.12.66-gnu/drivers/iommu/amd_iommu.c
--- linux-libre-3.12.64-gnu/drivers/iommu/amd_iommu.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/iommu/amd_iommu.c	2016-10-20 04:49:58.000000000 -0400
@@ -2592,8 +2592,16 @@ static void update_device_table(struct p
 {
 	struct iommu_dev_data *dev_data;
 
-	list_for_each_entry(dev_data, &domain->dev_list, list)
+	list_for_each_entry(dev_data, &domain->dev_list, list) {
 		set_dte_entry(dev_data->devid, domain, dev_data->ats.enabled);
+
+		if (dev_data->alias_data == NULL)
+			continue;
+
+		/* There is an alias, update device table entry for it */
+		set_dte_entry(dev_data->alias_data->devid, domain,
+			      dev_data->alias_data->ats.enabled);
+	}
 }
 
 static void update_domain(struct protection_domain *domain)
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/md/dm.c linux-libre-3.12.66-gnu/drivers/md/dm.c
--- linux-libre-3.12.64-gnu/drivers/md/dm.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/md/dm.c	2016-10-20 04:49:58.000000000 -0400
@@ -2434,7 +2434,6 @@ static void __dm_destroy(struct mapped_d
 	might_sleep();
 
 	spin_lock(&_minor_lock);
-	map = dm_get_live_table(md, &srcu_idx);
 	idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md))));
 	set_bit(DMF_FREEING, &md->flags);
 	spin_unlock(&_minor_lock);
@@ -2444,14 +2443,14 @@ static void __dm_destroy(struct mapped_d
 	 * do not race with internal suspend.
 	 */
 	mutex_lock(&md->suspend_lock);
+	map = dm_get_live_table(md, &srcu_idx);
 	if (!dm_suspended_md(md)) {
 		dm_table_presuspend_targets(map);
 		dm_table_postsuspend_targets(map);
 	}
-	mutex_unlock(&md->suspend_lock);
-
 	/* dm_put_live_table must be before msleep, otherwise deadlock is possible */
 	dm_put_live_table(md, srcu_idx);
+	mutex_unlock(&md->suspend_lock);
 
 	/*
 	 * Rare, but there may be I/O requests still going to complete,
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/media/usb/em28xx/em28xx-i2c.c linux-libre-3.12.66-gnu/drivers/media/usb/em28xx/em28xx-i2c.c
--- linux-libre-3.12.64-gnu/drivers/media/usb/em28xx/em28xx-i2c.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/media/usb/em28xx/em28xx-i2c.c	2016-10-20 04:49:58.000000000 -0400
@@ -469,9 +469,8 @@ static int em28xx_i2c_xfer(struct i2c_ad
 	int addr, rc, i;
 	u8 reg;
 
-	rc = rt_mutex_trylock(&dev->i2c_bus_lock);
-	if (rc < 0)
-		return rc;
+	if (!rt_mutex_trylock(&dev->i2c_bus_lock))
+		return -EAGAIN;
 
 	/* Switch I2C bus if needed */
 	if (bus != dev->cur_i2c_bus &&
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/media/usb/gspca/cpia1.c linux-libre-3.12.66-gnu/drivers/media/usb/gspca/cpia1.c
--- linux-libre-3.12.64-gnu/drivers/media/usb/gspca/cpia1.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/media/usb/gspca/cpia1.c	2016-10-20 04:49:58.000000000 -0400
@@ -1624,7 +1624,7 @@ static int sd_start(struct gspca_dev *gs
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
 {
-	struct sd *sd = (struct sd *) gspca_dev;
+	struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
 
 	command_pause(gspca_dev);
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/media/usb/gspca/konica.c linux-libre-3.12.66-gnu/drivers/media/usb/gspca/konica.c
--- linux-libre-3.12.64-gnu/drivers/media/usb/gspca/konica.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/media/usb/gspca/konica.c	2016-10-20 04:49:58.000000000 -0400
@@ -243,7 +243,7 @@ static int sd_start(struct gspca_dev *gs
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
 {
-	struct sd *sd = (struct sd *) gspca_dev;
+	struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
 
 	konica_stream_off(gspca_dev);
 #if IS_ENABLED(CONFIG_INPUT)
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/media/usb/gspca/t613.c linux-libre-3.12.66-gnu/drivers/media/usb/gspca/t613.c
--- linux-libre-3.12.64-gnu/drivers/media/usb/gspca/t613.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/media/usb/gspca/t613.c	2016-10-20 04:49:58.000000000 -0400
@@ -837,7 +837,7 @@ static void sd_pkt_scan(struct gspca_dev
 			u8 *data,			/* isoc packet */
 			int len)			/* iso packet length */
 {
-	struct sd *sd = (struct sd *) gspca_dev;
+	struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
 	int pkt_type;
 
 	if (data[0] == 0x5a) {
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/mfd/Kconfig linux-libre-3.12.66-gnu/drivers/mfd/Kconfig
--- linux-libre-3.12.64-gnu/drivers/mfd/Kconfig	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/mfd/Kconfig	2016-10-20 04:49:58.000000000 -0400
@@ -1129,6 +1129,7 @@ config MFD_WM8350
 config MFD_WM8350_I2C
 	bool "Wolfson Microelectronics WM8350 with I2C"
 	select MFD_WM8350
+	select REGMAP_I2C
 	depends on I2C=y
 	help
 	  The WM8350 is an integrated audio and power management
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/mtd/maps/pmcmsp-flash.c linux-libre-3.12.66-gnu/drivers/mtd/maps/pmcmsp-flash.c
--- linux-libre-3.12.64-gnu/drivers/mtd/maps/pmcmsp-flash.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/mtd/maps/pmcmsp-flash.c	2016-10-20 04:49:58.000000000 -0400
@@ -75,15 +75,15 @@ static int __init init_msp_flash(void)
 
 	printk(KERN_NOTICE "Found %d PMC flash devices\n", fcnt);
 
-	msp_flash = kmalloc(fcnt * sizeof(struct map_info *), GFP_KERNEL);
+	msp_flash = kcalloc(fcnt, sizeof(*msp_flash), GFP_KERNEL);
 	if (!msp_flash)
 		return -ENOMEM;
 
-	msp_parts = kmalloc(fcnt * sizeof(struct mtd_partition *), GFP_KERNEL);
+	msp_parts = kcalloc(fcnt, sizeof(*msp_parts), GFP_KERNEL);
 	if (!msp_parts)
 		goto free_msp_flash;
 
-	msp_maps = kcalloc(fcnt, sizeof(struct mtd_info), GFP_KERNEL);
+	msp_maps = kcalloc(fcnt, sizeof(*msp_maps), GFP_KERNEL);
 	if (!msp_maps)
 		goto free_msp_parts;
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/mtd/nand/davinci_nand.c linux-libre-3.12.66-gnu/drivers/mtd/nand/davinci_nand.c
--- linux-libre-3.12.64-gnu/drivers/mtd/nand/davinci_nand.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/mtd/nand/davinci_nand.c	2016-10-20 04:49:58.000000000 -0400
@@ -241,6 +241,9 @@ static void nand_davinci_hwctl_4bit(stru
 	unsigned long flags;
 	u32 val;
 
+	/* Reset ECC hardware */
+	davinci_nand_readl(info, NAND_4BIT_ECC1_OFFSET);
+
 	spin_lock_irqsave(&davinci_nand_lock, flags);
 
 	/* Start 4-bit ECC calculation for read/write */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/can/dev.c linux-libre-3.12.66-gnu/drivers/net/can/dev.c
--- linux-libre-3.12.64-gnu/drivers/net/can/dev.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/can/dev.c	2016-10-20 04:49:58.000000000 -0400
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
+#include <linux/workqueue.h>
 #include <linux/can.h>
 #include <linux/can/dev.h>
 #include <linux/can/skb.h>
@@ -394,9 +395,8 @@ EXPORT_SYMBOL_GPL(can_free_echo_skb);
 /*
  * CAN device restart for bus-off recovery
  */
-static void can_restart(unsigned long data)
+static void can_restart(struct net_device *dev)
 {
-	struct net_device *dev = (struct net_device *)data;
 	struct can_priv *priv = netdev_priv(dev);
 	struct net_device_stats *stats = &dev->stats;
 	struct sk_buff *skb;
@@ -436,6 +436,14 @@ restart:
 		netdev_err(dev, "Error %d during restart", err);
 }
 
+static void can_restart_work(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct can_priv *priv = container_of(dwork, struct can_priv, restart_work);
+
+	can_restart(priv->dev);
+}
+
 int can_restart_now(struct net_device *dev)
 {
 	struct can_priv *priv = netdev_priv(dev);
@@ -449,8 +457,8 @@ int can_restart_now(struct net_device *d
 	if (priv->state != CAN_STATE_BUS_OFF)
 		return -EBUSY;
 
-	/* Runs as soon as possible in the timer context */
-	mod_timer(&priv->restart_timer, jiffies);
+	cancel_delayed_work_sync(&priv->restart_work);
+	can_restart(dev);
 
 	return 0;
 }
@@ -472,8 +480,8 @@ void can_bus_off(struct net_device *dev)
 	priv->can_stats.bus_off++;
 
 	if (priv->restart_ms)
-		mod_timer(&priv->restart_timer,
-			  jiffies + (priv->restart_ms * HZ) / 1000);
+		schedule_delayed_work(&priv->restart_work,
+				      msecs_to_jiffies(priv->restart_ms));
 }
 EXPORT_SYMBOL_GPL(can_bus_off);
 
@@ -556,6 +564,7 @@ struct net_device *alloc_candev(int size
 		return NULL;
 
 	priv = netdev_priv(dev);
+	priv->dev = dev;
 
 	if (echo_skb_max) {
 		priv->echo_skb_max = echo_skb_max;
@@ -565,7 +574,7 @@ struct net_device *alloc_candev(int size
 
 	priv->state = CAN_STATE_STOPPED;
 
-	init_timer(&priv->restart_timer);
+	INIT_DELAYED_WORK(&priv->restart_work, can_restart_work);
 
 	return dev;
 }
@@ -599,8 +608,6 @@ int open_candev(struct net_device *dev)
 	if (!netif_carrier_ok(dev))
 		netif_carrier_on(dev);
 
-	setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(open_candev);
@@ -615,7 +622,7 @@ void close_candev(struct net_device *dev
 {
 	struct can_priv *priv = netdev_priv(dev);
 
-	del_timer_sync(&priv->restart_timer);
+	cancel_delayed_work_sync(&priv->restart_work);
 	can_flush_echo_skb(dev);
 }
 EXPORT_SYMBOL_GPL(close_candev);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/can/flexcan.c linux-libre-3.12.66-gnu/drivers/net/can/flexcan.c
--- linux-libre-3.12.64-gnu/drivers/net/can/flexcan.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/can/flexcan.c	2016-10-20 04:49:58.000000000 -0400
@@ -1164,11 +1164,10 @@ static int flexcan_suspend(struct device
 	struct flexcan_priv *priv = netdev_priv(dev);
 	int err;
 
-	err = flexcan_chip_disable(priv);
-	if (err)
-		return err;
-
 	if (netif_running(dev)) {
+		err = flexcan_chip_disable(priv);
+		if (err)
+			return err;
 		netif_stop_queue(dev);
 		netif_device_detach(dev);
 	}
@@ -1181,13 +1180,17 @@ static int flexcan_resume(struct device
 {
 	struct net_device *dev = dev_get_drvdata(device);
 	struct flexcan_priv *priv = netdev_priv(dev);
+	int err;
 
 	priv->can.state = CAN_STATE_ERROR_ACTIVE;
 	if (netif_running(dev)) {
 		netif_device_attach(dev);
 		netif_start_queue(dev);
+		err = flexcan_chip_enable(priv);
+		if (err)
+			return err;
 	}
-	return flexcan_chip_enable(priv);
+	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/ppp/ppp_generic.c linux-libre-3.12.66-gnu/drivers/net/ppp/ppp_generic.c
--- linux-libre-3.12.64-gnu/drivers/net/ppp/ppp_generic.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/ppp/ppp_generic.c	2016-10-20 04:49:58.000000000 -0400
@@ -2317,8 +2317,6 @@ ppp_unregister_channel(struct ppp_channe
 	spin_lock_bh(&pn->all_channels_lock);
 	list_del(&pch->list);
 	spin_unlock_bh(&pn->all_channels_lock);
-	put_net(pch->chan_net);
-	pch->chan_net = NULL;
 
 	pch->file.dead = 1;
 	wake_up_interruptible(&pch->file.rwait);
@@ -2925,6 +2923,9 @@ ppp_disconnect_channel(struct channel *p
  */
 static void ppp_destroy_channel(struct channel *pch)
 {
+	put_net(pch->chan_net);
+	pch->chan_net = NULL;
+
 	atomic_dec(&channel_count);
 
 	if (!pch->file.dead) {
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/usb/kaweth.c linux-libre-3.12.66-gnu/drivers/net/usb/kaweth.c
--- linux-libre-3.12.64-gnu/drivers/net/usb/kaweth.c	2016-10-03 10:49:16.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/usb/kaweth.c	2016-10-21 04:57:22.000000000 -0400
@@ -1028,6 +1028,7 @@ static int kaweth_probe(
 	kaweth = netdev_priv(netdev);
 	kaweth->dev = udev;
 	kaweth->net = netdev;
+	kaweth->intf = intf;
 
 	spin_lock_init(&kaweth->device_lock);
 	init_waitqueue_head(&kaweth->term_wait);
@@ -1138,8 +1139,6 @@ err_fw:
 
 	dev_dbg(dev, "Initializing net device.\n");
 
-	kaweth->intf = intf;
-
 	kaweth->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!kaweth->tx_urb)
 		goto err_free_netdev;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c linux-libre-3.12.66-gnu/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
--- linux-libre-3.12.64-gnu/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c	2016-10-20 04:49:58.000000000 -0400
@@ -3731,7 +3731,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
 				(u8 *)&settings->beacon.head[ie_offset],
 				settings->beacon.head_len - ie_offset,
 				WLAN_EID_SSID);
-		if (!ssid_ie)
+		if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN)
 			return -EINVAL;
 
 		memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/wireless/brcm80211/brcmsmac/dma.c linux-libre-3.12.66-gnu/drivers/net/wireless/brcm80211/brcmsmac/dma.c
--- linux-libre-3.12.64-gnu/drivers/net/wireless/brcm80211/brcmsmac/dma.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/wireless/brcm80211/brcmsmac/dma.c	2016-10-20 04:49:58.000000000 -0400
@@ -1079,8 +1079,10 @@ bool dma_rxfill(struct dma_pub *pub)
 
 		pa = dma_map_single(di->dmadev, p->data, di->rxbufsize,
 				    DMA_FROM_DEVICE);
-		if (dma_mapping_error(di->dmadev, pa))
+		if (dma_mapping_error(di->dmadev, pa)) {
+			brcmu_pkt_buf_free_skb(p);
 			return false;
+		}
 
 		/* save the free packet pointer */
 		di->rxp[rxout] = p;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/wireless/brcm80211/brcmsmac/stf.c linux-libre-3.12.66-gnu/drivers/net/wireless/brcm80211/brcmsmac/stf.c
--- linux-libre-3.12.64-gnu/drivers/net/wireless/brcm80211/brcmsmac/stf.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/wireless/brcm80211/brcmsmac/stf.c	2016-10-20 04:49:58.000000000 -0400
@@ -87,7 +87,7 @@ void
 brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel,
 			    u16 chanspec)
 {
-	struct tx_power power;
+	struct tx_power power = { };
 	u8 siso_mcs_id, cdd_mcs_id, stbc_mcs_id;
 
 	/* Clear previous settings */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/wireless/iwlegacy/3945.c linux-libre-3.12.66-gnu/drivers/net/wireless/iwlegacy/3945.c
--- linux-libre-3.12.64-gnu/drivers/net/wireless/iwlegacy/3945.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/wireless/iwlegacy/3945.c	2016-10-20 04:49:58.000000000 -0400
@@ -1020,12 +1020,13 @@ il3945_hw_txq_ctx_free(struct il_priv *i
 	int txq_id;
 
 	/* Tx queues */
-	if (il->txq)
+	if (il->txq) {
 		for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++)
 			if (txq_id == IL39_CMD_QUEUE_NUM)
 				il_cmd_queue_free(il);
 			else
 				il_tx_queue_free(il, txq_id);
+	}
 
 	/* free tx queue structure */
 	il_free_txq_mem(il);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/net/wireless/iwlwifi/pcie/tx.c linux-libre-3.12.66-gnu/drivers/net/wireless/iwlwifi/pcie/tx.c
--- linux-libre-3.12.64-gnu/drivers/net/wireless/iwlwifi/pcie/tx.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/net/wireless/iwlwifi/pcie/tx.c	2016-10-20 04:49:58.000000000 -0400
@@ -1328,9 +1328,9 @@ static int iwl_pcie_enqueue_hcmd(struct
 
 	/* start the TFD with the scratchbuf */
 	scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE);
-	memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size);
+	memcpy(&txq->scratchbufs[idx], &out_cmd->hdr, scratch_size);
 	iwl_pcie_txq_build_tfd(trans, txq,
-			       iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr),
+			       iwl_pcie_get_scratchbuf_dma(txq, idx),
 			       scratch_size, 1);
 
 	/* map first command fragment, if any remains */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/staging/iio/adc/ad7192.c linux-libre-3.12.66-gnu/drivers/staging/iio/adc/ad7192.c
--- linux-libre-3.12.64-gnu/drivers/staging/iio/adc/ad7192.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/staging/iio/adc/ad7192.c	2016-10-20 04:49:58.000000000 -0400
@@ -236,7 +236,7 @@ static int ad7192_setup(struct ad7192_st
 			st->mclk = pdata->ext_clk_Hz;
 		else
 			st->mclk = AD7192_INT_FREQ_MHz;
-			break;
+		break;
 	default:
 		ret = -EINVAL;
 		goto out;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/staging/line6/driver.c linux-libre-3.12.66-gnu/drivers/staging/line6/driver.c
--- linux-libre-3.12.64-gnu/drivers/staging/line6/driver.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/staging/line6/driver.c	2016-10-20 04:49:58.000000000 -0400
@@ -83,7 +83,7 @@ static struct line6_properties line6_pro
 /*
 	This is Line6's MIDI manufacturer ID.
 */
-const unsigned char line6_midi_id[] = {
+const unsigned char line6_midi_id[3] = {
 	0x00, 0x01, 0x0c
 };
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/usb/class/usbtmc.c linux-libre-3.12.66-gnu/drivers/usb/class/usbtmc.c
--- linux-libre-3.12.64-gnu/drivers/usb/class/usbtmc.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/usb/class/usbtmc.c	2016-10-20 04:49:58.000000000 -0400
@@ -122,6 +122,7 @@ static void usbtmc_delete(struct kref *k
 	struct usbtmc_device_data *data = to_usbtmc_data(kref);
 
 	usb_put_dev(data->usb_dev);
+	kfree(data);
 }
 
 static int usbtmc_open(struct inode *inode, struct file *filp)
@@ -1101,7 +1102,7 @@ static int usbtmc_probe(struct usb_inter
 
 	dev_dbg(&intf->dev, "%s called\n", __func__);
 
-	data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
+	data = kmalloc(sizeof(*data), GFP_KERNEL);
 	if (!data) {
 		dev_err(&intf->dev, "Unable to allocate kernel memory\n");
 		return -ENOMEM;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/usb/gadget/fsl_qe_udc.c linux-libre-3.12.66-gnu/drivers/usb/gadget/fsl_qe_udc.c
--- linux-libre-3.12.64-gnu/drivers/usb/gadget/fsl_qe_udc.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/usb/gadget/fsl_qe_udc.c	2016-10-20 04:49:58.000000000 -0400
@@ -1881,11 +1881,8 @@ static int qe_get_frame(struct usb_gadge
 
 	tmp = in_be16(&udc->usb_param->frame_n);
 	if (tmp & 0x8000)
-		tmp = tmp & 0x07ff;
-	else
-		tmp = -EINVAL;
-
-	return (int)tmp;
+		return tmp & 0x07ff;
+	return -EINVAL;
 }
 
 static int fsl_qe_start(struct usb_gadget *gadget,
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/usb/misc/legousbtower.c linux-libre-3.12.66-gnu/drivers/usb/misc/legousbtower.c
--- linux-libre-3.12.64-gnu/drivers/usb/misc/legousbtower.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/usb/misc/legousbtower.c	2016-10-20 04:49:58.000000000 -0400
@@ -899,24 +899,6 @@ static int tower_probe (struct usb_inter
 	dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval;
 	dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval;
 
-	/* we can register the device now, as it is ready */
-	usb_set_intfdata (interface, dev);
-
-	retval = usb_register_dev (interface, &tower_class);
-
-	if (retval) {
-		/* something prevented us from registering this driver */
-		dev_err(idev, "Not able to get a minor for this device.\n");
-		usb_set_intfdata (interface, NULL);
-		goto error;
-	}
-	dev->minor = interface->minor;
-
-	/* let the user know what node this device is now attached to */
-	dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
-		 "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
-		 USB_MAJOR, dev->minor);
-
 	/* get the firmware version and log it */
 	result = usb_control_msg (udev,
 				  usb_rcvctrlpipe(udev, 0),
@@ -937,6 +919,23 @@ static int tower_probe (struct usb_inter
 		 get_version_reply.minor,
 		 le16_to_cpu(get_version_reply.build_no));
 
+	/* we can register the device now, as it is ready */
+	usb_set_intfdata (interface, dev);
+
+	retval = usb_register_dev (interface, &tower_class);
+
+	if (retval) {
+		/* something prevented us from registering this driver */
+		dev_err(idev, "Not able to get a minor for this device.\n");
+		usb_set_intfdata (interface, NULL);
+		goto error;
+	}
+	dev->minor = interface->minor;
+
+	/* let the user know what node this device is now attached to */
+	dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
+		 "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
+		 USB_MAJOR, dev->minor);
 
 exit:
 	return retval;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/drivers/usb/serial/cp210x.c linux-libre-3.12.66-gnu/drivers/usb/serial/cp210x.c
--- linux-libre-3.12.64-gnu/drivers/usb/serial/cp210x.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/drivers/usb/serial/cp210x.c	2016-10-20 04:49:58.000000000 -0400
@@ -117,6 +117,7 @@ static const struct usb_device_id id_tab
 	{ USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
 	{ USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
 	{ USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
+	{ USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */
 	{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
 	{ USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
 	{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
@@ -858,7 +859,7 @@ static void cp210x_set_termios(struct tt
 		} else {
 			modem_ctl[0] &= ~0x7B;
 			modem_ctl[0] |= 0x01;
-			modem_ctl[1] |= 0x40;
+			modem_ctl[1] = 0x40;
 			dev_dbg(dev, "%s - flow control = NONE\n", __func__);
 		}
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/btrfs/ioctl.c linux-libre-3.12.66-gnu/fs/btrfs/ioctl.c
--- linux-libre-3.12.64-gnu/fs/btrfs/ioctl.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/btrfs/ioctl.c	2016-10-20 04:49:58.000000000 -0400
@@ -1516,6 +1516,9 @@ static noinline int btrfs_ioctl_snap_cre
 	int namelen;
 	int ret = 0;
 
+	if (!S_ISDIR(file_inode(file)->i_mode))
+		return -ENOTDIR;
+
 	ret = mnt_want_write_file(file);
 	if (ret)
 		goto out;
@@ -1573,6 +1576,9 @@ static noinline int btrfs_ioctl_snap_cre
 	struct btrfs_ioctl_vol_args *vol_args;
 	int ret;
 
+	if (!S_ISDIR(file_inode(file)->i_mode))
+		return -ENOTDIR;
+
 	vol_args = memdup_user(arg, sizeof(*vol_args));
 	if (IS_ERR(vol_args))
 		return PTR_ERR(vol_args);
@@ -1596,6 +1602,9 @@ static noinline int btrfs_ioctl_snap_cre
 	bool readonly = false;
 	struct btrfs_qgroup_inherit *inherit = NULL;
 
+	if (!S_ISDIR(file_inode(file)->i_mode))
+		return -ENOTDIR;
+
 	vol_args = memdup_user(arg, sizeof(*vol_args));
 	if (IS_ERR(vol_args))
 		return PTR_ERR(vol_args);
@@ -2118,6 +2127,9 @@ static noinline int btrfs_ioctl_snap_des
 	int ret;
 	int err = 0;
 
+	if (!S_ISDIR(dir->i_mode))
+		return -ENOTDIR;
+
 	vol_args = memdup_user(arg, sizeof(*vol_args));
 	if (IS_ERR(vol_args))
 		return PTR_ERR(vol_args);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/hostfs/hostfs_kern.c linux-libre-3.12.66-gnu/fs/hostfs/hostfs_kern.c
--- linux-libre-3.12.64-gnu/fs/hostfs/hostfs_kern.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/hostfs/hostfs_kern.c	2016-10-20 04:49:58.000000000 -0400
@@ -948,10 +948,11 @@ static int hostfs_fill_sb_common(struct
 
 	if (S_ISLNK(root_inode->i_mode)) {
 		char *name = follow_link(host_root_path);
-		if (IS_ERR(name))
+		if (IS_ERR(name)) {
 			err = PTR_ERR(name);
-		else
-			err = read_name(root_inode, name);
+			goto out_put;
+		}
+		err = read_name(root_inode, name);
 		kfree(name);
 		if (err)
 			goto out_put;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/nfs/callback_xdr.c linux-libre-3.12.66-gnu/fs/nfs/callback_xdr.c
--- linux-libre-3.12.64-gnu/fs/nfs/callback_xdr.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/nfs/callback_xdr.c	2016-10-20 04:49:58.000000000 -0400
@@ -915,7 +915,7 @@ static __be32 nfs4_callback_compound(str
 	if (hdr_arg.minorversion == 0) {
 		cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
 		if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
-			return rpc_drop_reply;
+			goto out_invalidcred;
 	}
 
 	cps.minorversion = hdr_arg.minorversion;
@@ -943,6 +943,10 @@ static __be32 nfs4_callback_compound(str
 	nfs_put_client(cps.clp);
 	dprintk("%s: done, status = %u\n", __func__, ntohl(status));
 	return rpc_success;
+
+out_invalidcred:
+	pr_warn_ratelimited("NFS: NFSv4 callback contains invalid cred\n");
+	return rpc_autherr_badcred;
 }
 
 /*
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/nfsd/nfs4state.c linux-libre-3.12.66-gnu/fs/nfsd/nfs4state.c
--- linux-libre-3.12.64-gnu/fs/nfsd/nfs4state.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/nfsd/nfs4state.c	2016-10-20 04:49:58.000000000 -0400
@@ -2270,7 +2270,8 @@ out:
 	if (!list_empty(&clp->cl_revoked))
 		seq->status_flags |= SEQ4_STATUS_RECALLABLE_STATE_REVOKED;
 out_no_session:
-	kfree(conn);
+	if (conn)
+		free_conn(conn);
 	spin_unlock(&nn->client_lock);
 	return status;
 out_put_session:
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/ocfs2/dlm/dlmconvert.c linux-libre-3.12.66-gnu/fs/ocfs2/dlm/dlmconvert.c
--- linux-libre-3.12.64-gnu/fs/ocfs2/dlm/dlmconvert.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/ocfs2/dlm/dlmconvert.c	2016-10-20 04:49:58.000000000 -0400
@@ -262,7 +262,6 @@ enum dlm_status dlmconvert_remote(struct
 				  struct dlm_lock *lock, int flags, int type)
 {
 	enum dlm_status status;
-	u8 old_owner = res->owner;
 
 	mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type,
 	     lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS);
@@ -329,7 +328,6 @@ enum dlm_status dlmconvert_remote(struct
 
 	spin_lock(&res->spinlock);
 	res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
-	lock->convert_pending = 0;
 	/* if it failed, move it back to granted queue.
 	 * if master returns DLM_NORMAL and then down before sending ast,
 	 * it may have already been moved to granted queue, reset to
@@ -338,12 +336,14 @@ enum dlm_status dlmconvert_remote(struct
 		if (status != DLM_NOTQUEUED)
 			dlm_error(status);
 		dlm_revert_pending_convert(res, lock);
-	} else if ((res->state & DLM_LOCK_RES_RECOVERING) ||
-			(old_owner != res->owner)) {
-		mlog(0, "res %.*s is in recovering or has been recovered.\n",
-				res->lockname.len, res->lockname.name);
+	} else if (!lock->convert_pending) {
+		mlog(0, "%s: res %.*s, owner died and lock has been moved back "
+				"to granted list, retry convert.\n",
+				dlm->name, res->lockname.len, res->lockname.name);
 		status = DLM_RECOVERING;
 	}
+
+	lock->convert_pending = 0;
 bail:
 	spin_unlock(&res->spinlock);
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/ocfs2/file.c linux-libre-3.12.66-gnu/fs/ocfs2/file.c
--- linux-libre-3.12.64-gnu/fs/ocfs2/file.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/ocfs2/file.c	2016-10-20 04:49:58.000000000 -0400
@@ -1495,7 +1495,8 @@ static int ocfs2_zero_partial_clusters(s
 				       u64 start, u64 len)
 {
 	int ret = 0;
-	u64 tmpend, end = start + len;
+	u64 tmpend = 0;
+	u64 end = start + len;
 	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 	unsigned int csize = osb->s_clustersize;
 	handle_t *handle;
@@ -1527,18 +1528,31 @@ static int ocfs2_zero_partial_clusters(s
 	}
 
 	/*
-	 * We want to get the byte offset of the end of the 1st cluster.
+	 * If start is on a cluster boundary and end is somewhere in another
+	 * cluster, we have not COWed the cluster starting at start, unless
+	 * end is also within the same cluster. So, in this case, we skip this
+	 * first call to ocfs2_zero_range_for_truncate() truncate and move on
+	 * to the next one.
 	 */
-	tmpend = (u64)osb->s_clustersize + (start & ~(osb->s_clustersize - 1));
-	if (tmpend > end)
-		tmpend = end;
+	if ((start & (csize - 1)) != 0) {
+		/*
+		 * We want to get the byte offset of the end of the 1st
+		 * cluster.
+		 */
+		tmpend = (u64)osb->s_clustersize +
+			(start & ~(osb->s_clustersize - 1));
+		if (tmpend > end)
+			tmpend = end;
 
-	trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start,
-						 (unsigned long long)tmpend);
+		trace_ocfs2_zero_partial_clusters_range1(
+			(unsigned long long)start,
+			(unsigned long long)tmpend);
 
-	ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend);
-	if (ret)
-		mlog_errno(ret);
+		ret = ocfs2_zero_range_for_truncate(inode, handle, start,
+						    tmpend);
+		if (ret)
+			mlog_errno(ret);
+	}
 
 	if (tmpend < end) {
 		/*
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/reiserfs/ibalance.c linux-libre-3.12.66-gnu/fs/reiserfs/ibalance.c
--- linux-libre-3.12.64-gnu/fs/reiserfs/ibalance.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/reiserfs/ibalance.c	2016-10-20 04:49:58.000000000 -0400
@@ -1082,8 +1082,9 @@ int balance_internal(struct tree_balance
 				       insert_ptr);
 	}
 
-	memcpy(new_insert_key_addr, &new_insert_key, KEY_SIZE);
 	insert_ptr[0] = new_insert_ptr;
+	if (new_insert_ptr)
+		memcpy(new_insert_key_addr, &new_insert_key, KEY_SIZE);
 
 	return order;
 }
diff -druNp --no-dereference linux-libre-3.12.64-gnu/fs/xfs/xfs_inode_buf.c linux-libre-3.12.66-gnu/fs/xfs/xfs_inode_buf.c
--- linux-libre-3.12.64-gnu/fs/xfs/xfs_inode_buf.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/fs/xfs/xfs_inode_buf.c	2016-10-20 04:49:58.000000000 -0400
@@ -99,7 +99,7 @@ xfs_inode_buf_verify(
 						XFS_RANDOM_ITOBP_INOTOBP))) {
 			if (readahead) {
 				bp->b_flags &= ~XBF_DONE;
-				xfs_buf_ioerror(bp, -EIO);
+				xfs_buf_ioerror(bp, EIO);
 				return;
 			}
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/include/linux/can/dev.h linux-libre-3.12.66-gnu/include/linux/can/dev.h
--- linux-libre-3.12.64-gnu/include/linux/can/dev.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/include/linux/can/dev.h	2016-10-20 04:49:58.000000000 -0400
@@ -31,6 +31,7 @@ enum can_mode {
  * CAN common private data
  */
 struct can_priv {
+	struct net_device *dev;
 	struct can_device_stats can_stats;
 
 	struct can_bittiming bittiming;
@@ -42,7 +43,7 @@ struct can_priv {
 	u32 ctrlmode_supported;
 
 	int restart_ms;
-	struct timer_list restart_timer;
+	struct delayed_work restart_work;
 
 	int (*do_set_bittiming)(struct net_device *dev);
 	int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/include/linux/mfd/88pm80x.h linux-libre-3.12.66-gnu/include/linux/mfd/88pm80x.h
--- linux-libre-3.12.64-gnu/include/linux/mfd/88pm80x.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/include/linux/mfd/88pm80x.h	2016-10-20 04:49:58.000000000 -0400
@@ -349,7 +349,7 @@ static inline int pm80x_dev_suspend(stru
 	int irq = platform_get_irq(pdev, 0);
 
 	if (device_may_wakeup(dev))
-		set_bit((1 << irq), &chip->wu_flag);
+		set_bit(irq, &chip->wu_flag);
 
 	return 0;
 }
@@ -361,7 +361,7 @@ static inline int pm80x_dev_resume(struc
 	int irq = platform_get_irq(pdev, 0);
 
 	if (device_may_wakeup(dev))
-		clear_bit((1 << irq), &chip->wu_flag);
+		clear_bit(irq, &chip->wu_flag);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-3.12.64-gnu/include/linux/mm.h linux-libre-3.12.66-gnu/include/linux/mm.h
--- linux-libre-3.12.64-gnu/include/linux/mm.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/include/linux/mm.h	2016-10-20 04:49:58.000000000 -0400
@@ -1749,6 +1749,7 @@ static inline struct page *follow_page(s
 #define FOLL_HWPOISON	0x100	/* check page is hwpoisoned */
 #define FOLL_NUMA	0x200	/* force NUMA hinting page fault */
 #define FOLL_MIGRATION	0x400	/* wait for page to replace migration entry */
+#define FOLL_COW	0x4000	/* internal GUP flag */
 
 typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
 			void *data);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/include/linux/pagemap.h linux-libre-3.12.66-gnu/include/linux/pagemap.h
--- linux-libre-3.12.64-gnu/include/linux/pagemap.h	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/include/linux/pagemap.h	2016-10-20 04:49:58.000000000 -0400
@@ -574,56 +574,56 @@ static inline int fault_in_pages_readabl
  */
 static inline int fault_in_multipages_writeable(char __user *uaddr, int size)
 {
-	int ret = 0;
 	char __user *end = uaddr + size - 1;
 
 	if (unlikely(size == 0))
-		return ret;
+		return 0;
 
+	if (unlikely(uaddr > end))
+		return -EFAULT;
 	/*
 	 * Writing zeroes into userspace here is OK, because we know that if
 	 * the zero gets there, we'll be overwriting it.
 	 */
-	while (uaddr <= end) {
-		ret = __put_user(0, uaddr);
-		if (ret != 0)
-			return ret;
+	do {
+		if (unlikely(__put_user(0, uaddr) != 0))
+			return -EFAULT;
 		uaddr += PAGE_SIZE;
-	}
+	} while (uaddr <= end);
 
 	/* Check whether the range spilled into the next page. */
 	if (((unsigned long)uaddr & PAGE_MASK) ==
 			((unsigned long)end & PAGE_MASK))
-		ret = __put_user(0, end);
+		return __put_user(0, end);
 
-	return ret;
+	return 0;
 }
 
 static inline int fault_in_multipages_readable(const char __user *uaddr,
 					       int size)
 {
 	volatile char c;
-	int ret = 0;
 	const char __user *end = uaddr + size - 1;
 
 	if (unlikely(size == 0))
-		return ret;
+		return 0;
 
-	while (uaddr <= end) {
-		ret = __get_user(c, uaddr);
-		if (ret != 0)
-			return ret;
+	if (unlikely(uaddr > end))
+		return -EFAULT;
+
+	do {
+		if (unlikely(__get_user(c, uaddr) != 0))
+			return -EFAULT;
 		uaddr += PAGE_SIZE;
-	}
+	} while (uaddr <= end);
 
 	/* Check whether the range spilled into the next page. */
 	if (((unsigned long)uaddr & PAGE_MASK) ==
 			((unsigned long)end & PAGE_MASK)) {
-		ret = __get_user(c, end);
-		(void)c;
+		return __get_user(c, end);
 	}
 
-	return ret;
+	return 0;
 }
 
 int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
diff -druNp --no-dereference linux-libre-3.12.64-gnu/kernel/fork.c linux-libre-3.12.66-gnu/kernel/fork.c
--- linux-libre-3.12.64-gnu/kernel/fork.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/kernel/fork.c	2016-10-20 04:49:58.000000000 -0400
@@ -770,14 +770,12 @@ void mm_release(struct task_struct *tsk,
 	deactivate_mm(tsk, mm);
 
 	/*
-	 * If we're exiting normally, clear a user-space tid field if
-	 * requested.  We leave this alone when dying by signal, to leave
-	 * the value intact in a core dump, and to save the unnecessary
-	 * trouble, say, a killed vfork parent shouldn't touch this mm.
-	 * Userland only wants this done for a sys_exit.
+	 * Signal userspace if we're not exiting with a core dump
+	 * because we want to leave the value intact for debugging
+	 * purposes.
 	 */
 	if (tsk->clear_child_tid) {
-		if (!(tsk->flags & PF_SIGNALED) &&
+		if (!(tsk->signal->flags & SIGNAL_GROUP_COREDUMP) &&
 		    atomic_read(&mm->mm_users) > 1) {
 			/*
 			 * We don't check the error code - if userspace has
diff -druNp --no-dereference linux-libre-3.12.64-gnu/kernel/printk/braille.c linux-libre-3.12.66-gnu/kernel/printk/braille.c
--- linux-libre-3.12.64-gnu/kernel/printk/braille.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/kernel/printk/braille.c	2016-10-20 04:49:58.000000000 -0400
@@ -9,10 +9,10 @@
 
 char *_braille_console_setup(char **str, char **brl_options)
 {
-	if (!memcmp(*str, "brl,", 4)) {
+	if (!strncmp(*str, "brl,", 4)) {
 		*brl_options = "";
 		*str += 4;
-	} else if (!memcmp(str, "brl=", 4)) {
+	} else if (!strncmp(*str, "brl=", 4)) {
 		*brl_options = *str + 4;
 		*str = strchr(*brl_options, ',');
 		if (!*str)
diff -druNp --no-dereference linux-libre-3.12.64-gnu/kernel/sched/core.c linux-libre-3.12.66-gnu/kernel/sched/core.c
--- linux-libre-3.12.64-gnu/kernel/sched/core.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/kernel/sched/core.c	2016-10-20 04:49:58.000000000 -0400
@@ -1503,11 +1503,52 @@ try_to_wake_up(struct task_struct *p, un
 	success = 1; /* we're going to change ->state */
 	cpu = task_cpu(p);
 
+	/*
+	 * Ensure we load p->on_rq _after_ p->state, otherwise it would
+	 * be possible to, falsely, observe p->on_rq == 0 and get stuck
+	 * in smp_cond_load_acquire() below.
+	 *
+	 * sched_ttwu_pending()                 try_to_wake_up()
+	 *   [S] p->on_rq = 1;                  [L] P->state
+	 *       UNLOCK rq->lock  -----.
+	 *                              \
+	 *				 +---   RMB
+	 * schedule()                   /
+	 *       LOCK rq->lock    -----'
+	 *       UNLOCK rq->lock
+	 *
+	 * [task p]
+	 *   [S] p->state = UNINTERRUPTIBLE     [L] p->on_rq
+	 *
+	 * Pairs with the UNLOCK+LOCK on rq->lock from the
+	 * last wakeup of our task and the schedule that got our task
+	 * current.
+	 */
+	smp_rmb();
 	if (p->on_rq && ttwu_remote(p, wake_flags))
 		goto stat;
 
 #ifdef CONFIG_SMP
 	/*
+	 * Ensure we load p->on_cpu _after_ p->on_rq, otherwise it would be
+	 * possible to, falsely, observe p->on_cpu == 0.
+	 *
+	 * One must be running (->on_cpu == 1) in order to remove oneself
+	 * from the runqueue.
+	 *
+	 *  [S] ->on_cpu = 1;	[L] ->on_rq
+	 *      UNLOCK rq->lock
+	 *			RMB
+	 *      LOCK   rq->lock
+	 *  [S] ->on_rq = 0;    [L] ->on_cpu
+	 *
+	 * Pairs with the full barrier implied in the UNLOCK+LOCK on rq->lock
+	 * from the consecutive calls to schedule(); the first switching to our
+	 * task, the second putting it to sleep.
+	 */
+	smp_rmb();
+
+	/*
 	 * If the owning (remote) cpu is still in the middle of schedule() with
 	 * this task as prev, wait until its done referencing the task.
 	 */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/kernel/time/clockevents.c linux-libre-3.12.66-gnu/kernel/time/clockevents.c
--- linux-libre-3.12.64-gnu/kernel/time/clockevents.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/kernel/time/clockevents.c	2016-10-20 04:49:58.000000000 -0400
@@ -371,7 +371,7 @@ int clockevents_unbind_device(struct clo
 	mutex_unlock(&clockevents_mutex);
 	return ret;
 }
-EXPORT_SYMBOL_GPL(clockevents_unbind);
+EXPORT_SYMBOL_GPL(clockevents_unbind_device);
 
 /**
  * clockevents_register_device - register a clock event device
diff -druNp --no-dereference linux-libre-3.12.64-gnu/kernel/trace/Makefile linux-libre-3.12.66-gnu/kernel/trace/Makefile
--- linux-libre-3.12.64-gnu/kernel/trace/Makefile	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/kernel/trace/Makefile	2016-10-20 04:49:58.000000000 -0400
@@ -1,4 +1,8 @@
 
+# We are fully aware of the dangers of __builtin_return_address()
+FRAME_CFLAGS := $(call cc-disable-warning,frame-address)
+KBUILD_CFLAGS += $(FRAME_CFLAGS)
+
 # Do not instrument the tracer itself:
 
 ifdef CONFIG_FUNCTION_TRACER
diff -druNp --no-dereference linux-libre-3.12.64-gnu/kernel/trace/trace.c linux-libre-3.12.66-gnu/kernel/trace/trace.c
--- linux-libre-3.12.64-gnu/kernel/trace/trace.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/kernel/trace/trace.c	2016-10-20 04:49:58.000000000 -0400
@@ -4132,13 +4132,6 @@ tracing_read_pipe(struct file *filp, cha
 	struct trace_array *tr = iter->tr;
 	ssize_t sret;
 
-	/* return any leftover data */
-	sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
-	if (sret != -EBUSY)
-		return sret;
-
-	trace_seq_init(&iter->seq);
-
 	/* copy the tracer to avoid using a global lock all around */
 	mutex_lock(&trace_types_lock);
 	if (unlikely(iter->trace->name != tr->current_trace->name))
@@ -4151,6 +4144,14 @@ tracing_read_pipe(struct file *filp, cha
 	 * is protected.
 	 */
 	mutex_lock(&iter->mutex);
+
+	/* return any leftover data */
+	sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
+	if (sret != -EBUSY)
+		goto out;
+
+	trace_seq_init(&iter->seq);
+
 	if (iter->trace->read) {
 		sret = iter->trace->read(iter, filp, ubuf, cnt, ppos);
 		if (sret)
@@ -5179,11 +5180,6 @@ tracing_buffers_splice_read(struct file
 	}
 #endif
 
-	if (splice_grow_spd(pipe, &spd)) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
 	if (*ppos & (PAGE_SIZE - 1)) {
 		ret = -EINVAL;
 		goto out;
@@ -5197,6 +5193,11 @@ tracing_buffers_splice_read(struct file
 		len &= PAGE_MASK;
 	}
 
+	if (splice_grow_spd(pipe, &spd)) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
  again:
 	trace_access_lock(iter->cpu_file);
 	entries = ring_buffer_entries_cpu(iter->trace_buffer->buffer, iter->cpu_file);
@@ -5252,21 +5253,22 @@ tracing_buffers_splice_read(struct file
 	if (!spd.nr_pages) {
 		if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) {
 			ret = -EAGAIN;
-			goto out;
+			goto out_shrink;
 		}
 		mutex_unlock(&trace_types_lock);
 		ret = iter->trace->wait_pipe(iter);
 		mutex_lock(&trace_types_lock);
 		if (ret)
-			goto out;
+			goto out_shrink;
 		if (signal_pending(current)) {
 			ret = -EINTR;
-			goto out;
+			goto out_shrink;
 		}
 		goto again;
 	}
 
 	ret = splice_to_pipe(pipe, &spd);
+out_shrink:
 	splice_shrink_spd(&spd);
 out:
 	mutex_unlock(&trace_types_lock);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/lib/ratelimit.c linux-libre-3.12.66-gnu/lib/ratelimit.c
--- linux-libre-3.12.64-gnu/lib/ratelimit.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/lib/ratelimit.c	2016-10-20 04:49:58.000000000 -0400
@@ -49,7 +49,7 @@ int ___ratelimit(struct ratelimit_state
 		if (rs->missed)
 			printk(KERN_WARNING "%s: %d callbacks suppressed\n",
 				func, rs->missed);
-		rs->begin   = 0;
+		rs->begin   = jiffies;
 		rs->printed = 0;
 		rs->missed  = 0;
 	}
diff -druNp --no-dereference linux-libre-3.12.64-gnu/Makefile linux-libre-3.12.66-gnu/Makefile
--- linux-libre-3.12.64-gnu/Makefile	2016-10-03 10:40:31.000000000 -0400
+++ linux-libre-3.12.66-gnu/Makefile	2016-10-21 04:47:27.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 12
-SUBLEVEL = 64
+SUBLEVEL = 66
 EXTRAVERSION =-gnu
 NAME = One Giant Leap for Frogkind
 
@@ -113,6 +113,10 @@ _all:
 # Cancel implicit rules on top Makefile
 $(CURDIR)/Makefile Makefile: ;
 
+ifneq ($(words $(subst :, ,$(CURDIR))), 1)
+  $(error main directory cannot contain spaces nor colons)
+endif
+
 ifneq ($(KBUILD_OUTPUT),)
 # Invoke a second make in the output directory, passing relevant variables
 # check that the output directory actually exists
@@ -347,7 +351,7 @@ AFLAGS_MODULE   =
 LDFLAGS_MODULE  =
 CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
-CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage
+CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage -fno-tree-loop-im
 
 
 # Use USERINCLUDE when you must reference the UAPI directories only.
@@ -476,6 +480,12 @@ ifeq ($(KBUILD_EXTMOD),)
                 endif
         endif
 endif
+# install and module_install need also be processed one by one
+ifneq ($(filter install,$(MAKECMDGOALS)),)
+        ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
+	        mixed-targets := 1
+        endif
+endif
 
 ifeq ($(mixed-targets),1)
 # ===========================================================================
@@ -572,10 +582,16 @@ endif # $(dot-config)
 # Defaults to vmlinux, but the arch makefile usually adds further targets
 all: vmlinux
 
+KBUILD_CFLAGS	+= $(call cc-disable-warning,maybe-uninitialized,)
+
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS	+= -Os
 else
+ifdef CONFIG_PROFILE_ALL_BRANCHES
 KBUILD_CFLAGS	+= -O2
+else
+KBUILD_CFLAGS   += -O2
+endif
 endif
 
 include $(srctree)/arch/$(SRCARCH)/Makefile
@@ -1113,7 +1129,7 @@ help:
 	@echo  '  firmware_install- Install all firmware to INSTALL_FW_PATH'
 	@echo  '                    (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
 	@echo  '  dir/            - Build all files in dir and below'
-	@echo  '  dir/file.[oisS] - Build specified target only'
+	@echo  '  dir/file.[ois]  - Build specified target only'
 	@echo  '  dir/file.lst    - Build specified mixed source/assembly target only'
 	@echo  '                    (requires a recent binutils and recent build (System.map))'
 	@echo  '  dir/file.ko     - Build module including final link'
diff -druNp --no-dereference linux-libre-3.12.64-gnu/mm/ksm.c linux-libre-3.12.66-gnu/mm/ksm.c
--- linux-libre-3.12.64-gnu/mm/ksm.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/mm/ksm.c	2016-10-20 04:49:58.000000000 -0400
@@ -283,7 +283,8 @@ static inline struct rmap_item *alloc_rm
 {
 	struct rmap_item *rmap_item;
 
-	rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL);
+	rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL |
+						__GFP_NORETRY | __GFP_NOWARN);
 	if (rmap_item)
 		ksm_rmap_items++;
 	return rmap_item;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/mm/memory.c linux-libre-3.12.66-gnu/mm/memory.c
--- linux-libre-3.12.64-gnu/mm/memory.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/mm/memory.c	2016-10-20 04:49:58.000000000 -0400
@@ -1441,6 +1441,16 @@ int zap_vma_ptes(struct vm_area_struct *
 }
 EXPORT_SYMBOL_GPL(zap_vma_ptes);
 
+/*
+ * FOLL_FORCE can write to even unwritable pte's, but only
+ * after we've gone through a COW cycle and they are dirty.
+ */
+static inline bool can_follow_write_pte(pte_t pte, unsigned int flags)
+{
+	return pte_write(pte) ||
+		((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte));
+}
+
 /**
  * follow_page_mask - look up a page descriptor from a user-virtual address
  * @vma: vm_area_struct mapping @address
@@ -1550,7 +1560,7 @@ split_fallthrough:
 	}
 	if ((flags & FOLL_NUMA) && pte_numa(pte))
 		goto no_page;
-	if ((flags & FOLL_WRITE) && !pte_write(pte))
+	if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags))
 		goto unlock;
 
 	page = vm_normal_page(vma, address, pte);
@@ -1858,7 +1868,7 @@ long __get_user_pages(struct task_struct
 				 */
 				if ((ret & VM_FAULT_WRITE) &&
 				    !(vma->vm_flags & VM_WRITE))
-					foll_flags &= ~FOLL_WRITE;
+					foll_flags |= FOLL_COW;
 
 				cond_resched();
 			}
diff -druNp --no-dereference linux-libre-3.12.64-gnu/net/caif/cfpkt_skbuff.c linux-libre-3.12.66-gnu/net/caif/cfpkt_skbuff.c
--- linux-libre-3.12.64-gnu/net/caif/cfpkt_skbuff.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/net/caif/cfpkt_skbuff.c	2016-10-20 04:49:58.000000000 -0400
@@ -296,7 +296,7 @@ int cfpkt_setlen(struct cfpkt *pkt, u16
 		else
 			skb_trim(skb, len);
 
-			return cfpkt_getlen(pkt);
+		return cfpkt_getlen(pkt);
 	}
 
 	/* Need to expand SKB */
diff -druNp --no-dereference linux-libre-3.12.64-gnu/net/sunrpc/svc.c linux-libre-3.12.66-gnu/net/sunrpc/svc.c
--- linux-libre-3.12.64-gnu/net/sunrpc/svc.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/net/sunrpc/svc.c	2016-10-20 04:49:58.000000000 -0400
@@ -1182,11 +1182,17 @@ svc_process_common(struct svc_rqst *rqst
 		*statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
 
 		/* Encode reply */
-		if (rqstp->rq_dropme) {
+		if (*statp == rpc_drop_reply ||
+		    rqstp->rq_dropme) {
 			if (procp->pc_release)
 				procp->pc_release(rqstp, NULL, rqstp->rq_resp);
 			goto dropit;
 		}
+		if (*statp == rpc_autherr_badcred) {
+			if (procp->pc_release)
+				procp->pc_release(rqstp, NULL, rqstp->rq_resp);
+			goto err_bad_auth;
+		}
 		if (*statp == rpc_success &&
 		    (xdr = procp->pc_encode) &&
 		    !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
diff -druNp --no-dereference linux-libre-3.12.64-gnu/scripts/headers.sh linux-libre-3.12.66-gnu/scripts/headers.sh
--- linux-libre-3.12.64-gnu/scripts/headers.sh	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/scripts/headers.sh	2016-10-20 04:49:58.000000000 -0400
@@ -19,8 +19,6 @@ for arch in ${archs}; do
 	case ${arch} in
 	um)        # no userspace export
 		;;
-	cris)      # headers export are known broken
-		;;
 	*)
 		if [ -d ${srctree}/arch/${arch} ]; then
 			do_command $1 ${arch}
diff -druNp --no-dereference linux-libre-3.12.64-gnu/security/yama/yama_lsm.c linux-libre-3.12.66-gnu/security/yama/yama_lsm.c
--- linux-libre-3.12.64-gnu/security/yama/yama_lsm.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/security/yama/yama_lsm.c	2016-10-20 04:49:58.000000000 -0400
@@ -292,7 +292,7 @@ int yama_ptrace_access_check(struct task
 		return rc;
 
 	/* require ptrace target be a child of ptracer on attach */
-	if (mode == PTRACE_MODE_ATTACH) {
+	if (mode & PTRACE_MODE_ATTACH) {
 		switch (ptrace_scope) {
 		case YAMA_SCOPE_DISABLED:
 			/* No additional restrictions. */
@@ -318,7 +318,7 @@ int yama_ptrace_access_check(struct task
 		}
 	}
 
-	if (rc) {
+	if (rc && (mode & PTRACE_MODE_NOAUDIT) == 0) {
 		printk_ratelimited(KERN_NOTICE
 			"ptrace of pid %d was attempted by: %s (pid %d)\n",
 			child->pid, current->comm, current->pid);
diff -druNp --no-dereference linux-libre-3.12.64-gnu/sound/pci/ali5451/ali5451.c linux-libre-3.12.66-gnu/sound/pci/ali5451/ali5451.c
--- linux-libre-3.12.64-gnu/sound/pci/ali5451/ali5451.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/sound/pci/ali5451/ali5451.c	2016-10-20 04:49:58.000000000 -0400
@@ -1422,6 +1422,7 @@ snd_ali_playback_pointer(struct snd_pcm_
 	spin_unlock(&codec->reg_lock);
 	snd_ali_printk("playback pointer returned cso=%xh.\n", cso);
 
+	cso %= runtime->buffer_size;
 	return cso;
 }
 
@@ -1442,6 +1443,7 @@ static snd_pcm_uframes_t snd_ali_pointer
 	cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
 	spin_unlock(&codec->reg_lock);
 
+	cso %= runtime->buffer_size;
 	return cso;
 }
 
diff -druNp --no-dereference linux-libre-3.12.64-gnu/sound/soc/omap/omap-mcpdm.c linux-libre-3.12.66-gnu/sound/soc/omap/omap-mcpdm.c
--- linux-libre-3.12.64-gnu/sound/soc/omap/omap-mcpdm.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/sound/soc/omap/omap-mcpdm.c	2016-10-20 04:49:58.000000000 -0400
@@ -392,8 +392,8 @@ static int omap_mcpdm_probe(struct snd_s
 	pm_runtime_get_sync(mcpdm->dev);
 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, 0x00);
 
-	ret = devm_request_irq(mcpdm->dev, mcpdm->irq, omap_mcpdm_irq_handler,
-				0, "McPDM", (void *)mcpdm);
+	ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler, 0, "McPDM",
+			  (void *)mcpdm);
 
 	pm_runtime_put_sync(mcpdm->dev);
 
@@ -413,6 +413,7 @@ static int omap_mcpdm_remove(struct snd_
 {
 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
 
+	free_irq(mcpdm->irq, (void *)mcpdm);
 	pm_runtime_disable(mcpdm->dev);
 
 	return 0;
diff -druNp --no-dereference linux-libre-3.12.64-gnu/tools/vm/slabinfo.c linux-libre-3.12.66-gnu/tools/vm/slabinfo.c
--- linux-libre-3.12.64-gnu/tools/vm/slabinfo.c	2016-09-29 05:29:36.000000000 -0400
+++ linux-libre-3.12.66-gnu/tools/vm/slabinfo.c	2016-10-20 04:49:58.000000000 -0400
@@ -493,10 +493,11 @@ static void slab_stats(struct slabinfo *
 			s->alloc_node_mismatch, (s->alloc_node_mismatch * 100) / total);
 	}
 
-	if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail)
+	if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) {
 		printf("\nCmpxchg_double Looping\n------------------------\n");
 		printf("Locked Cmpxchg Double redos   %lu\nUnlocked Cmpxchg Double redos %lu\n",
 			s->cmpxchg_double_fail, s->cmpxchg_double_cpu_fail);
+	}
 }
 
 static void report(struct slabinfo *s)
