diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/arm/kvm/init.S linux-libre-3.18.57-gnu/arch/arm/kvm/init.S
--- linux-libre-3.18.56-gnu/arch/arm/kvm/init.S	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/arm/kvm/init.S	2017-06-14 06:54:45.000000000 -0400
@@ -110,7 +110,6 @@ __do_hyp_init:
 	@  - Write permission implies XN: disabled
 	@  - Instruction cache: enabled
 	@  - Data/Unified cache: enabled
-	@  - Memory alignment checks: enabled
 	@  - MMU: enabled (this code must be run from an identity mapping)
 	mrc	p15, 4, r0, c1, c0, 0	@ HSCR
 	ldr	r2, =HSCTLR_MASK
@@ -118,8 +117,8 @@ __do_hyp_init:
 	mrc	p15, 0, r1, c1, c0, 0	@ SCTLR
 	ldr	r2, =(HSCTLR_EE | HSCTLR_FI | HSCTLR_I | HSCTLR_C)
 	and	r1, r1, r2
- ARM(	ldr	r2, =(HSCTLR_M | HSCTLR_A)			)
- THUMB(	ldr	r2, =(HSCTLR_M | HSCTLR_A | HSCTLR_TE)		)
+ ARM(	ldr	r2, =(HSCTLR_M)					)
+ THUMB(	ldr	r2, =(HSCTLR_M | HSCTLR_TE)			)
 	orr	r1, r1, r2
 	orr	r0, r0, r1
 	isb
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/arm64/include/asm/asm-uaccess.h linux-libre-3.18.57-gnu/arch/arm64/include/asm/asm-uaccess.h
--- linux-libre-3.18.56-gnu/arch/arm64/include/asm/asm-uaccess.h	1969-12-31 19:00:00.000000000 -0500
+++ linux-libre-3.18.57-gnu/arch/arm64/include/asm/asm-uaccess.h	2017-06-14 06:54:45.000000000 -0400
@@ -0,0 +1,13 @@
+#ifndef __ASM_ASM_UACCESS_H
+#define __ASM_ASM_UACCESS_H
+
+/*
+ * Remove the address tag from a virtual address, if present.
+ */
+	.macro	clear_address_tag, dst, addr
+	tst	\addr, #(1 << 55)
+	bic	\dst, \addr, #(0xff << 56)
+	csel	\dst, \dst, \addr, eq
+	.endm
+
+#endif
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/arm64/include/asm/barrier.h linux-libre-3.18.57-gnu/arch/arm64/include/asm/barrier.h
--- linux-libre-3.18.56-gnu/arch/arm64/include/asm/barrier.h	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/arm64/include/asm/barrier.h	2017-06-14 06:54:45.000000000 -0400
@@ -60,15 +60,21 @@ do {									\
 
 #define smp_store_release(p, v)						\
 do {									\
+	union { typeof(*p) __val; char __c[1]; } __u =			\
+		{ .__val = (__force typeof(*p)) (v) }; 			\
 	compiletime_assert_atomic_type(*p);				\
 	switch (sizeof(*p)) {						\
 	case 4:								\
 		asm volatile ("stlr %w1, %0"				\
-				: "=Q" (*p) : "r" (v) : "memory");	\
+				: "=Q" (*p)				\
+				: "r" (*(__u32 *)__u.__c)		\
+				: "memory");				\
 		break;							\
 	case 8:								\
 		asm volatile ("stlr %1, %0"				\
-				: "=Q" (*p) : "r" (v) : "memory");	\
+				: "=Q" (*p)				\
+				: "r" (*(__u64 *)__u.__c)		\
+				: "memory");				\
 		break;							\
 	}								\
 } while (0)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/arm64/include/asm/uaccess.h linux-libre-3.18.57-gnu/arch/arm64/include/asm/uaccess.h
--- linux-libre-3.18.56-gnu/arch/arm64/include/asm/uaccess.h	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/arm64/include/asm/uaccess.h	2017-06-14 06:54:45.000000000 -0400
@@ -21,6 +21,7 @@
 /*
  * User space memory access functions
  */
+#include <linux/bitops.h>
 #include <linux/string.h>
 #include <linux/thread_info.h>
 
@@ -100,6 +101,13 @@ static inline void set_fs(mm_segment_t f
 	flag;								\
 })
 
+/*
+ * When dealing with data aborts, watchpoints, or instruction traps we may end
+ * up with a tagged userland pointer. Clear the tag to get a sane pointer to
+ * pass on to access_ok(), for instance.
+ */
+#define untagged_addr(addr)		sign_extend64(addr, 55)
+
 #define access_ok(type, addr, size)	__range_ok(addr, size)
 #define user_addr_max			get_fs
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/arm64/kernel/entry.S linux-libre-3.18.57-gnu/arch/arm64/kernel/entry.S
--- linux-libre-3.18.56-gnu/arch/arm64/kernel/entry.S	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/arm64/kernel/entry.S	2017-06-14 06:54:45.000000000 -0400
@@ -28,6 +28,7 @@
 #include <asm/errno.h>
 #include <asm/esr.h>
 #include <asm/thread_info.h>
+#include <asm/asm-uaccess.h>
 #include <asm/unistd.h>
 
 /*
@@ -307,12 +308,13 @@ el1_da:
 	/*
 	 * Data abort handling
 	 */
-	mrs	x0, far_el1
+	mrs	x3, far_el1
 	enable_dbg
 	// re-enable interrupts if they were enabled in the aborted context
 	tbnz	x23, #7, 1f			// PSR_I_BIT
 	enable_irq
 1:
+	clear_address_tag x0, x3
 	mov	x2, sp				// struct pt_regs
 	bl	do_mem_abort
 
@@ -472,7 +474,7 @@ el0_da:
 	// enable interrupts before calling the main handler
 	enable_dbg_and_irq
 	ct_user_exit
-	bic	x0, x26, #(0xff << 56)
+	clear_address_tag x0, x26
 	mov	x1, x25
 	mov	x2, sp
 	adr	lr, ret_to_user
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/arm64/kernel/hw_breakpoint.c linux-libre-3.18.57-gnu/arch/arm64/kernel/hw_breakpoint.c
--- linux-libre-3.18.56-gnu/arch/arm64/kernel/hw_breakpoint.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/arm64/kernel/hw_breakpoint.c	2017-06-14 06:54:45.000000000 -0400
@@ -35,6 +35,7 @@
 #include <asm/traps.h>
 #include <asm/cputype.h>
 #include <asm/system_misc.h>
+#include <asm/uaccess.h>
 
 /* Breakpoint currently in use for each BRP. */
 static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]);
