diff -druNp --no-dereference linux-libre-4.9.47-gnu/arch/alpha/include/asm/types.h linux-libre-4.9.48-gnu/arch/alpha/include/asm/types.h
--- linux-libre-4.9.47-gnu/arch/alpha/include/asm/types.h	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/arch/alpha/include/asm/types.h	2017-09-07 02:35:53.000000000 -0400
@@ -1,6 +1,6 @@
 #ifndef _ALPHA_TYPES_H
 #define _ALPHA_TYPES_H
 
-#include <asm-generic/int-ll64.h>
+#include <uapi/asm/types.h>
 
 #endif /* _ALPHA_TYPES_H */
diff -druNp --no-dereference linux-libre-4.9.47-gnu/arch/alpha/include/uapi/asm/types.h linux-libre-4.9.48-gnu/arch/alpha/include/uapi/asm/types.h
--- linux-libre-4.9.47-gnu/arch/alpha/include/uapi/asm/types.h	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/arch/alpha/include/uapi/asm/types.h	2017-09-07 02:35:53.000000000 -0400
@@ -9,8 +9,18 @@
  * need to be careful to avoid a name clashes.
  */
 
-#ifndef __KERNEL__
+/*
+ * This is here because we used to use l64 for alpha
+ * and we don't want to impact user mode with our change to ll64
+ * in the kernel.
+ *
+ * However, some user programs are fine with this.  They can
+ * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
+ */
+#if !defined(__SANE_USERSPACE_TYPES__) && !defined(__KERNEL__)
 #include <asm-generic/int-l64.h>
+#else
+#include <asm-generic/int-ll64.h>
 #endif
 
 #endif /* _UAPI_ALPHA_TYPES_H */
diff -druNp --no-dereference linux-libre-4.9.47-gnu/arch/arm/kvm/mmu.c linux-libre-4.9.48-gnu/arch/arm/kvm/mmu.c
--- linux-libre-4.9.47-gnu/arch/arm/kvm/mmu.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/arch/arm/kvm/mmu.c	2017-09-07 02:35:53.000000000 -0400
@@ -837,7 +837,7 @@ void kvm_free_stage2_pgd(struct kvm *kvm
 	spin_lock(&kvm->mmu_lock);
 	if (kvm->arch.pgd) {
 		unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
-		pgd = kvm->arch.pgd;
+		pgd = READ_ONCE(kvm->arch.pgd);
 		kvm->arch.pgd = NULL;
 	}
 	spin_unlock(&kvm->mmu_lock);
diff -druNp --no-dereference linux-libre-4.9.47-gnu/crypto/algif_skcipher.c linux-libre-4.9.48-gnu/crypto/algif_skcipher.c
--- linux-libre-4.9.47-gnu/crypto/algif_skcipher.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/crypto/algif_skcipher.c	2017-09-07 02:35:53.000000000 -0400
@@ -86,8 +86,13 @@ static void skcipher_free_async_sgls(str
 	}
 	sgl = sreq->tsg;
 	n = sg_nents(sgl);
-	for_each_sg(sgl, sg, n, i)
-		put_page(sg_page(sg));
+	for_each_sg(sgl, sg, n, i) {
+		struct page *page = sg_page(sg);
+
+		/* some SGs may not have a page mapped */
+		if (page && page_ref_count(page))
+			put_page(page);
+	}
 
 	kfree(sreq->tsg);
 }