@@ -688,7 +689,7 @@ static int watchpoint_handler(unsigned l
 
 		/* Check if the watchpoint value matches. */
 		val = read_wb_reg(AARCH64_DBG_REG_WVR, i);
-		if (val != (addr & ~alignment_mask))
+		if (val != (untagged_addr(addr) & ~alignment_mask))
 			goto unlock;
 
 		/* Possible match, check the byte address select to confirm. */
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/powerpc/include/asm/topology.h linux-libre-3.18.57-gnu/arch/powerpc/include/asm/topology.h
--- linux-libre-3.18.56-gnu/arch/powerpc/include/asm/topology.h	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/powerpc/include/asm/topology.h	2017-06-14 06:54:45.000000000 -0400
@@ -44,8 +44,22 @@ extern void __init dump_numa_cpu_topolog
 extern int sysfs_add_device_to_node(struct device *dev, int nid);
 extern void sysfs_remove_device_from_node(struct device *dev, int nid);
 
+static inline int early_cpu_to_node(int cpu)
+{
+	int nid;
+
+	nid = numa_cpu_lookup_table[cpu];
+
+	/*
+	 * Fall back to node 0 if nid is unset (it should be, except bugs).
+	 * This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)).
+	 */
+	return (nid < 0) ? 0 : nid;
+}
 #else
 
+static inline int early_cpu_to_node(int cpu) { return 0; }
+
 static inline void dump_numa_cpu_topology(void) {}
 
 static inline int sysfs_add_device_to_node(struct device *dev, int nid)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/powerpc/kernel/eeh_driver.c linux-libre-3.18.57-gnu/arch/powerpc/kernel/eeh_driver.c
--- linux-libre-3.18.56-gnu/arch/powerpc/kernel/eeh_driver.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/powerpc/kernel/eeh_driver.c	2017-06-14 06:54:45.000000000 -0400
@@ -678,7 +678,7 @@ static int eeh_reset_device(struct eeh_p
  */
 #define MAX_WAIT_FOR_RECOVERY 300
 
-static void eeh_handle_normal_event(struct eeh_pe *pe)
+static bool eeh_handle_normal_event(struct eeh_pe *pe)
 {
 	struct pci_bus *frozen_bus;
 	int rc = 0;
@@ -688,7 +688,7 @@ static void eeh_handle_normal_event(stru
 	if (!frozen_bus) {
 		pr_err("%s: Cannot find PCI bus for PHB#%d-PE#%x\n",
 			__func__, pe->phb->global_number, pe->addr);
-		return;
+		return false;
 	}
 
 	eeh_pe_update_time_stamp(pe);
@@ -805,7 +805,7 @@ static void eeh_handle_normal_event(stru
 	pr_info("EEH: Notify device driver to resume\n");
 	eeh_pe_dev_traverse(pe, eeh_report_resume, NULL);
 
-	return;
+	return false;
 
 excess_failures:
 	/*
@@ -845,7 +845,11 @@ perm_error:
 		pci_lock_rescan_remove();
 		pcibios_remove_pci_devices(frozen_bus);
 		pci_unlock_rescan_remove();
+
+		/* The passed PE should no longer be used */
+		return true;
 	}
+	return false;
 }
 
 static void eeh_handle_special_event(void)
@@ -911,7 +915,14 @@ static void eeh_handle_special_event(voi
 		 */
 		if (rc == EEH_NEXT_ERR_FROZEN_PE ||
 		    rc == EEH_NEXT_ERR_FENCED_PHB) {
-			eeh_handle_normal_event(pe);
+			/*
+			 * eeh_handle_normal_event() can make the PE stale if it
+			 * determines that the PE cannot possibly be recovered.
+			 * Don't modify the PE state if that's the case.
+			 */
+			if (eeh_handle_normal_event(pe))
+				continue;
+
 			eeh_pe_state_clear(pe, EEH_PE_RECOVERING);
 		} else {
 			pci_lock_rescan_remove();
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/powerpc/kernel/setup_64.c linux-libre-3.18.57-gnu/arch/powerpc/kernel/setup_64.c
--- linux-libre-3.18.56-gnu/arch/powerpc/kernel/setup_64.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/powerpc/kernel/setup_64.c	2017-06-14 06:54:45.000000000 -0400
@@ -754,7 +754,7 @@ void ppc64_boot_msg(unsigned int src, co
 
 static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)
 {
-	return __alloc_bootmem_node(NODE_DATA(cpu_to_node(cpu)), size, align,
+	return __alloc_bootmem_node(NODE_DATA(early_cpu_to_node(cpu)), size, align,
 				    __pa(MAX_DMA_ADDRESS));
 }
 
@@ -765,7 +765,7 @@ static void __init pcpu_fc_free(void *pt
 
 static int pcpu_cpu_distance(unsigned int from, unsigned int to)
 {
-	if (cpu_to_node(from) == cpu_to_node(to))
+	if (early_cpu_to_node(from) == early_cpu_to_node(to))
 		return LOCAL_DISTANCE;
 	else
 		return REMOTE_DISTANCE;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/x86/kernel/kvm.c linux-libre-3.18.57-gnu/arch/x86/kernel/kvm.c
--- linux-libre-3.18.56-gnu/arch/x86/kernel/kvm.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/x86/kernel/kvm.c	2017-06-14 06:54:45.000000000 -0400
@@ -161,8 +161,8 @@ void kvm_async_pf_task_wait(u32 token)
 			 */
 			rcu_irq_exit();
 			native_safe_halt();
-			rcu_irq_enter();
 			local_irq_disable();
+			rcu_irq_enter();
 		}
 	}
 	if (!n.halted)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/arch/x86/kvm/cpuid.c linux-libre-3.18.57-gnu/arch/x86/kvm/cpuid.c
--- linux-libre-3.18.56-gnu/arch/x86/kvm/cpuid.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/arch/x86/kvm/cpuid.c	2017-06-14 06:54:45.000000000 -0400
@@ -691,18 +691,20 @@ out:
 static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i)
 {
 	struct kvm_cpuid_entry2 *e = &vcpu->arch.cpuid_entries[i];
-	int j, nent = vcpu->arch.cpuid_nent;
+	struct kvm_cpuid_entry2 *ej;
+	int j = i;
+	int nent = vcpu->arch.cpuid_nent;
 
 	e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT;
 	/* when no next entry is found, the current entry[i] is reselected */
-	for (j = i + 1; ; j = (j + 1) % nent) {
-		struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j];
-		if (ej->function == e->function) {
-			ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
-			return j;
-		}
-	}
-	return 0; /* silence gcc, even though control never reaches here */
+	do {
+		j = (j + 1) % nent;
+		ej = &vcpu->arch.cpuid_entries[j];
+	} while (ej->function != e->function);
+
+	ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
+
+	return j;
 }
 
 /* find an entry with matching function, matching index (if needed), and that
diff -druNp --no-dereference linux-libre-3.18.56-gnu/crypto/gcm.c linux-libre-3.18.57-gnu/crypto/gcm.c
--- linux-libre-3.18.56-gnu/crypto/gcm.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/crypto/gcm.c	2017-06-14 06:54:45.000000000 -0400
@@ -146,10 +146,8 @@ static int crypto_gcm_setkey(struct cryp
 
 	err = crypto_ablkcipher_encrypt(&data->req);
 	if (err == -EINPROGRESS || err == -EBUSY) {
-		err = wait_for_completion_interruptible(
-			&data->result.completion);
-		if (!err)
-			err = data->result.err;
+		wait_for_completion(&data->result.completion);
+		err = data->result.err;
 	}
 
 	if (err)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/char/mem.c linux-libre-3.18.57-gnu/drivers/char/mem.c
--- linux-libre-3.18.56-gnu/drivers/char/mem.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/char/mem.c	2017-06-14 06:54:45.000000000 -0400
@@ -332,7 +332,7 @@ static int mmap_mem(struct file *file, s
 	phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
 
 	/* It's illegal to wrap around the end of the physical address space. */
-	if (offset + (phys_addr_t)size < offset)
+	if (offset + (phys_addr_t)size - 1 < offset)
 		return -EINVAL;
 
 	if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size))
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/char/random.c linux-libre-3.18.57-gnu/drivers/char/random.c
--- linux-libre-3.18.56-gnu/drivers/char/random.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/char/random.c	2017-06-14 06:54:45.000000000 -0400
@@ -1714,13 +1714,15 @@ int random_int_secret_init(void)
 	return 0;
 }
 
+static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash)
+		__aligned(sizeof(unsigned long));
+
 /*
  * Get a random word for internal kernel use only. Similar to urandom but
  * with the goal of minimal entropy pool depletion. As a result, the random
  * value is not cryptographically secure but for several uses the cost of
  * depleting entropy is too high
  */