diff -druNp --no-dereference linux-libre-4.9.47-gnu/drivers/gpu/drm/ttm/ttm_page_alloc.c linux-libre-4.9.48-gnu/drivers/gpu/drm/ttm/ttm_page_alloc.c
--- linux-libre-4.9.47-gnu/drivers/gpu/drm/ttm/ttm_page_alloc.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/drivers/gpu/drm/ttm/ttm_page_alloc.c	2017-09-07 02:35:53.000000000 -0400
@@ -612,7 +612,7 @@ static void ttm_page_pool_fill_locked(st
 		} else {
 			pr_err("Failed to fill pool (%p)\n", pool);
 			/* If we have any pages left put them to the pool. */
-			list_for_each_entry(p, &pool->list, lru) {
+			list_for_each_entry(p, &new_pages, lru) {
 				++cpages;
 			}
 			list_splice(&new_pages, &pool->list);
diff -druNp --no-dereference linux-libre-4.9.47-gnu/drivers/i2c/busses/i2c-ismt.c linux-libre-4.9.48-gnu/drivers/i2c/busses/i2c-ismt.c
--- linux-libre-4.9.47-gnu/drivers/i2c/busses/i2c-ismt.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/drivers/i2c/busses/i2c-ismt.c	2017-09-07 02:35:53.000000000 -0400
@@ -341,8 +341,10 @@ static int ismt_process_desc(const struc
 			break;
 		case I2C_SMBUS_BLOCK_DATA:
 		case I2C_SMBUS_I2C_BLOCK_DATA:
-			memcpy(&data->block[1], dma_buffer, desc->rxbytes);
-			data->block[0] = desc->rxbytes;
+			if (desc->rxbytes != dma_buffer[0] + 1)
+				return -EMSGSIZE;
+
+			memcpy(data->block, dma_buffer, desc->rxbytes);
 			break;
 		}
 		return 0;
diff -druNp --no-dereference linux-libre-4.9.47-gnu/drivers/irqchip/irq-mips-gic.c linux-libre-4.9.48-gnu/drivers/irqchip/irq-mips-gic.c
--- linux-libre-4.9.47-gnu/drivers/irqchip/irq-mips-gic.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/drivers/irqchip/irq-mips-gic.c	2017-09-07 02:35:53.000000000 -0400
@@ -1115,8 +1115,11 @@ static int __init gic_of_init(struct dev
 		gic_len = resource_size(&res);
 	}
 
-	if (mips_cm_present())
+	if (mips_cm_present()) {
 		write_gcr_gic_base(gic_base | CM_GCR_GIC_BASE_GICEN_MSK);
+		/* Ensure GIC region is enabled before trying to access it */
+		__sync();
+	}
 	gic_present = true;
 
 	__gic_init(gic_base, gic_len, cpu_vec, 0, node);
diff -druNp --no-dereference linux-libre-4.9.47-gnu/drivers/net/wireless/ti/wl1251/main.c linux-libre-4.9.48-gnu/drivers/net/wireless/ti/wl1251/main.c
--- linux-libre-4.9.47-gnu/drivers/net/wireless/ti/wl1251/main.c	2017-09-02 07:55:18.000000000 -0400
+++ linux-libre-4.9.48-gnu/drivers/net/wireless/ti/wl1251/main.c	2017-09-07 06:18:33.000000000 -0400
@@ -1571,6 +1571,7 @@ struct ieee80211_hw *wl1251_alloc_hw(voi
 
 	wl->state = WL1251_STATE_OFF;
 	mutex_init(&wl->mutex);
+	spin_lock_init(&wl->wl_lock);
 
 	wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE;
 	wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE;
diff -druNp --no-dereference linux-libre-4.9.47-gnu/fs/ceph/addr.c linux-libre-4.9.48-gnu/fs/ceph/addr.c
--- linux-libre-4.9.47-gnu/fs/ceph/addr.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/fs/ceph/addr.c	2017-09-07 02:35:53.000000000 -0400
@@ -188,7 +188,7 @@ static int ceph_releasepage(struct page
 /*
  * read a single page, without unlocking it.
  */
-static int readpage_nounlock(struct file *filp, struct page *page)
+static int ceph_do_readpage(struct file *filp, struct page *page)
 {
 	struct inode *inode = file_inode(filp);
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -218,7 +218,7 @@ static int readpage_nounlock(struct file
 
 	err = ceph_readpage_from_fscache(inode, page);
 	if (err == 0)
-		goto out;
+		return -EINPROGRESS;
 
 	dout("readpage inode %p file %p page %p index %lu\n",
 	     inode, filp, page, page->index);
@@ -248,8 +248,11 @@ out:
 
 static int ceph_readpage(struct file *filp, struct page *page)
 {
-	int r = readpage_nounlock(filp, page);
-	unlock_page(page);
+	int r = ceph_do_readpage(filp, page);
+	if (r != -EINPROGRESS)
+		unlock_page(page);
+	else
+		r = 0;
 	return r;
 }
 
@@ -1235,7 +1238,7 @@ retry_locked:
 			goto retry_locked;
 		r = writepage_nounlock(page, NULL);
 		if (r < 0)
-			goto fail_nosnap;
+			goto fail_unlock;
 		goto retry_locked;
 	}
 
@@ -1263,11 +1266,14 @@ retry_locked:
 	}
 
 	/* we need to read it. */
-	r = readpage_nounlock(file, page);
-	if (r < 0)
-		goto fail_nosnap;
+	r = ceph_do_readpage(file, page);
+	if (r < 0) {
+		if (r == -EINPROGRESS)
+			return -EAGAIN;
+		goto fail_unlock;
+	}
 	goto retry_locked;
-fail_nosnap:
+fail_unlock:
 	unlock_page(page);
 	return r;
 }
diff -druNp --no-dereference linux-libre-4.9.47-gnu/fs/ceph/cache.c linux-libre-4.9.48-gnu/fs/ceph/cache.c
--- linux-libre-4.9.47-gnu/fs/ceph/cache.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/fs/ceph/cache.c	2017-09-07 02:35:53.000000000 -0400
@@ -240,13 +240,7 @@ void ceph_fscache_file_set_cookie(struct
 	}
 }
 
-static void ceph_vfs_readpage_complete(struct page *page, void *data, int error)
-{
-	if (!error)
-		SetPageUptodate(page);
-}
-
-static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int error)
+static void ceph_readpage_from_fscache_complete(struct page *page, void *data, int error)
 {
 	if (!error)
 		SetPageUptodate(page);
@@ -274,7 +268,7 @@ int ceph_readpage_from_fscache(struct in
 		return -ENOBUFS;
 
 	ret = fscache_read_or_alloc_page(ci->fscache, page,
-					 ceph_vfs_readpage_complete, NULL,
+					 ceph_readpage_from_fscache_complete, NULL,
 					 GFP_KERNEL);
 
 	switch (ret) {
@@ -303,7 +297,7 @@ int ceph_readpages_from_fscache(struct i
 		return -ENOBUFS;
 
 	ret = fscache_read_or_alloc_pages(ci->fscache, mapping, pages, nr_pages,
-					  ceph_vfs_readpage_complete_unlock,
+					  ceph_readpage_from_fscache_complete,
 					  NULL, mapping_gfp_mask(mapping));
 
 	switch (ret) {
diff -druNp --no-dereference linux-libre-4.9.47-gnu/fs/cifs/dir.c linux-libre-4.9.48-gnu/fs/cifs/dir.c
--- linux-libre-4.9.47-gnu/fs/cifs/dir.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/fs/cifs/dir.c	2017-09-07 02:35:53.000000000 -0400
@@ -194,7 +194,7 @@ check_name(struct dentry *direntry, stru
 	int i;
 
 	if (unlikely(direntry->d_name.len >
-		     tcon->fsAttrInfo.MaxPathNameComponentLength))
+		     le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength)))
 		return -ENAMETOOLONG;
 
 	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) {
diff -druNp --no-dereference linux-libre-4.9.47-gnu/fs/cifs/smb2pdu.h linux-libre-4.9.48-gnu/fs/cifs/smb2pdu.h
--- linux-libre-4.9.47-gnu/fs/cifs/smb2pdu.h	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/fs/cifs/smb2pdu.h	2017-09-07 02:35:53.000000000 -0400
@@ -84,8 +84,8 @@
 
 #define NUMBER_OF_SMB2_COMMANDS	0x0013
 
-/* BB FIXME - analyze following length BB */
-#define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
+/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */
+#define MAX_SMB2_HDR_SIZE 0x00b0
 
 #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe)
 #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)
diff -druNp --no-dereference linux-libre-4.9.47-gnu/fs/eventpoll.c linux-libre-4.9.48-gnu/fs/eventpoll.c
--- linux-libre-4.9.47-gnu/fs/eventpoll.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/fs/eventpoll.c	2017-09-07 02:35:53.000000000 -0400
@@ -523,8 +523,13 @@ static void ep_remove_wait_queue(struct
 	wait_queue_head_t *whead;
 
 	rcu_read_lock();
-	/* If it is cleared by POLLFREE, it should be rcu-safe */
-	whead = rcu_dereference(pwq->whead);
+	/*
+	 * If it is cleared by POLLFREE, it should be rcu-safe.
+	 * If we read NULL we need a barrier paired with
+	 * smp_store_release() in ep_poll_callback(), otherwise
+	 * we rely on whead->lock.
+	 */
+	whead = smp_load_acquire(&pwq->whead);
 	if (whead)
 		remove_wait_queue(whead, &pwq->wait);
 	rcu_read_unlock();
@@ -1009,17 +1014,6 @@ static int ep_poll_callback(wait_queue_t
 	struct eventpoll *ep = epi->ep;
 	int ewake = 0;
 
-	if ((unsigned long)key & POLLFREE) {
-		ep_pwq_from_wait(wait)->whead = NULL;
-		/*
-		 * whead = NULL above can race with ep_remove_wait_queue()
-		 * which can do another remove_wait_queue() after us, so we
-		 * can't use __remove_wait_queue(). whead->lock is held by
-		 * the caller.
-		 */
-		list_del_init(&wait->task_list);
-	}
-
 	spin_lock_irqsave(&ep->lock, flags);
 
 	/*
@@ -1101,10 +1095,26 @@ out_unlock:
 	if (pwake)
 		ep_poll_safewake(&ep->poll_wait);
 
-	if (epi->event.events & EPOLLEXCLUSIVE)
-		return ewake;
+	if (!(epi->event.events & EPOLLEXCLUSIVE))
+		ewake = 1;
 
-	return 1;
+	if ((unsigned long)key & POLLFREE) {
+		/*
+		 * If we race with ep_remove_wait_queue() it can miss
+		 * ->whead = NULL and do another remove_wait_queue() after
+		 * us, so we can't use __remove_wait_queue().
+		 */
+		list_del_init(&wait->task_list);
+		/*
+		 * ->whead != NULL protects us from the race with ep_free()
+		 * or ep_remove(), ep_remove_wait_queue() takes whead->lock
+		 * held by the caller. Once we nullify it, nothing protects
+		 * ep/epi or even wait.
+		 */
+		smp_store_release(&ep_pwq_from_wait(wait)->whead, NULL);
+	}
+
+	return ewake;
 }
 
 /*
diff -druNp --no-dereference linux-libre-4.9.47-gnu/include/asm-generic/topology.h linux-libre-4.9.48-gnu/include/asm-generic/topology.h
--- linux-libre-4.9.47-gnu/include/asm-generic/topology.h	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/include/asm-generic/topology.h	2017-09-07 02:35:53.000000000 -0400
@@ -48,7 +48,11 @@
 #define parent_node(node)	((void)(node),0)
 #endif
 #ifndef cpumask_of_node
-#define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #ifdef CONFIG_NEED_MULTIPLE_NODES
+    #define cpumask_of_node(node)	((node) == 0 ? cpu_online_mask : cpu_none_mask)
+  #else
+    #define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #endif
 #endif
 #ifndef pcibus_to_node
 #define pcibus_to_node(bus)	((void)(bus), -1)
diff -druNp --no-dereference linux-libre-4.9.47-gnu/kernel/cpuset.c linux-libre-4.9.48-gnu/kernel/cpuset.c
--- linux-libre-4.9.47-gnu/kernel/cpuset.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/kernel/cpuset.c	2017-09-07 02:35:53.000000000 -0400
@@ -1905,6 +1905,7 @@ static struct cftype files[] = {
 	{
 		.name = "memory_pressure",
 		.read_u64 = cpuset_read_u64,
+		.private = FILE_MEMORY_PRESSURE,
 	},
 
 	{
diff -druNp --no-dereference linux-libre-4.9.47-gnu/kernel/events/uprobes.c linux-libre-4.9.48-gnu/kernel/events/uprobes.c
--- linux-libre-4.9.47-gnu/kernel/events/uprobes.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/kernel/events/uprobes.c	2017-09-07 02:35:53.000000000 -0400
@@ -1254,8 +1254,6 @@ void uprobe_end_dup_mmap(void)
 
 void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
 {
-	newmm->uprobes_state.xol_area = NULL;
-
 	if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) {
 		set_bit(MMF_HAS_UPROBES, &newmm->flags);
 		/* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */
diff -druNp --no-dereference linux-libre-4.9.47-gnu/kernel/fork.c linux-libre-4.9.48-gnu/kernel/fork.c
--- linux-libre-4.9.47-gnu/kernel/fork.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/kernel/fork.c	2017-09-07 02:35:53.000000000 -0400
@@ -745,6 +745,13 @@ static void mm_init_owner(struct mm_stru
 #endif
 }
 
+static void mm_init_uprobes_state(struct mm_struct *mm)
+{
+#ifdef CONFIG_UPROBES
+	mm->uprobes_state.xol_area = NULL;
+#endif
+}
+
 static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
 	struct user_namespace *user_ns)
 {
@@ -772,6 +779,7 @@ static struct mm_struct *mm_init(struct
 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
 	mm->pmd_huge_pte = NULL;
 #endif
+	mm_init_uprobes_state(mm);
 
 	if (current->mm) {
 		mm->flags = current->mm->flags & MMF_INIT_MASK;
diff -druNp --no-dereference linux-libre-4.9.47-gnu/lib/mpi/mpicoder.c linux-libre-4.9.48-gnu/lib/mpi/mpicoder.c
--- linux-libre-4.9.47-gnu/lib/mpi/mpicoder.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/lib/mpi/mpicoder.c	2017-09-07 02:35:53.000000000 -0400
@@ -364,11 +364,11 @@ MPI mpi_read_raw_from_sgl(struct scatter
 	}
 
 	miter.consumed = lzeros;
-	sg_miter_stop(&miter);
 
 	nbytes -= lzeros;
 	nbits = nbytes * 8;
 	if (nbits > MAX_EXTERN_MPI_BITS) {
+		sg_miter_stop(&miter);
 		pr_info("MPI: mpi too large (%u bits)\n", nbits);
 		return NULL;
 	}
@@ -376,6 +376,8 @@ MPI mpi_read_raw_from_sgl(struct scatter
 	if (nbytes > 0)
 		nbits -= count_leading_zeros(*buff) - (BITS_PER_LONG - 8);
 
+	sg_miter_stop(&miter);
+
 	nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
 	val = mpi_alloc(nlimbs);
 	if (!val)
diff -druNp --no-dereference linux-libre-4.9.47-gnu/Makefile linux-libre-4.9.48-gnu/Makefile
--- linux-libre-4.9.47-gnu/Makefile	2017-09-02 07:23:20.000000000 -0400
+++ linux-libre-4.9.48-gnu/Makefile	2017-09-07 05:45:20.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 47
+SUBLEVEL = 48
 EXTRAVERSION = -gnu
 NAME = Roaring Lionus
 
diff -druNp --no-dereference linux-libre-4.9.47-gnu/mm/madvise.c linux-libre-4.9.48-gnu/mm/madvise.c
--- linux-libre-4.9.47-gnu/mm/madvise.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/mm/madvise.c	2017-09-07 02:35:53.000000000 -0400
@@ -533,6 +533,8 @@ static long madvise_remove(struct vm_are
 static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end)
 {
 	struct page *p;
+	struct zone *zone;
+
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 	for (; start < end; start += PAGE_SIZE <<
@@ -561,6 +563,11 @@ static int madvise_hwpoison(int bhv, uns
 		if (ret)
 			return ret;
 	}
+
+	/* Ensure that all poisoned pages are removed from per-cpu lists */
+	for_each_populated_zone(zone)
+		drain_all_pages(zone);
+
 	return 0;
 }
 #endif
diff -druNp --no-dereference linux-libre-4.9.47-gnu/net/xfrm/xfrm_policy.c linux-libre-4.9.48-gnu/net/xfrm/xfrm_policy.c
--- linux-libre-4.9.47-gnu/net/xfrm/xfrm_policy.c	2017-09-02 01:08:05.000000000 -0400
+++ linux-libre-4.9.48-gnu/net/xfrm/xfrm_policy.c	2017-09-07 02:35:53.000000000 -0400
@@ -3308,9 +3308,15 @@ int xfrm_migrate(const struct xfrm_selec
 	struct xfrm_state *x_new[XFRM_MAX_DEPTH];
 	struct xfrm_migrate *mp;
 
+	/* Stage 0 - sanity checks */
 	if ((err = xfrm_migrate_check(m, num_migrate)) < 0)
 		goto out;
 
+	if (dir >= XFRM_POLICY_MAX) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	/* Stage 1 - find policy */
 	if ((pol = xfrm_migrate_policy_find(sel, dir, type, net)) == NULL) {
 		err = -ENOENT;