-static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash);
 unsigned int get_random_int(void)
 {
 	__u32 *hash;
@@ -1741,6 +1743,28 @@ unsigned int get_random_int(void)
 EXPORT_SYMBOL(get_random_int);
 
 /*
+ * Same as get_random_int(), but returns unsigned long.
+ */
+unsigned long get_random_long(void)
+{
+	__u32 *hash;
+	unsigned long ret;
+
+	if (arch_get_random_long(&ret))
+		return ret;
+
+	hash = get_cpu_var(get_random_int_hash);
+
+	hash[0] += current->pid + jiffies + random_get_entropy();
+	md5_transform(hash, random_int_secret);
+	ret = *(unsigned long *)hash;
+	put_cpu_var(get_random_int_hash);
+
+	return ret;
+}
+EXPORT_SYMBOL(get_random_long);
+
+/*
  * randomize_range() returns a start address such that
  *
  *    [...... <range> .....]
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/dma/ep93xx_dma.c linux-libre-3.18.57-gnu/drivers/dma/ep93xx_dma.c
--- linux-libre-3.18.56-gnu/drivers/dma/ep93xx_dma.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/dma/ep93xx_dma.c	2017-06-14 06:54:45.000000000 -0400
@@ -325,6 +325,8 @@ static int m2p_hw_setup(struct ep93xx_dm
 		| M2P_CONTROL_ENABLE;
 	m2p_set_control(edmac, control);
 
+	edmac->buffer = 0;
+
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c linux-libre-3.18.57-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
--- linux-libre-3.18.56-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c	2017-06-14 06:54:45.000000000 -0400
@@ -384,6 +384,8 @@ void *vmw_fifo_reserve(struct vmw_privat
 				return fifo_state->static_buffer;
 			else {
 				fifo_state->dynamic_buffer = vmalloc(bytes);
+				if (!fifo_state->dynamic_buffer)
+					goto out_err;
 				return fifo_state->dynamic_buffer;
 			}
 		}
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c linux-libre-3.18.57-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
--- linux-libre-3.18.56-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c	2017-06-14 06:54:45.000000000 -0400
@@ -1243,6 +1243,9 @@ int vmw_gb_surface_define_ioctl(struct d
 	const struct svga3d_surface_desc *desc;
 	uint32_t backup_handle;
 
+	if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS)
+		return -EINVAL;
+
 	if (unlikely(vmw_user_surface_size == 0))
 		vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) +
 			128;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/iio/proximity/as3935.c linux-libre-3.18.57-gnu/drivers/iio/proximity/as3935.c
--- linux-libre-3.18.56-gnu/drivers/iio/proximity/as3935.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/iio/proximity/as3935.c	2017-06-14 06:54:45.000000000 -0400
@@ -40,9 +40,9 @@
 #define AS3935_AFE_PWR_BIT	BIT(0)
 
 #define AS3935_INT		0x03
-#define AS3935_INT_MASK		0x07
+#define AS3935_INT_MASK		0x0f
 #define AS3935_EVENT_INT	BIT(3)
-#define AS3935_NOISE_INT	BIT(1)
+#define AS3935_NOISE_INT	BIT(0)
 
 #define AS3935_DATA		0x07
 #define AS3935_DATA_MASK	0x3F
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/infiniband/hw/mlx5/main.c linux-libre-3.18.57-gnu/drivers/infiniband/hw/mlx5/main.c
--- linux-libre-3.18.56-gnu/drivers/infiniband/hw/mlx5/main.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/infiniband/hw/mlx5/main.c	2017-06-14 06:54:45.000000000 -0400
@@ -30,7 +30,7 @@
  * SOFTWARE.
  */
 
-#include <asm-generic/kmap_types.h>
+#include <linux/highmem.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/errno.h>
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/infiniband/hw/qib/qib_rc.c linux-libre-3.18.57-gnu/drivers/infiniband/hw/qib/qib_rc.c
--- linux-libre-3.18.56-gnu/drivers/infiniband/hw/qib/qib_rc.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/infiniband/hw/qib/qib_rc.c	2017-06-14 06:54:45.000000000 -0400
@@ -2086,8 +2086,10 @@ send_last:
 		ret = qib_get_rwqe(qp, 1);
 		if (ret < 0)
 			goto nack_op_err;
-		if (!ret)
+		if (!ret) {
+			qib_put_ss(&qp->r_sge);
 			goto rnr_nak;
+		}
 		wc.ex.imm_data = ohdr->u.rc.imm_data;
 		hdrsize += 4;
 		wc.wc_flags = IB_WC_WITH_IMM;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c linux-libre-3.18.57-gnu/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
--- linux-libre-3.18.56-gnu/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c	2017-06-07 11:58:44.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c	2017-06-14 14:20:21.000000000 -0400
@@ -1929,7 +1929,7 @@ u16 bnx2x_select_queue(struct net_device
 	}
 
 	/* select a non-FCoE queue */
-	return fallback(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp);
+	return fallback(dev, skb) % (BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos);
 }
 
 void bnx2x_set_num_queues(struct bnx2x *bp)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c linux-libre-3.18.57-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
--- linux-libre-3.18.56-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c	2017-06-07 11:59:29.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c	2017-06-14 14:21:02.000000000 -0400
@@ -4579,10 +4579,14 @@ static int cxgb_up(struct adapter *adap)
 		if (err)
 			goto irq_err;
 	}
+
+	mutex_lock(&uld_mutex);
 	enable_rx(adap);
 	t4_sge_start(adap);
 	t4_intr_enable(adap);
 	adap->flags |= FULL_INIT_DONE;
+	mutex_unlock(&uld_mutex);
+
 	notify_ulds(adap, CXGB4_STATE_UP);
 #if IS_ENABLED(CONFIG_IPV6)
 	update_clip(adap);
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/net/ethernet/ethoc.c linux-libre-3.18.57-gnu/drivers/net/ethernet/ethoc.c
--- linux-libre-3.18.56-gnu/drivers/net/ethernet/ethoc.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/net/ethernet/ethoc.c	2017-06-14 06:54:45.000000000 -0400
@@ -706,6 +706,8 @@ static int ethoc_open(struct net_device
 	if (ret)
 		return ret;
 
+	napi_enable(&priv->napi);
+
 	ethoc_init_ring(priv, dev->mem_start);
 	ethoc_reset(priv);
 
@@ -718,7 +720,6 @@ static int ethoc_open(struct net_device
 	}
 
 	phy_start(priv->phy);
-	napi_enable(&priv->napi);
 
 	if (netif_msg_ifup(priv)) {
 		dev_info(&dev->dev, "I/O: %08lx Memory: %08lx-%08lx\n",
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c linux-libre-3.18.57-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
--- linux-libre-3.18.56-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/net/ethernet/mellanox/mlx5/core/cmd.c	2017-06-14 06:54:45.000000000 -0400
@@ -30,7 +30,7 @@
  * SOFTWARE.
  */
 
-#include <asm-generic/kmap_types.h>
+#include <linux/highmem.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/pci.h>
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-libre-3.18.57-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c
--- linux-libre-3.18.56-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/net/ethernet/mellanox/mlx5/core/main.c	2017-06-14 06:54:45.000000000 -0400
@@ -30,7 +30,7 @@
  * SOFTWARE.
  */
 
-#include <asm-generic/kmap_types.h>
+#include <linux/highmem.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/errno.h>
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c linux-libre-3.18.57-gnu/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
--- linux-libre-3.18.56-gnu/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c	2017-06-14 06:54:45.000000000 -0400
@@ -30,7 +30,7 @@
  * SOFTWARE.
  */
 
-#include <asm-generic/kmap_types.h>
+#include <linux/highmem.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mlx5/driver.h>
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/scsi/qla2xxx/qla_os.c linux-libre-3.18.57-gnu/drivers/scsi/qla2xxx/qla_os.c
--- linux-libre-3.18.56-gnu/drivers/scsi/qla2xxx/qla_os.c	2017-06-07 12:15:55.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/scsi/qla2xxx/qla_os.c	2017-06-14 14:39:23.000000000 -0400
@@ -2387,10 +2387,10 @@ qla2x00_probe_one(struct pci_dev *pdev,
 
 	if (mem_only) {
 		if (pci_enable_device_mem(pdev))
-			goto probe_out;
+			return ret;
 	} else {
 		if (pci_enable_device(pdev))
-			goto probe_out;
+			return ret;
 	}
 
 	/* This may fail but that's ok */
@@ -2400,7 +2400,7 @@ qla2x00_probe_one(struct pci_dev *pdev,
 	if (!ha) {
 		ql_log_pci(ql_log_fatal, pdev, 0x0009,
 		    "Unable to allocate memory for ha.\n");
-		goto probe_out;
+		goto disable_device;
 	}
 	ql_dbg_pci(ql_dbg_init, pdev, 0x000a,
 	    "Memory allocated for ha=%p.\n", ha);
@@ -2998,7 +2998,7 @@ iospace_config_failed:
 	kfree(ha);
 	ha = NULL;
 
-probe_out:
+disable_device:
 	pci_disable_device(pdev);
 	return ret;
 }
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/staging/lustre/lustre/lov/lov_pack.c linux-libre-3.18.57-gnu/drivers/staging/lustre/lustre/lov/lov_pack.c
--- linux-libre-3.18.56-gnu/drivers/staging/lustre/lustre/lov/lov_pack.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/staging/lustre/lustre/lov/lov_pack.c	2017-06-14 06:54:45.000000000 -0400
@@ -420,18 +420,10 @@ int lov_getstripe(struct obd_export *exp
 	struct lov_mds_md *lmmk = NULL;
 	int rc, lmm_size;
 	int lum_size;
-	mm_segment_t seg;
 
 	if (!lsm)
 		return -ENODATA;
 
-	/*
-	 * "Switch to kernel segment" to allow copying from kernel space by
-	 * copy_{to,from}_user().
-	 */
-	seg = get_fs();
-	set_fs(KERNEL_DS);
-
 	/* we only need the header part from user space to get lmm_magic and
 	 * lmm_stripe_count, (the header part is common to v1 and v3) */
 	lum_size = sizeof(struct lov_user_md_v1);
@@ -507,6 +499,5 @@ int lov_getstripe(struct obd_export *exp
 
 	obd_free_diskmd(exp, &lmmk);
 out_set:
-	set_fs(seg);
 	return rc;
 }
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/tty/serial/ifx6x60.c linux-libre-3.18.57-gnu/drivers/tty/serial/ifx6x60.c
--- linux-libre-3.18.56-gnu/drivers/tty/serial/ifx6x60.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/tty/serial/ifx6x60.c	2017-06-14 06:54:45.000000000 -0400
@@ -1379,9 +1379,9 @@ static struct spi_driver ifx_spi_driver
 static void __exit ifx_spi_exit(void)
 {
 	/* unregister */
+	spi_unregister_driver((void *)&ifx_spi_driver);
 	tty_unregister_driver(tty_drv);
 	put_tty_driver(tty_drv);
-	spi_unregister_driver((void *)&ifx_spi_driver);
 	unregister_reboot_notifier(&ifx_modem_reboot_notifier_block);
 }
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/tty/serial/sh-sci.c linux-libre-3.18.57-gnu/drivers/tty/serial/sh-sci.c
--- linux-libre-3.18.56-gnu/drivers/tty/serial/sh-sci.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/tty/serial/sh-sci.c	2017-06-14 06:54:45.000000000 -0400
@@ -1734,11 +1734,13 @@ static int sci_startup(struct uart_port
 
 	dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);
 
+	sci_request_dma(port);
+
 	ret = sci_request_irq(s);
-	if (unlikely(ret < 0))
+	if (unlikely(ret < 0)) {
+		sci_free_dma(port);
 		return ret;
-
-	sci_request_dma(port);
+	}
 
 	spin_lock_irqsave(&port->lock, flags);
 	sci_start_tx(port);
@@ -1760,8 +1762,8 @@ static void sci_shutdown(struct uart_por
 	sci_stop_tx(port);
 	spin_unlock_irqrestore(&port->lock, flags);
 
-	sci_free_dma(port);
 	sci_free_irq(s);
+	sci_free_dma(port);
 }
 
 static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps,
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/usb/chipidea/debug.c linux-libre-3.18.57-gnu/drivers/usb/chipidea/debug.c
--- linux-libre-3.18.56-gnu/drivers/usb/chipidea/debug.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/usb/chipidea/debug.c	2017-06-14 06:54:45.000000000 -0400
@@ -290,7 +290,8 @@ static int ci_role_show(struct seq_file
 {
 	struct ci_hdrc *ci = s->private;
 
-	seq_printf(s, "%s\n", ci_role(ci)->name);
+	if (ci->role != CI_ROLE_END)
+		seq_printf(s, "%s\n", ci_role(ci)->name);
 
 	return 0;
 }
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/usb/chipidea/udc.c linux-libre-3.18.57-gnu/drivers/usb/chipidea/udc.c
--- linux-libre-3.18.56-gnu/drivers/usb/chipidea/udc.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/usb/chipidea/udc.c	2017-06-14 06:54:45.000000000 -0400
@@ -1892,6 +1892,7 @@ static void udc_id_switch_for_host(struc
 int ci_hdrc_gadget_init(struct ci_hdrc *ci)
 {
 	struct ci_role_driver *rdrv;
+	int ret;
 
 	if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC))
 		return -ENXIO;
@@ -1904,7 +1905,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *
 	rdrv->stop	= udc_id_switch_for_host;
 	rdrv->irq	= udc_irq;
 	rdrv->name	= "gadget";
-	ci->roles[CI_ROLE_GADGET] = rdrv;
 
-	return udc_start(ci);
+	ret = udc_start(ci);
+	if (!ret)
+		ci->roles[CI_ROLE_GADGET] = rdrv;
+
+	return ret;
 }
diff -druNp --no-dereference linux-libre-3.18.56-gnu/drivers/usb/gadget/function/f_mass_storage.c linux-libre-3.18.57-gnu/drivers/usb/gadget/function/f_mass_storage.c
--- linux-libre-3.18.56-gnu/drivers/usb/gadget/function/f_mass_storage.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/drivers/usb/gadget/function/f_mass_storage.c	2017-06-14 06:54:45.000000000 -0400
@@ -400,7 +400,11 @@ static int fsg_set_halt(struct fsg_dev *
 /* Caller must hold fsg->lock */
 static void wakeup_thread(struct fsg_common *common)
 {
-	smp_wmb();	/* ensure the write of bh->state is complete */
+	/*
+	 * Ensure the reading of thread_wakeup_needed
+	 * and the writing of bh->state are completed
+	 */
+	smp_mb();
 	/* Tell the main thread that something has happened */
 	common->thread_wakeup_needed = 1;
 	if (common->thread_task)
@@ -621,7 +625,12 @@ static int sleep_thread(struct fsg_commo
 	}
 	__set_current_state(TASK_RUNNING);
 	common->thread_wakeup_needed = 0;
-	smp_rmb();	/* ensure the latest bh->state is visible */
+
+	/*
+	 * Ensure the writing of thread_wakeup_needed
+	 * and the reading of bh->state are completed
+	 */
+	smp_mb();
 	return rc;
 }
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/fs/btrfs/extent-tree.c linux-libre-3.18.57-gnu/fs/btrfs/extent-tree.c
--- linux-libre-3.18.56-gnu/fs/btrfs/extent-tree.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/fs/btrfs/extent-tree.c	2017-06-14 06:54:45.000000000 -0400
@@ -3509,6 +3509,7 @@ static int update_space_info(struct btrf
 				    info->space_info_kobj, "%s",
 				    alloc_name(found->flags));
 	if (ret) {
+		percpu_counter_destroy(&found->total_bytes_pinned);
 		kfree(found);
 		return ret;
 	}
diff -druNp --no-dereference linux-libre-3.18.56-gnu/fs/btrfs/inode.c linux-libre-3.18.57-gnu/fs/btrfs/inode.c
--- linux-libre-3.18.56-gnu/fs/btrfs/inode.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/fs/btrfs/inode.c	2017-06-14 06:54:45.000000000 -0400
@@ -6920,8 +6920,8 @@ bool btrfs_page_exists_in_range(struct i
 	int found = false;
 	void **pagep = NULL;
 	struct page *page = NULL;
-	int start_idx;
-	int end_idx;
+	unsigned long start_idx;
+	unsigned long end_idx;
 
 	start_idx = start >> PAGE_CACHE_SHIFT;
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/fs/ext4/file.c linux-libre-3.18.57-gnu/fs/ext4/file.c
--- linux-libre-3.18.56-gnu/fs/ext4/file.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/fs/ext4/file.c	2017-06-14 06:54:45.000000000 -0400
@@ -303,47 +303,27 @@ static int ext4_find_unwritten_pgoff(str
 		num = min_t(pgoff_t, end - index, PAGEVEC_SIZE);
 		nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
 					  (pgoff_t)num);
-		if (nr_pages == 0) {
-			if (whence == SEEK_DATA)
-				break;
-
-			BUG_ON(whence != SEEK_HOLE);
-			/*
-			 * If this is the first time to go into the loop and
-			 * offset is not beyond the end offset, it will be a
-			 * hole at this offset
-			 */
-			if (lastoff == startoff || lastoff < endoff)
-				found = 1;
-			break;
-		}
-
-		/*
-		 * If this is the first time to go into the loop and
-		 * offset is smaller than the first page offset, it will be a
-		 * hole at this offset.
-		 */
-		if (lastoff == startoff && whence == SEEK_HOLE &&
-		    lastoff < page_offset(pvec.pages[0])) {
-			found = 1;
+		if (nr_pages == 0)
 			break;
-		}
 
 		for (i = 0; i < nr_pages; i++) {
 			struct page *page = pvec.pages[i];
 			struct buffer_head *bh, *head;
 
 			/*
-			 * If the current offset is not beyond the end of given
-			 * range, it will be a hole.
+			 * If current offset is smaller than the page offset,
+			 * there is a hole at this offset.
 			 */
-			if (lastoff < endoff && whence == SEEK_HOLE &&
-			    page->index > end) {
+			if (whence == SEEK_HOLE && lastoff < endoff &&
+			    lastoff < page_offset(pvec.pages[i])) {
 				found = 1;
 				*offset = lastoff;
 				goto out;
 			}
 
+			if (page->index > end)
+				goto out;
+
 			lock_page(page);
 
 			if (unlikely(page->mapping != inode->i_mapping)) {
@@ -383,20 +363,18 @@ static int ext4_find_unwritten_pgoff(str
 			unlock_page(page);
 		}
 
-		/*
-		 * The no. of pages is less than our desired, that would be a
-		 * hole in there.
-		 */
-		if (nr_pages < num && whence == SEEK_HOLE) {
-			found = 1;
-			*offset = lastoff;
+		/* The no. of pages is less than our desired, we are done. */
+		if (nr_pages < num)
 			break;
-		}
 
 		index = pvec.pages[i - 1]->index + 1;
 		pagevec_release(&pvec);
 	} while (index <= end);
 
+	if (whence == SEEK_HOLE && lastoff < endoff) {
+		found = 1;
+		*offset = lastoff;
+	}
 out:
 	pagevec_release(&pvec);
 	return found;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/fs/ext4/inode.c linux-libre-3.18.57-gnu/fs/ext4/inode.c
--- linux-libre-3.18.56-gnu/fs/ext4/inode.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/fs/ext4/inode.c	2017-06-14 06:54:45.000000000 -0400
@@ -4830,8 +4830,9 @@ static int ext4_expand_extra_isize(struc
 	/* No extended attributes present */
 	if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) ||
 	    header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) {
-		memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0,
-			new_extra_isize);
+		memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +
+		       EXT4_I(inode)->i_extra_isize, 0,
+		       new_extra_isize - EXT4_I(inode)->i_extra_isize);
 		EXT4_I(inode)->i_extra_isize = new_extra_isize;
 		return 0;
 	}
diff -druNp --no-dereference linux-libre-3.18.56-gnu/fs/nfsd/nfs4proc.c linux-libre-3.18.57-gnu/fs/nfsd/nfs4proc.c
--- linux-libre-3.18.56-gnu/fs/nfsd/nfs4proc.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/fs/nfsd/nfs4proc.c	2017-06-14 06:54:45.000000000 -0400
@@ -1405,6 +1405,12 @@ nfsd4_proc_compound(struct svc_rqst *rqs
 			opdesc->op_get_currentstateid(cstate, &op->u);
 		op->status = opdesc->op_func(rqstp, cstate, &op->u);
 
+		/* Only from SEQUENCE */
+		if (cstate->status == nfserr_replay_cache) {
+			dprintk("%s NFS4.1 replay from cache\n", __func__);
+			status = op->status;
+			goto out;
+		}
 		if (!op->status) {
 			if (opdesc->op_set_currentstateid)
 				opdesc->op_set_currentstateid(cstate, &op->u);
@@ -1415,14 +1421,7 @@ nfsd4_proc_compound(struct svc_rqst *rqs
 			if (need_wrongsec_check(rqstp))
 				op->status = check_nfsd_access(current_fh->fh_export, rqstp);
 		}
-
 encode_op:
-		/* Only from SEQUENCE */
-		if (cstate->status == nfserr_replay_cache) {
-			dprintk("%s NFS4.1 replay from cache\n", __func__);
-			status = op->status;
-			goto out;
-		}
 		if (op->status == nfserr_replay_me) {
 			op->replay = &cstate->replay_owner->so_replay;
 			nfsd4_encode_replay(&resp->xdr, op);
diff -druNp --no-dereference linux-libre-3.18.56-gnu/include/linux/bitops.h linux-libre-3.18.57-gnu/include/linux/bitops.h
--- linux-libre-3.18.56-gnu/include/linux/bitops.h	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/include/linux/bitops.h	2017-06-14 06:54:45.000000000 -0400
@@ -171,6 +171,17 @@ static inline __s32 sign_extend32(__u32
 	return (__s32)(value << shift) >> shift;
 }
 
+/**
+ * sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit
+ * @value: value to sign extend
+ * @index: 0 based bit index (0<=index<64) to sign bit
+ */
+static inline __s64 sign_extend64(__u64 value, int index)
+{
+	__u8 shift = 63 - index;
+	return (__s64)(value << shift) >> shift;
+}
+
 static inline unsigned fls_long(unsigned long l)
 {
 	if (sizeof(l) == 4)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/include/linux/random.h linux-libre-3.18.57-gnu/include/linux/random.h
--- linux-libre-3.18.56-gnu/include/linux/random.h	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/include/linux/random.h	2017-06-14 06:54:45.000000000 -0400
@@ -23,6 +23,7 @@ extern const struct file_operations rand
 #endif
 
 unsigned int get_random_int(void);
+unsigned long get_random_long(void);
 unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
 
 u32 prandom_u32(void);
diff -druNp --no-dereference linux-libre-3.18.56-gnu/include/net/ipv6.h linux-libre-3.18.57-gnu/include/net/ipv6.h
--- linux-libre-3.18.56-gnu/include/net/ipv6.h	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/include/net/ipv6.h	2017-06-14 06:54:45.000000000 -0400
@@ -898,6 +898,7 @@ int inet6_hash_connect(struct inet_timew
  */
 extern const struct proto_ops inet6_stream_ops;
 extern const struct proto_ops inet6_dgram_ops;
+extern const struct proto_ops inet6_sockraw_ops;
 
 struct group_source_req;
 struct group_filter;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/kernel/events/core.c linux-libre-3.18.57-gnu/kernel/events/core.c
--- linux-libre-3.18.56-gnu/kernel/events/core.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/kernel/events/core.c	2017-06-14 06:54:45.000000000 -0400
@@ -5761,6 +5761,21 @@ static void perf_log_throttle(struct per
 	perf_output_end(&handle);
 }
 
+static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs)
+{
+	/*
+	 * Due to interrupt latency (AKA "skid"), we may enter the
+	 * kernel before taking an overflow, even if the PMU is only
+	 * counting user events.
+	 * To avoid leaking information to userspace, we must always
+	 * reject kernel samples when exclude_kernel is set.
+	 */
+	if (event->attr.exclude_kernel && !user_mode(regs))
+		return false;
+
+	return true;
+}
+
 /*
  * Generic event overflow handling, sampling.
  */
@@ -5808,6 +5823,12 @@ static int __perf_event_overflow(struct
 	}
 
 	/*
+	 * For security, drop the skid kernel samples if necessary.
+	 */
+	if (!sample_is_allowed(event, regs))
+		return ret;
+
+	/*
 	 * XXX event_limit might not quite work as expected on inherited
 	 * events
 	 */
diff -druNp --no-dereference linux-libre-3.18.56-gnu/kernel/fork.c linux-libre-3.18.57-gnu/kernel/fork.c
--- linux-libre-3.18.56-gnu/kernel/fork.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/kernel/fork.c	2017-06-14 06:54:45.000000000 -0400
@@ -338,7 +338,7 @@ static struct task_struct *dup_task_stru
 	set_task_stack_end_magic(tsk);
 
 #ifdef CONFIG_CC_STACKPROTECTOR
-	tsk->stack_canary = get_random_int();
+	tsk->stack_canary = get_random_long();
 #endif
 
 	/*
diff -druNp --no-dereference linux-libre-3.18.56-gnu/lib/test_user_copy.c linux-libre-3.18.57-gnu/lib/test_user_copy.c
--- linux-libre-3.18.56-gnu/lib/test_user_copy.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/lib/test_user_copy.c	2017-06-14 06:54:45.000000000 -0400
@@ -58,7 +58,9 @@ static int __init test_user_copy_init(vo
 	usermem = (char __user *)user_addr;
 	bad_usermem = (char *)user_addr;
 
-	/* Legitimate usage: none of these should fail. */
+	/*
+	 * Legitimate usage: none of these copies should fail.
+	 */
 	ret |= test(copy_from_user(kmem, usermem, PAGE_SIZE),
 		    "legitimate copy_from_user failed");
 	ret |= test(copy_to_user(usermem, kmem, PAGE_SIZE),
@@ -68,19 +70,33 @@ static int __init test_user_copy_init(vo
 	ret |= test(put_user(value, (unsigned long __user *)usermem),
 		    "legitimate put_user failed");
 
-	/* Invalid usage: none of these should succeed. */
+	/*
+	 * Invalid usage: none of these copies should succeed.
+	 */
+
+	/* Reject kernel-to-kernel copies through copy_from_user(). */
 	ret |= test(!copy_from_user(kmem, (char __user *)(kmem + PAGE_SIZE),
 				    PAGE_SIZE),
 		    "illegal all-kernel copy_from_user passed");
+
+#if 0
+	/*
+	 * When running with SMAP/PAN/etc, this will Oops the kernel
+	 * due to the zeroing of userspace memory on failure. This needs
+	 * to be tested in LKDTM instead, since this test module does not
+	 * expect to explode.
+	 */
 	ret |= test(!copy_from_user(bad_usermem, (char __user *)kmem,
 				    PAGE_SIZE),
 		    "illegal reversed copy_from_user passed");
+#endif
 	ret |= test(!copy_to_user((char __user *)kmem, kmem + PAGE_SIZE,
 				  PAGE_SIZE),
 		    "illegal all-kernel copy_to_user passed");
 	ret |= test(!copy_to_user((char __user *)kmem, bad_usermem,
 				  PAGE_SIZE),
 		    "illegal reversed copy_to_user passed");
+
 	ret |= test(!get_user(value, (unsigned long __user *)kmem),
 		    "illegal get_user passed");
 	ret |= test(!put_user(value, (unsigned long __user *)kmem),
diff -druNp --no-dereference linux-libre-3.18.56-gnu/Makefile linux-libre-3.18.57-gnu/Makefile
--- linux-libre-3.18.56-gnu/Makefile	2017-06-07 11:41:50.000000000 -0400
+++ linux-libre-3.18.57-gnu/Makefile	2017-06-14 14:03:57.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 18
-SUBLEVEL = 56
+SUBLEVEL = 57
 EXTRAVERSION =-gnu
 NAME = Diseased Newt
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv4/af_inet.c linux-libre-3.18.57-gnu/net/ipv4/af_inet.c
--- linux-libre-3.18.56-gnu/net/ipv4/af_inet.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv4/af_inet.c	2017-06-14 06:54:45.000000000 -0400
@@ -1016,7 +1016,7 @@ static struct inet_protosw inetsw_array[
 		.type =       SOCK_DGRAM,
 		.protocol =   IPPROTO_ICMP,
 		.prot =       &ping_prot,
-		.ops =        &inet_dgram_ops,
+		.ops =        &inet_sockraw_ops,
 		.flags =      INET_PROTOSW_REUSE,
        },
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv4/tcp_cong.c linux-libre-3.18.57-gnu/net/ipv4/tcp_cong.c
--- linux-libre-3.18.56-gnu/net/ipv4/tcp_cong.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv4/tcp_cong.c	2017-06-14 06:54:45.000000000 -0400
@@ -103,6 +103,7 @@ void tcp_init_congestion_control(struct
 {
 	const struct inet_connection_sock *icsk = inet_csk(sk);
 
+	tcp_sk(sk)->prior_ssthresh = 0;
 	if (icsk->icsk_ca_ops->init)
 		icsk->icsk_ca_ops->init(sk);
 }
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv6/ip6_offload.c linux-libre-3.18.57-gnu/net/ipv6/ip6_offload.c
--- linux-libre-3.18.56-gnu/net/ipv6/ip6_offload.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv6/ip6_offload.c	2017-06-14 06:54:45.000000000 -0400
@@ -121,8 +121,10 @@ static struct sk_buff *ipv6_gso_segment(
 
 		if (udpfrag) {
 			int err = ip6_find_1stfragopt(skb, &prevhdr);
-			if (err < 0)
+			if (err < 0) {
+				kfree_skb_list(segs);
 				return ERR_PTR(err);
+			}
 			fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
 			fptr->frag_off = htons(offset);
 			if (skb->next != NULL)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv6/ping.c linux-libre-3.18.57-gnu/net/ipv6/ping.c
--- linux-libre-3.18.56-gnu/net/ipv6/ping.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv6/ping.c	2017-06-14 06:54:45.000000000 -0400
@@ -50,7 +50,7 @@ static struct inet_protosw pingv6_protos
 	.type =      SOCK_DGRAM,
 	.protocol =  IPPROTO_ICMPV6,
 	.prot =      &pingv6_prot,
-	.ops =       &inet6_dgram_ops,
+	.ops =       &inet6_sockraw_ops,
 	.flags =     INET_PROTOSW_REUSE,
 };
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv6/raw.c linux-libre-3.18.57-gnu/net/ipv6/raw.c
--- linux-libre-3.18.56-gnu/net/ipv6/raw.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv6/raw.c	2017-06-14 06:54:45.000000000 -0400
@@ -1296,7 +1296,7 @@ void raw6_proc_exit(void)
 #endif	/* CONFIG_PROC_FS */
 
 /* Same as inet6_dgram_ops, sans udp_poll.  */
-static const struct proto_ops inet6_sockraw_ops = {
+const struct proto_ops inet6_sockraw_ops = {
 	.family		   = PF_INET6,
 	.owner		   = THIS_MODULE,
 	.release	   = inet6_release,
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv6/xfrm6_mode_ro.c linux-libre-3.18.57-gnu/net/ipv6/xfrm6_mode_ro.c
--- linux-libre-3.18.56-gnu/net/ipv6/xfrm6_mode_ro.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv6/xfrm6_mode_ro.c	2017-06-14 06:54:45.000000000 -0400
@@ -47,6 +47,8 @@ static int xfrm6_ro_output(struct xfrm_s
 	iph = ipv6_hdr(skb);
 
 	hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
+	if (hdr_len < 0)
+		return hdr_len;
 	skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
 	skb_set_network_header(skb, -x->props.header_len);
 	skb->transport_header = skb->network_header + hdr_len;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/net/ipv6/xfrm6_mode_transport.c linux-libre-3.18.57-gnu/net/ipv6/xfrm6_mode_transport.c
--- linux-libre-3.18.56-gnu/net/ipv6/xfrm6_mode_transport.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/net/ipv6/xfrm6_mode_transport.c	2017-06-14 06:54:45.000000000 -0400
@@ -28,6 +28,8 @@ static int xfrm6_transport_output(struct
 	iph = ipv6_hdr(skb);
 
 	hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
+	if (hdr_len < 0)
+		return hdr_len;
 	skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
 	skb_set_network_header(skb, -x->props.header_len);
 	skb->transport_header = skb->network_header + hdr_len;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/security/keys/key.c linux-libre-3.18.57-gnu/security/keys/key.c
--- linux-libre-3.18.56-gnu/security/keys/key.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/security/keys/key.c	2017-06-14 06:54:45.000000000 -0400
@@ -936,12 +936,11 @@ int key_update(key_ref_t key_ref, const
 	/* the key must be writable */
 	ret = key_permission(key_ref, KEY_NEED_WRITE);
 	if (ret < 0)
-		goto error;
+		return ret;
 
 	/* attempt to update it if supported */
-	ret = -EOPNOTSUPP;
 	if (!key->type->update)
-		goto error;
+		return -EOPNOTSUPP;
 
 	memset(&prep, 0, sizeof(prep));
 	prep.data = payload;
diff -druNp --no-dereference linux-libre-3.18.56-gnu/security/keys/keyctl.c linux-libre-3.18.57-gnu/security/keys/keyctl.c
--- linux-libre-3.18.56-gnu/security/keys/keyctl.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/security/keys/keyctl.c	2017-06-14 06:54:45.000000000 -0400
@@ -99,7 +99,7 @@ SYSCALL_DEFINE5(add_key, const char __us
 	payload = NULL;
 
 	vm = false;
-	if (_payload) {
+	if (plen) {
 		ret = -ENOMEM;
 		payload = kmalloc(plen, GFP_KERNEL | __GFP_NOWARN);
 		if (!payload) {
@@ -333,7 +333,7 @@ long keyctl_update_key(key_serial_t id,
 
 	/* pull the payload in if one was supplied */
 	payload = NULL;
-	if (_payload) {
+	if (plen) {
 		ret = -ENOMEM;
 		payload = kmalloc(plen, GFP_KERNEL);
 		if (!payload)
diff -druNp --no-dereference linux-libre-3.18.56-gnu/sound/core/timer.c linux-libre-3.18.57-gnu/sound/core/timer.c
--- linux-libre-3.18.56-gnu/sound/core/timer.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/sound/core/timer.c	2017-06-14 06:54:45.000000000 -0400
@@ -1620,6 +1620,7 @@ static int snd_timer_user_tselect(struct
 	if (err < 0)
 		goto __err;
 
+	tu->qhead = tu->qtail = tu->qused = 0;
 	kfree(tu->queue);
 	tu->queue = NULL;
 	kfree(tu->tqueue);
@@ -1948,6 +1949,7 @@ static ssize_t snd_timer_user_read(struc
 
 	tu = file->private_data;
 	unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read);
+	mutex_lock(&tu->ioctl_lock);
 	spin_lock_irq(&tu->qlock);
 	while ((long)count - result >= unit) {
 		while (!tu->qused) {
@@ -1963,7 +1965,9 @@ static ssize_t snd_timer_user_read(struc
 			add_wait_queue(&tu->qchange_sleep, &wait);
 
 			spin_unlock_irq(&tu->qlock);
+			mutex_unlock(&tu->ioctl_lock);
 			schedule();
+			mutex_lock(&tu->ioctl_lock);
 			spin_lock_irq(&tu->qlock);
 
 			remove_wait_queue(&tu->qchange_sleep, &wait);
@@ -2001,6 +2005,7 @@ static ssize_t snd_timer_user_read(struc
 	}
  _error:
 	spin_unlock_irq(&tu->qlock);
+	mutex_unlock(&tu->ioctl_lock);
 	return result > 0 ? result : err;
 }
 
diff -druNp --no-dereference linux-libre-3.18.56-gnu/sound/soc/soc-core.c linux-libre-3.18.57-gnu/sound/soc/soc-core.c
--- linux-libre-3.18.56-gnu/sound/soc/soc-core.c	2017-06-07 06:03:17.000000000 -0400
+++ linux-libre-3.18.57-gnu/sound/soc/soc-core.c	2017-06-14 06:54:45.000000000 -0400
@@ -1868,6 +1868,9 @@ static int soc_cleanup_card_resources(st
 	for (i = 0; i < card->num_aux_devs; i++)
 		soc_remove_aux_dev(card, i);
 
+	/* free the ALSA card at first; this syncs with pending operations */
+	snd_card_free(card->snd_card);
+
 	/* remove and free each DAI */
 	soc_remove_dai_links(card);
 
@@ -1879,9 +1882,7 @@ static int soc_cleanup_card_resources(st
 
 	snd_soc_dapm_free(&card->dapm);
 
-	snd_card_free(card->snd_card);
 	return 0;
-
 }
 
 /* removes a socdev */
