diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/arm/xen/enlighten.c linux-libre-3.18.47-gnu/arch/arm/xen/enlighten.c
--- linux-libre-3.18.46-gnu/arch/arm/xen/enlighten.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/arm/xen/enlighten.c	2017-01-18 13:51:20.000000000 -0500
@@ -295,8 +295,7 @@ static int __init xen_guest_init(void)
 	 * for secondary CPUs as they are brought up.
 	 * For uniformity we use VCPUOP_register_vcpu_info even on cpu0.
 	 */
-	xen_vcpu_info = __alloc_percpu(sizeof(struct vcpu_info),
-			                       sizeof(struct vcpu_info));
+	xen_vcpu_info = alloc_percpu(struct vcpu_info);
 	if (xen_vcpu_info == NULL)
 		return -ENOMEM;
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/boot/ps3.c linux-libre-3.18.47-gnu/arch/powerpc/boot/ps3.c
--- linux-libre-3.18.46-gnu/arch/powerpc/boot/ps3.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/boot/ps3.c	2017-01-18 13:51:20.000000000 -0500
@@ -119,13 +119,12 @@ void ps3_copy_vectors(void)
 	flush_cache((void *)0x100, 512);
 }
 
-void platform_init(unsigned long null_check)
+void platform_init(void)
 {
 	const u32 heapsize = 0x1000000 - (u32)_end; /* 16MiB */
 	void *chosen;
 	unsigned long ft_addr;
 	u64 rm_size;
-	unsigned long val;
 
 	console_ops.write = ps3_console_write;
 	platform_ops.exit = ps3_exit;
@@ -153,11 +152,6 @@ void platform_init(unsigned long null_ch
 
 	printf(" flat tree at 0x%lx\n\r", ft_addr);
 
-	val = *(unsigned long *)0;
-
-	if (val != null_check)
-		printf("null check failed: %lx != %lx\n\r", val, null_check);
-
 	((kernel_entry_t)0)(ft_addr, 0, NULL);
 
 	ps3_exit();
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/boot/ps3-head.S linux-libre-3.18.47-gnu/arch/powerpc/boot/ps3-head.S
--- linux-libre-3.18.46-gnu/arch/powerpc/boot/ps3-head.S	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/boot/ps3-head.S	2017-01-18 13:51:20.000000000 -0500
@@ -57,11 +57,6 @@ __system_reset_overlay:
 	bctr
 
 1:
-	/* Save the value at addr zero for a null pointer write check later. */
-
-	li	r4, 0
-	lwz	r3, 0(r4)
-
 	/* Primary delays then goes to _zimage_start in wrapper. */
 
 	or	31, 31, 31 /* db16cyc */
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/include/asm/kvm_host.h linux-libre-3.18.47-gnu/arch/powerpc/include/asm/kvm_host.h
--- linux-libre-3.18.46-gnu/arch/powerpc/include/asm/kvm_host.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/include/asm/kvm_host.h	2017-01-18 13:51:20.000000000 -0500
@@ -537,6 +537,7 @@ struct kvm_vcpu_arch {
 	u64 tfiar;
 
 	u32 cr_tm;
+	u64 xer_tm;
 	u64 lr_tm;
 	u64 ctr_tm;
 	u64 amr_tm;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/include/uapi/asm/kvm.h linux-libre-3.18.47-gnu/arch/powerpc/include/uapi/asm/kvm.h
--- linux-libre-3.18.46-gnu/arch/powerpc/include/uapi/asm/kvm.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/include/uapi/asm/kvm.h	2017-01-18 13:51:20.000000000 -0500
@@ -587,6 +587,7 @@ struct kvm_get_htab_header {
 #define KVM_REG_PPC_TM_VSCR	(KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67)
 #define KVM_REG_PPC_TM_DSCR	(KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68)
 #define KVM_REG_PPC_TM_TAR	(KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69)
+#define KVM_REG_PPC_TM_XER	(KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a)
 
 /* PPC64 eXternal Interrupt Controller Specification */
 #define KVM_DEV_XICS_GRP_SOURCES	1	/* 64-bit source attributes */
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/kernel/asm-offsets.c linux-libre-3.18.47-gnu/arch/powerpc/kernel/asm-offsets.c
--- linux-libre-3.18.46-gnu/arch/powerpc/kernel/asm-offsets.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/kernel/asm-offsets.c	2017-01-18 13:51:20.000000000 -0500
@@ -571,6 +571,7 @@ int main(void)
 	DEFINE(VCPU_VRS_TM, offsetof(struct kvm_vcpu, arch.vr_tm.vr));
 	DEFINE(VCPU_VRSAVE_TM, offsetof(struct kvm_vcpu, arch.vrsave_tm));
 	DEFINE(VCPU_CR_TM, offsetof(struct kvm_vcpu, arch.cr_tm));
+	DEFINE(VCPU_XER_TM, offsetof(struct kvm_vcpu, arch.xer_tm));
 	DEFINE(VCPU_LR_TM, offsetof(struct kvm_vcpu, arch.lr_tm));
 	DEFINE(VCPU_CTR_TM, offsetof(struct kvm_vcpu, arch.ctr_tm));
 	DEFINE(VCPU_AMR_TM, offsetof(struct kvm_vcpu, arch.amr_tm));
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/kvm/book3s_hv.c linux-libre-3.18.47-gnu/arch/powerpc/kvm/book3s_hv.c
--- linux-libre-3.18.46-gnu/arch/powerpc/kvm/book3s_hv.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/kvm/book3s_hv.c	2017-01-18 13:51:20.000000000 -0500
@@ -1097,6 +1097,9 @@ static int kvmppc_get_one_reg_hv(struct
 	case KVM_REG_PPC_TM_CR:
 		*val = get_reg_val(id, vcpu->arch.cr_tm);
 		break;
+	case KVM_REG_PPC_TM_XER:
+		*val = get_reg_val(id, vcpu->arch.xer_tm);
+		break;
 	case KVM_REG_PPC_TM_LR:
 		*val = get_reg_val(id, vcpu->arch.lr_tm);
 		break;
@@ -1304,6 +1307,9 @@ static int kvmppc_set_one_reg_hv(struct
 	case KVM_REG_PPC_TM_CR:
 		vcpu->arch.cr_tm = set_reg_val(id, *val);
 		break;
+	case KVM_REG_PPC_TM_XER:
+		vcpu->arch.xer_tm = set_reg_val(id, *val);
+		break;
 	case KVM_REG_PPC_TM_LR:
 		vcpu->arch.lr_tm = set_reg_val(id, *val);
 		break;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/arch/powerpc/kvm/book3s_hv_rmhandlers.S linux-libre-3.18.47-gnu/arch/powerpc/kvm/book3s_hv_rmhandlers.S
--- linux-libre-3.18.46-gnu/arch/powerpc/kvm/book3s_hv_rmhandlers.S	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/arch/powerpc/kvm/book3s_hv_rmhandlers.S	2017-01-18 13:51:20.000000000 -0500
@@ -2385,11 +2385,13 @@ kvmppc_save_tm:
 	mfctr	r7
 	mfspr	r8, SPRN_AMR
 	mfspr	r10, SPRN_TAR
+	mfxer	r11
 	std	r5, VCPU_LR_TM(r9)
 	stw	r6, VCPU_CR_TM(r9)
 	std	r7, VCPU_CTR_TM(r9)
 	std	r8, VCPU_AMR_TM(r9)
 	std	r10, VCPU_TAR_TM(r9)
+	std	r11, VCPU_XER_TM(r9)
 
 	/* Restore r12 as trap number. */
 	lwz	r12, VCPU_TRAP(r9)
@@ -2482,11 +2484,13 @@ kvmppc_restore_tm:
 	ld	r7, VCPU_CTR_TM(r4)
 	ld	r8, VCPU_AMR_TM(r4)
 	ld	r9, VCPU_TAR_TM(r4)
+	ld	r10, VCPU_XER_TM(r4)
 	mtlr	r5
 	mtcr	r6
 	mtctr	r7
 	mtspr	SPRN_AMR, r8
 	mtspr	SPRN_TAR, r9
+	mtxer	r10
 
 	/*
 	 * Load up PPR and DSCR values but don't put them in the actual SPRs
diff -druNp --no-dereference linux-libre-3.18.46-gnu/block/bsg.c linux-libre-3.18.47-gnu/block/bsg.c
--- linux-libre-3.18.46-gnu/block/bsg.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/block/bsg.c	2017-01-18 13:51:20.000000000 -0500
@@ -677,6 +677,9 @@ bsg_write(struct file *file, const char
 
 	dprintk("%s: write %Zd bytes\n", bd->name, count);
 
+	if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+		return -EINVAL;
+
 	bsg_set_block(bd, file);
 
 	bytes_written = 0;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/Documentation/virtual/kvm/api.txt linux-libre-3.18.47-gnu/Documentation/virtual/kvm/api.txt
--- linux-libre-3.18.46-gnu/Documentation/virtual/kvm/api.txt	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/Documentation/virtual/kvm/api.txt	2017-01-18 13:51:20.000000000 -0500
@@ -1919,6 +1919,7 @@ registers, find a list below:
   PPC   | KVM_REG_PPC_TM_VSCR           | 32
   PPC   | KVM_REG_PPC_TM_DSCR           | 64
   PPC   | KVM_REG_PPC_TM_TAR            | 64
+  PPC   | KVM_REG_PPC_TM_XER            | 64
         |                               |
   MIPS  | KVM_REG_MIPS_R0               | 64
           ...
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/crypto/caam/caamalg.c linux-libre-3.18.47-gnu/drivers/crypto/caam/caamalg.c
--- linux-libre-3.18.46-gnu/drivers/crypto/caam/caamalg.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/crypto/caam/caamalg.c	2017-01-18 13:51:20.000000000 -0500
@@ -597,7 +597,9 @@ static int aead_set_sh_desc(struct crypt
 
 	/* Will read cryptlen */
 	append_math_add(desc, VARSEQINLEN, SEQINLEN, REG0, CAAM_CMD_SZ);
-	aead_append_src_dst(desc, FIFOLD_TYPE_MSG1OUT2);
+	append_seq_fifo_load(desc, 0, FIFOLD_CLASS_BOTH | KEY_VLF |
+			     FIFOLD_TYPE_MSG1OUT2 | FIFOLD_TYPE_LASTBOTH);
+	append_seq_fifo_store(desc, 0, FIFOST_TYPE_MESSAGE_DATA | KEY_VLF);
 
 	/* Write ICV */
 	append_seq_store(desc, ctx->authsize, LDST_CLASS_2_CCB |
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/gpu/drm/ast/ast_main.c linux-libre-3.18.47-gnu/drivers/gpu/drm/ast/ast_main.c
--- linux-libre-3.18.46-gnu/drivers/gpu/drm/ast/ast_main.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/gpu/drm/ast/ast_main.c	2017-01-18 13:51:20.000000000 -0500
@@ -223,7 +223,8 @@ static int ast_get_dram_info(struct drm_
 	ast_write32(ast, 0x10000, 0xfc600309);
 
 	do {
-		;
+		if (pci_channel_offline(dev->pdev))
+			return -EIO;
 	} while (ast_read32(ast, 0x10000) != 0x01);
 	data = ast_read32(ast, 0x10004);
 
@@ -429,7 +430,9 @@ int ast_driver_load(struct drm_device *d
 	ast_detect_chip(dev, &need_post);
 
 	if (ast->chip != AST1180) {
-		ast_get_dram_info(dev);
+		ret = ast_get_dram_info(dev);
+		if (ret)
+			goto out_free;
 		ast->vram_size = ast_get_vram_info(dev);
 		DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size);
 	}
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/gpu/drm/gma500/psb_drv.c linux-libre-3.18.47-gnu/drivers/gpu/drm/gma500/psb_drv.c
--- linux-libre-3.18.46-gnu/drivers/gpu/drm/gma500/psb_drv.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/gpu/drm/gma500/psb_drv.c	2017-01-18 13:51:20.000000000 -0500
@@ -464,6 +464,9 @@ static const struct file_operations psb_
 	.open = drm_open,
 	.release = drm_release,
 	.unlocked_ioctl = psb_unlocked_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = drm_compat_ioctl,
+#endif
 	.mmap = drm_gem_mmap,
 	.poll = drm_poll,
 	.read = drm_read,
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/gpu/drm/radeon/si_dpm.c linux-libre-3.18.47-gnu/drivers/gpu/drm/radeon/si_dpm.c
--- linux-libre-3.18.46-gnu/drivers/gpu/drm/radeon/si_dpm.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/gpu/drm/radeon/si_dpm.c	2017-01-18 13:51:20.000000000 -0500
@@ -2972,6 +2972,7 @@ static void si_apply_state_adjust_rules(
 		    (rdev->pdev->revision == 0x80) ||
 		    (rdev->pdev->revision == 0x81) ||
 		    (rdev->pdev->revision == 0x83) ||
+		    (rdev->pdev->revision == 0x87) ||
 		    (rdev->pdev->device == 0x6604) ||
 		    (rdev->pdev->device == 0x6605)) {
 			max_sclk = 75000;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/infiniband/ulp/ipoib/ipoib_multicast.c linux-libre-3.18.47-gnu/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
--- linux-libre-3.18.46-gnu/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2017-01-18 13:51:20.000000000 -0500
@@ -523,8 +523,11 @@ void ipoib_mcast_join_task(struct work_s
 	if (!test_bit(IPOIB_MCAST_RUN, &priv->flags))
 		return;
 
-	if (ib_query_port(priv->ca, priv->port, &port_attr) ||
-	    port_attr.state != IB_PORT_ACTIVE) {
+	if (ib_query_port(priv->ca, priv->port, &port_attr)) {
+		ipoib_dbg(priv, "ib_query_port() failed\n");
+		return;
+	}
+	if (port_attr.state != IB_PORT_ACTIVE) {
 		ipoib_dbg(priv, "port state is not ACTIVE (state = %d) suspending join task\n",
 			  port_attr.state);
 		return;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/input/misc/drv260x.c linux-libre-3.18.47-gnu/drivers/input/misc/drv260x.c
--- linux-libre-3.18.46-gnu/drivers/input/misc/drv260x.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/input/misc/drv260x.c	2017-01-18 13:51:20.000000000 -0500
@@ -597,7 +597,6 @@ static int drv260x_probe(struct i2c_clie
 	}
 
 	haptics->input_dev->name = "drv260x:haptics";
-	haptics->input_dev->dev.parent = client->dev.parent;
 	haptics->input_dev->close = drv260x_close;
 	input_set_drvdata(haptics->input_dev, haptics);
 	input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/md/dm-crypt.c linux-libre-3.18.47-gnu/drivers/md/dm-crypt.c
--- linux-libre-3.18.46-gnu/drivers/md/dm-crypt.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/md/dm-crypt.c	2017-01-18 13:51:20.000000000 -0500
@@ -1450,12 +1450,15 @@ static int crypt_set_key(struct crypt_co
 	if (!cc->key_size && strcmp(key, "-"))
 		goto out;
 
+	/* clear the flag since following operations may invalidate previously valid key */
+	clear_bit(DM_CRYPT_KEY_VALID, &cc->flags);
+
 	if (cc->key_size && crypt_decode_key(cc->key, key, cc->key_size) < 0)
 		goto out;
 
-	set_bit(DM_CRYPT_KEY_VALID, &cc->flags);
-
 	r = crypt_setkey_allcpus(cc);
+	if (!r)
+		set_bit(DM_CRYPT_KEY_VALID, &cc->flags);
 
 out:
 	/* Hex key string not needed after here, so wipe it. */
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/md/persistent-data/dm-space-map-metadata.c linux-libre-3.18.47-gnu/drivers/md/persistent-data/dm-space-map-metadata.c
--- linux-libre-3.18.46-gnu/drivers/md/persistent-data/dm-space-map-metadata.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/md/persistent-data/dm-space-map-metadata.c	2017-01-18 13:51:20.000000000 -0500
@@ -764,17 +764,15 @@ int dm_sm_metadata_create(struct dm_spac
 	memcpy(&smm->sm, &bootstrap_ops, sizeof(smm->sm));
 
 	r = sm_ll_new_metadata(&smm->ll, tm);
+	if (!r) {
+		if (nr_blocks > DM_SM_METADATA_MAX_BLOCKS)
+			nr_blocks = DM_SM_METADATA_MAX_BLOCKS;
+		r = sm_ll_extend(&smm->ll, nr_blocks);
+	}
+	memcpy(&smm->sm, &ops, sizeof(smm->sm));
 	if (r)
 		return r;
 
-	if (nr_blocks > DM_SM_METADATA_MAX_BLOCKS)
-		nr_blocks = DM_SM_METADATA_MAX_BLOCKS;
-	r = sm_ll_extend(&smm->ll, nr_blocks);
-	if (r)
-		return r;
-
-	memcpy(&smm->sm, &ops, sizeof(smm->sm));
-
 	/*
 	 * Now we need to update the newly created data structures with the
 	 * allocated blocks that they were built from.
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/md/raid5.c linux-libre-3.18.47-gnu/drivers/md/raid5.c
--- linux-libre-3.18.46-gnu/drivers/md/raid5.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/md/raid5.c	2017-01-18 13:51:20.000000000 -0500
@@ -6203,6 +6203,15 @@ static int run(struct mddev *mddev)
 			stripe = (stripe | (stripe-1)) + 1;
 		mddev->queue->limits.discard_alignment = stripe;
 		mddev->queue->limits.discard_granularity = stripe;
+
+		/*
+		 * We use 16-bit counter of active stripes in bi_phys_segments
+		 * (minus one for over-loaded initialization)
+		 */
+		blk_queue_max_hw_sectors(mddev->queue, 0xfffe * STRIPE_SECTORS);
+		blk_queue_max_discard_sectors(mddev->queue,
+					      0xfffe * STRIPE_SECTORS);
+
 		/*
 		 * unaligned part of discard request will be ignored, so can't
 		 * guarantee discard_zeroes_data
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/mmc/host/sdhci.c linux-libre-3.18.47-gnu/drivers/mmc/host/sdhci.c
--- linux-libre-3.18.46-gnu/drivers/mmc/host/sdhci.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/mmc/host/sdhci.c	2017-01-18 13:51:20.000000000 -0500
@@ -1988,7 +1988,27 @@ static int sdhci_execute_tuning(struct m
 			ctrl &= ~SDHCI_CTRL_EXEC_TUNING;
 			sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
 
+			sdhci_do_reset(host, SDHCI_RESET_CMD);
+			sdhci_do_reset(host, SDHCI_RESET_DATA);
+
 			err = -EIO;
+
+			if (cmd.opcode != MMC_SEND_TUNING_BLOCK_HS200)
+				goto out;
+
+			sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
+			sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
+
+			spin_unlock_irqrestore(&host->lock, flags);
+
+			memset(&cmd, 0, sizeof(cmd));
+			cmd.opcode = MMC_STOP_TRANSMISSION;
+			cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
+			cmd.busy_timeout = 50;
+			mmc_wait_for_cmd(mmc, &cmd, 0);
+
+			spin_lock_irqsave(&host->lock, flags);
+
 			goto out;
 		}
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/pci/pci.c linux-libre-3.18.47-gnu/drivers/pci/pci.c
--- linux-libre-3.18.46-gnu/drivers/pci/pci.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/pci/pci.c	2017-01-18 13:51:20.000000000 -0500
@@ -1987,6 +1987,10 @@ bool pci_dev_run_wake(struct pci_dev *de
 	if (!dev->pme_support)
 		return false;
 
+	/* PME-capable in principle, but not from the intended sleep state */
+	if (!pci_pme_capable(dev, pci_target_state(dev)))
+		return false;
+
 	while (bus->parent) {
 		struct pci_dev *bridge = bus->self;
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/regulator/stw481x-vmmc.c linux-libre-3.18.47-gnu/drivers/regulator/stw481x-vmmc.c
--- linux-libre-3.18.46-gnu/drivers/regulator/stw481x-vmmc.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/regulator/stw481x-vmmc.c	2017-01-18 13:51:20.000000000 -0500
@@ -47,7 +47,8 @@ static struct regulator_desc vmmc_regula
 	.volt_table = stw481x_vmmc_voltages,
 	.enable_time = 200, /* FIXME: look this up */
 	.enable_reg = STW_CONF1,
-	.enable_mask = STW_CONF1_PDN_VMMC,
+	.enable_mask = STW_CONF1_PDN_VMMC | STW_CONF1_MMC_LS_STATUS,
+	.enable_val = STW_CONF1_PDN_VMMC,
 	.vsel_reg = STW_CONF1,
 	.vsel_mask = STW_CONF1_VMMC_MASK,
 };
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/s390/char/vmlogrdr.c linux-libre-3.18.47-gnu/drivers/s390/char/vmlogrdr.c
--- linux-libre-3.18.46-gnu/drivers/s390/char/vmlogrdr.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/s390/char/vmlogrdr.c	2017-01-18 13:51:20.000000000 -0500
@@ -872,7 +872,7 @@ static int __init vmlogrdr_init(void)
 		goto cleanup;
 
 	for (i=0; i < MAXMINOR; ++i ) {
-		sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL);
+		sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
 		if (!sys_ser[i].buffer) {
 			rc = -ENOMEM;
 			break;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/scsi/megaraid/megaraid_sas_fusion.c linux-libre-3.18.47-gnu/drivers/scsi/megaraid/megaraid_sas_fusion.c
--- linux-libre-3.18.46-gnu/drivers/scsi/megaraid/megaraid_sas_fusion.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/scsi/megaraid/megaraid_sas_fusion.c	2017-01-18 13:51:20.000000000 -0500
@@ -2508,6 +2508,7 @@ int megasas_wait_for_outstanding_fusion(
 		printk("megaraid_sas: pending commands remain after waiting, "
 		       "will reset adapter scsi%d.\n",
 		       instance->host->host_no);
+		*convert = 1;
 		retval = 1;
 	}
 out:
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/scsi/scsi_sysfs.c linux-libre-3.18.47-gnu/drivers/scsi/scsi_sysfs.c
--- linux-libre-3.18.46-gnu/drivers/scsi/scsi_sysfs.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/scsi/scsi_sysfs.c	2017-01-18 13:51:20.000000000 -0500
@@ -1027,10 +1027,6 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 	struct request_queue *rq = sdev->request_queue;
 	struct scsi_target *starget = sdev->sdev_target;
 
-	error = scsi_device_set_state(sdev, SDEV_RUNNING);
-	if (error)
-		return error;
-
 	error = scsi_target_add(starget);
 	if (error)
 		return error;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/scsi/sg.c linux-libre-3.18.47-gnu/drivers/scsi/sg.c
--- linux-libre-3.18.46-gnu/drivers/scsi/sg.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/scsi/sg.c	2017-01-18 13:51:20.000000000 -0500
@@ -592,6 +592,9 @@ sg_write(struct file *filp, const char _
 	sg_io_hdr_t *hp;
 	unsigned char cmnd[SG_MAX_CDB_SIZE];
 
+	if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+		return -EINVAL;
+
 	if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
 		return -ENXIO;
 	SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/ssb/pci.c linux-libre-3.18.47-gnu/drivers/ssb/pci.c
--- linux-libre-3.18.46-gnu/drivers/ssb/pci.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/ssb/pci.c	2017-01-18 13:51:20.000000000 -0500
@@ -909,6 +909,7 @@ static int ssb_pci_sprom_get(struct ssb_
 			if (err) {
 				ssb_warn("WARNING: Using fallback SPROM failed (err %d)\n",
 					 err);
+				goto out_free;
 			} else {
 				ssb_dbg("Using SPROM revision %d provided by platform\n",
 					sprom->revision);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/staging/comedi/drivers/ni_mio_common.c linux-libre-3.18.47-gnu/drivers/staging/comedi/drivers/ni_mio_common.c
--- linux-libre-3.18.46-gnu/drivers/staging/comedi/drivers/ni_mio_common.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/staging/comedi/drivers/ni_mio_common.c	2017-01-18 13:51:20.000000000 -0500
@@ -2105,7 +2105,7 @@ static int ni_ai_insn_read(struct comedi
 			   unsigned int *data)
 {
 	struct ni_private *devpriv = dev->private;
-	unsigned int mask = (s->maxdata + 1) >> 1;
+	unsigned int mask = s->maxdata;
 	int i, n;
 	unsigned signbits;
 	unsigned int d;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/target/target_core_user.c linux-libre-3.18.47-gnu/drivers/target/target_core_user.c
--- linux-libre-3.18.46-gnu/drivers/target/target_core_user.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/target/target_core_user.c	2017-01-18 13:51:20.000000000 -0500
@@ -587,8 +587,6 @@ static int tcmu_check_expired_cmd(int id
 	target_complete_cmd(cmd->se_cmd, SAM_STAT_CHECK_CONDITION);
 	cmd->se_cmd = NULL;
 
-	kmem_cache_free(tcmu_cmd_cache, cmd);
-
 	return 0;
 }
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/thermal/thermal_hwmon.c linux-libre-3.18.47-gnu/drivers/thermal/thermal_hwmon.c
--- linux-libre-3.18.46-gnu/drivers/thermal/thermal_hwmon.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/thermal/thermal_hwmon.c	2017-01-18 13:51:20.000000000 -0500
@@ -98,7 +98,7 @@ temp_crit_show(struct device *dev, struc
 	long temperature;
 	int ret;
 
-	ret = tz->ops->get_trip_temp(tz, 0, &temperature);
+	ret = tz->ops->get_crit_temp(tz, &temperature);
 	if (ret)
 		return ret;
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/usb/class/cdc-acm.c linux-libre-3.18.47-gnu/drivers/usb/class/cdc-acm.c
--- linux-libre-3.18.46-gnu/drivers/usb/class/cdc-acm.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/usb/class/cdc-acm.c	2017-01-18 13:51:20.000000000 -0500
@@ -1727,6 +1727,7 @@ static const struct usb_device_id acm_id
 	{ USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */
 	.driver_info = QUIRK_CONTROL_LINE_STATE, },
 	{ USB_DEVICE(0x2184, 0x001c) },	/* GW Instek AFG-2225 */
+	{ USB_DEVICE(0x2184, 0x0036) },	/* GW Instek AFG-125 */
 	{ USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */
 	},
 	/* Motorola H24 HSPA module: */
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/usb/core/hub.c linux-libre-3.18.47-gnu/drivers/usb/core/hub.c
--- linux-libre-3.18.46-gnu/drivers/usb/core/hub.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/usb/core/hub.c	2017-01-18 13:51:20.000000000 -0500
@@ -101,6 +101,8 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rws
 
 static void hub_release(struct kref *kref);
 static int usb_reset_and_verify_device(struct usb_device *udev);
+static void hub_usb3_port_prepare_disable(struct usb_hub *hub,
+					  struct usb_port *port_dev);
 
 static inline char *portspeed(struct usb_hub *hub, int portstatus)
 {
@@ -882,82 +884,28 @@ static int hub_set_port_link_state(struc
 }
 
 /*
- * If USB 3.0 ports are placed into the Disabled state, they will no longer
- * detect any device connects or disconnects.  This is generally not what the
- * USB core wants, since it expects a disabled port to produce a port status
- * change event when a new device connects.
- *
- * Instead, set the link state to Disabled, wait for the link to settle into
- * that state, clear any change bits, and then put the port into the RxDetect
- * state.
+ * USB-3 does not have a similar link state as USB-2 that will avoid negotiating
+ * a connection with a plugged-in cable but will signal the host when the cable
+ * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices
  */
-static int hub_usb3_port_disable(struct usb_hub *hub, int port1)
-{
-	int ret;
-	int total_time;
-	u16 portchange, portstatus;
-
-	if (!hub_is_superspeed(hub->hdev))
-		return -EINVAL;
-
-	ret = hub_port_status(hub, port1, &portstatus, &portchange);
-	if (ret < 0)
-		return ret;
-
-	/*
-	 * USB controller Advanced Micro Devices, Inc. [AMD] FCH USB XHCI
-	 * Controller [1022:7814] will have spurious result making the following
-	 * usb 3.0 device hotplugging route to the 2.0 root hub and recognized
-	 * as high-speed device if we set the usb 3.0 port link state to
-	 * Disabled. Since it's already in USB_SS_PORT_LS_RX_DETECT state, we
-	 * check the state here to avoid the bug.
-	 */
-	if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
-				USB_SS_PORT_LS_RX_DETECT) {
-		dev_dbg(&hub->ports[port1 - 1]->dev,
-			 "Not disabling port; link state is RxDetect\n");
-		return ret;
-	}
-
-	ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
-	if (ret)
-		return ret;
-
-	/* Wait for the link to enter the disabled state. */
-	for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) {
-		ret = hub_port_status(hub, port1, &portstatus, &portchange);
-		if (ret < 0)
-			return ret;
-
-		if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
-				USB_SS_PORT_LS_SS_DISABLED)
-			break;
-		if (total_time >= HUB_DEBOUNCE_TIMEOUT)
-			break;
-		msleep(HUB_DEBOUNCE_STEP);
-	}
-	if (total_time >= HUB_DEBOUNCE_TIMEOUT)
-		dev_warn(&hub->ports[port1 - 1]->dev,
-				"Could not disable after %d ms\n", total_time);
-
-	return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT);
-}
-
 static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
 {
 	struct usb_port *port_dev = hub->ports[port1 - 1];
 	struct usb_device *hdev = hub->hdev;
 	int ret = 0;
 
-	if (port_dev->child && set_state)
-		usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED);
 	if (!hub->error) {
-		if (hub_is_superspeed(hub->hdev))
-			ret = hub_usb3_port_disable(hub, port1);
-		else
+		if (hub_is_superspeed(hub->hdev)) {
+			hub_usb3_port_prepare_disable(hub, port_dev);
+			ret = hub_set_port_link_state(hub, port_dev->portnum,
+						      USB_SS_PORT_LS_U3);
+		} else {
 			ret = usb_clear_port_feature(hdev, port1,
 					USB_PORT_FEAT_ENABLE);
+		}
 	}
+	if (port_dev->child && set_state)
+		usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED);
 	if (ret && ret != -ENODEV)
 		dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret);
 	return ret;
@@ -4041,6 +3989,26 @@ void usb_unlocked_enable_lpm(struct usb_
 }
 EXPORT_SYMBOL_GPL(usb_unlocked_enable_lpm);
 
+/* usb3 devices use U3 for disabled, make sure remote wakeup is disabled */
+static void hub_usb3_port_prepare_disable(struct usb_hub *hub,
+					  struct usb_port *port_dev)
+{
+	struct usb_device *udev = port_dev->child;
+	int ret;
+
+	if (udev && udev->port_is_suspended && udev->do_remote_wakeup) {
+		ret = hub_set_port_link_state(hub, port_dev->portnum,
+					      USB_SS_PORT_LS_U0);
+		if (!ret) {
+			msleep(USB_RESUME_TIMEOUT);
+			ret = usb_disable_remote_wakeup(udev);
+		}
+		if (ret)
+			dev_warn(&udev->dev,
+				 "Port disable: can't disable remote wake\n");
+		udev->do_remote_wakeup = 0;
+	}
+}
 
 #else	/* CONFIG_PM */
 
@@ -4048,6 +4016,9 @@ EXPORT_SYMBOL_GPL(usb_unlocked_enable_lp
 #define hub_resume		NULL
 #define hub_reset_resume	NULL
 
+static inline void hub_usb3_port_prepare_disable(struct usb_hub *hub,
+						 struct usb_port *port_dev) { }
+
 int usb_disable_lpm(struct usb_device *udev)
 {
 	return 0;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/usb/gadget/composite.c linux-libre-3.18.47-gnu/drivers/usb/gadget/composite.c
--- linux-libre-3.18.46-gnu/drivers/usb/gadget/composite.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/usb/gadget/composite.c	2017-01-18 13:51:20.000000000 -0500
@@ -143,7 +143,7 @@ int config_ep_by_speed(struct usb_gadget
 
 ep_found:
 	/* commit results */
-	_ep->maxpacket = usb_endpoint_maxp(chosen_desc);
+	_ep->maxpacket = usb_endpoint_maxp(chosen_desc) & 0x7ff;
 	_ep->desc = chosen_desc;
 	_ep->comp_desc = NULL;
 	_ep->maxburst = 0;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/usb/host/uhci-pci.c linux-libre-3.18.47-gnu/drivers/usb/host/uhci-pci.c
--- linux-libre-3.18.46-gnu/drivers/usb/host/uhci-pci.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/usb/host/uhci-pci.c	2017-01-18 13:51:20.000000000 -0500
@@ -129,6 +129,10 @@ static int uhci_pci_init(struct usb_hcd
 	if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_HP)
 		uhci->wait_for_hp = 1;
 
+	/* Intel controllers use non-PME wakeup signalling */
+	if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL)
+		device_set_run_wake(uhci_dev(uhci), 1);
+
 	/* Set up pointers to PCI-specific functions */
 	uhci->reset_hc = uhci_pci_reset_hc;
 	uhci->check_and_reset_hc = uhci_pci_check_and_reset_hc;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/usb/serial/kl5kusb105.c linux-libre-3.18.47-gnu/drivers/usb/serial/kl5kusb105.c
--- linux-libre-3.18.46-gnu/drivers/usb/serial/kl5kusb105.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/usb/serial/kl5kusb105.c	2017-01-18 13:51:20.000000000 -0500
@@ -296,7 +296,7 @@ static int  klsi_105_open(struct tty_str
 	rc = usb_serial_generic_open(tty, port);
 	if (rc) {
 		retval = rc;
-		goto exit;
+		goto err_free_cfg;
 	}
 
 	rc = usb_control_msg(port->serial->dev,
@@ -315,17 +315,32 @@ static int  klsi_105_open(struct tty_str
 		dev_dbg(&port->dev, "%s - enabled reading\n", __func__);
 
 	rc = klsi_105_get_line_state(port, &line_state);
-	if (rc >= 0) {
-		spin_lock_irqsave(&priv->lock, flags);
-		priv->line_state = line_state;
-		spin_unlock_irqrestore(&priv->lock, flags);
-		dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__, line_state);
-		retval = 0;
-	} else
+	if (rc < 0) {
 		retval = rc;
+		goto err_disable_read;
+	}
 
-exit:
+	spin_lock_irqsave(&priv->lock, flags);
+	priv->line_state = line_state;
+	spin_unlock_irqrestore(&priv->lock, flags);
+	dev_dbg(&port->dev, "%s - read line state 0x%lx\n", __func__,
+			line_state);
+
+	return 0;
+
+err_disable_read:
+	usb_control_msg(port->serial->dev,
+			     usb_sndctrlpipe(port->serial->dev, 0),
+			     KL5KUSB105A_SIO_CONFIGURE,
+			     USB_TYPE_VENDOR | USB_DIR_OUT,
+			     KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
+			     0, /* index */
+			     NULL, 0,
+			     KLSI_TIMEOUT);
+	usb_serial_generic_close(port);
+err_free_cfg:
 	kfree(cfg);
+
 	return retval;
 }
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/drivers/usb/serial/option.c linux-libre-3.18.47-gnu/drivers/usb/serial/option.c
--- linux-libre-3.18.46-gnu/drivers/usb/serial/option.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/drivers/usb/serial/option.c	2017-01-18 13:51:20.000000000 -0500
@@ -270,6 +270,8 @@ static void option_instat_callback(struc
 #define TELIT_PRODUCT_CC864_SINGLE		0x1006
 #define TELIT_PRODUCT_DE910_DUAL		0x1010
 #define TELIT_PRODUCT_UE910_V2			0x1012
+#define TELIT_PRODUCT_LE922_USBCFG1		0x1040
+#define TELIT_PRODUCT_LE922_USBCFG2		0x1041
 #define TELIT_PRODUCT_LE922_USBCFG0		0x1042
 #define TELIT_PRODUCT_LE922_USBCFG3		0x1043
 #define TELIT_PRODUCT_LE922_USBCFG5		0x1045
@@ -1223,6 +1225,10 @@ static const struct usb_device_id option
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0),
 		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1),
+		.driver_info = (kernel_ulong_t)&telit_le910_blacklist },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG2),
+		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3),
 		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
 	{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff),
@@ -1999,6 +2005,7 @@ static const struct usb_device_id option
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
+	{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d04, 0xff) },			/* D-Link DWM-158 */
 	{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff),			/* D-Link DWM-221 B1 */
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/block_dev.c linux-libre-3.18.47-gnu/fs/block_dev.c
--- linux-libre-3.18.46-gnu/fs/block_dev.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/block_dev.c	2017-01-18 13:51:20.000000000 -0500
@@ -694,7 +694,7 @@ static bool bd_may_claim(struct block_de
 		return true;	 /* already a holder */
 	else if (bdev->bd_holder != NULL)
 		return false; 	 /* held by someone else */
-	else if (bdev->bd_contains == bdev)
+	else if (whole == bdev)
 		return true;  	 /* is a whole device which isn't held */
 
 	else if (whole->bd_holder == bd_may_claim)
@@ -1727,6 +1727,7 @@ void iterate_bdevs(void (*func)(struct b
 	spin_lock(&inode_sb_list_lock);
 	list_for_each_entry(inode, &blockdev_superblock->s_inodes, i_sb_list) {
 		struct address_space *mapping = inode->i_mapping;
+		struct block_device *bdev;
 
 		spin_lock(&inode->i_lock);
 		if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW) ||
@@ -1747,8 +1748,12 @@ void iterate_bdevs(void (*func)(struct b
 		 */
 		iput(old_inode);
 		old_inode = inode;
+		bdev = I_BDEV(inode);
 
-		func(I_BDEV(inode), arg);
+		mutex_lock(&bdev->bd_mutex);
+		if (bdev->bd_openers)
+			func(bdev, arg);
+		mutex_unlock(&bdev->bd_mutex);
 
 		spin_lock(&inode_sb_list_lock);
 	}
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/btrfs/tree-log.c linux-libre-3.18.47-gnu/fs/btrfs/tree-log.c
--- linux-libre-3.18.46-gnu/fs/btrfs/tree-log.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/btrfs/tree-log.c	2017-01-18 13:51:20.000000000 -0500
@@ -1782,12 +1782,11 @@ static noinline int find_dir_range(struc
 next:
 	/* check the next slot in the tree to see if it is a valid item */
 	nritems = btrfs_header_nritems(path->nodes[0]);
+	path->slots[0]++;
 	if (path->slots[0] >= nritems) {
 		ret = btrfs_next_leaf(root, path);
 		if (ret)
 			goto out;
-	} else {
-		path->slots[0]++;
 	}
 
 	btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/cifs/cifsglob.h linux-libre-3.18.47-gnu/fs/cifs/cifsglob.h
--- linux-libre-3.18.46-gnu/fs/cifs/cifsglob.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/cifs/cifsglob.h	2017-01-18 13:51:20.000000000 -0500
@@ -615,6 +615,8 @@ struct TCP_Server_Info {
 #ifdef CONFIG_CIFS_SMB2
 	unsigned int	max_read;
 	unsigned int	max_write;
+	struct delayed_work reconnect; /* reconnect workqueue job */
+	struct mutex reconnect_mutex; /* prevent simultaneous reconnects */
 #endif /* CONFIG_CIFS_SMB2 */
 };
 
@@ -814,6 +816,7 @@ cap_unix(struct cifs_ses *ses)
 struct cifs_tcon {
 	struct list_head tcon_list;
 	int tc_count;
+	struct list_head rlist; /* reconnect list */
 	struct list_head openFileList;
 	struct cifs_ses *ses;	/* pointer to session associated with */
 	char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/cifs/cifsproto.h linux-libre-3.18.47-gnu/fs/cifs/cifsproto.h
--- linux-libre-3.18.46-gnu/fs/cifs/cifsproto.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/cifs/cifsproto.h	2017-01-18 13:51:20.000000000 -0500
@@ -207,6 +207,9 @@ extern void cifs_add_pending_open_locked
 					 struct tcon_link *tlink,
 					 struct cifs_pending_open *open);
 extern void cifs_del_pending_open(struct cifs_pending_open *open);
+extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
+				 int from_reconnect);
+extern void cifs_put_tcon(struct cifs_tcon *tcon);
 
 #if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
 extern void cifs_dfs_release_automount_timer(void);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/cifs/connect.c linux-libre-3.18.47-gnu/fs/cifs/connect.c
--- linux-libre-3.18.46-gnu/fs/cifs/connect.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/cifs/connect.c	2017-01-18 13:51:20.000000000 -0500
@@ -52,6 +52,9 @@
 #include "nterr.h"
 #include "rfc1002pdu.h"
 #include "fscache.h"
+#ifdef CONFIG_CIFS_SMB2
+#include "smb2proto.h"
+#endif
 
 #define CIFS_PORT 445
 #define RFC1001_PORT 139
@@ -2066,8 +2069,8 @@ cifs_find_tcp_session(struct smb_vol *vo
 	return NULL;
 }
 
-static void
-cifs_put_tcp_session(struct TCP_Server_Info *server)
+void
+cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect)
 {
 	struct task_struct *task;
 
@@ -2084,6 +2087,19 @@ cifs_put_tcp_session(struct TCP_Server_I
 
 	cancel_delayed_work_sync(&server->echo);
 
+#ifdef CONFIG_CIFS_SMB2
+	if (from_reconnect)
+		/*
+		 * Avoid deadlock here: reconnect work calls
+		 * cifs_put_tcp_session() at its end. Need to be sure
+		 * that reconnect work does nothing with server pointer after
+		 * that step.
+		 */
+		cancel_delayed_work(&server->reconnect);
+	else
+		cancel_delayed_work_sync(&server->reconnect);
+#endif
+
 	spin_lock(&GlobalMid_Lock);
 	server->tcpStatus = CifsExiting;
 	spin_unlock(&GlobalMid_Lock);
@@ -2148,6 +2164,10 @@ cifs_get_tcp_session(struct smb_vol *vol
 	INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
 	INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
 	INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
+#ifdef CONFIG_CIFS_SMB2
+	INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server);
+	mutex_init(&tcp_ses->reconnect_mutex);
+#endif
 	memcpy(&tcp_ses->srcaddr, &volume_info->srcaddr,
 	       sizeof(tcp_ses->srcaddr));
 	memcpy(&tcp_ses->dstaddr, &volume_info->dstaddr,
@@ -2300,7 +2320,7 @@ cifs_put_smb_ses(struct cifs_ses *ses)
 	spin_unlock(&cifs_tcp_ses_lock);
 
 	sesInfoFree(ses);
-	cifs_put_tcp_session(server);
+	cifs_put_tcp_session(server, 0);
 }
 
 #ifdef CONFIG_KEYS
@@ -2473,7 +2493,7 @@ cifs_get_smb_ses(struct TCP_Server_Info
 		mutex_unlock(&ses->session_mutex);
 
 		/* existing SMB ses has a server reference already */
-		cifs_put_tcp_session(server);
+		cifs_put_tcp_session(server, 0);
 		free_xid(xid);
 		return ses;
 	}
@@ -2563,7 +2583,7 @@ cifs_find_tcon(struct cifs_ses *ses, con
 	return NULL;
 }
 
-static void
+void
 cifs_put_tcon(struct cifs_tcon *tcon)
 {
 	unsigned int xid;
@@ -3671,7 +3691,7 @@ mount_fail_check:
 		else if (ses)
 			cifs_put_smb_ses(ses);
 		else
-			cifs_put_tcp_session(server);
+			cifs_put_tcp_session(server, 0);
 		bdi_destroy(&cifs_sb->bdi);
 	}
 
@@ -3976,7 +3996,7 @@ cifs_construct_tcon(struct cifs_sb_info
 	ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info);
 	if (IS_ERR(ses)) {
 		tcon = (struct cifs_tcon *)ses;
-		cifs_put_tcp_session(master_tcon->ses->server);
+		cifs_put_tcp_session(master_tcon->ses->server, 0);
 		goto out;
 	}
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/cifs/smb2file.c linux-libre-3.18.47-gnu/fs/cifs/smb2file.c
--- linux-libre-3.18.46-gnu/fs/cifs/smb2file.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/cifs/smb2file.c	2017-01-18 13:51:20.000000000 -0500
@@ -241,7 +241,7 @@ smb2_push_mandatory_locks(struct cifsFil
 	 * and check it for zero before using.
 	 */
 	max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf;
-	if (!max_buf) {
+	if (max_buf < sizeof(struct smb2_lock_element)) {
 		free_xid(xid);
 		return -EINVAL;
 	}
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/cifs/smb2pdu.c linux-libre-3.18.47-gnu/fs/cifs/smb2pdu.c
--- linux-libre-3.18.46-gnu/fs/cifs/smb2pdu.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/cifs/smb2pdu.c	2017-01-18 13:51:20.000000000 -0500
@@ -264,7 +264,7 @@ out:
 	case SMB2_CHANGE_NOTIFY:
 	case SMB2_QUERY_INFO:
 	case SMB2_SET_INFO:
-		return -EAGAIN;
+		rc = -EAGAIN;
 	}
 	unload_nls(nls_codepage);
 	return rc;
@@ -1612,6 +1612,54 @@ smb2_echo_callback(struct mid_q_entry *m
 	add_credits(server, credits_received, CIFS_ECHO_OP);
 }
 
+void smb2_reconnect_server(struct work_struct *work)
+{
+	struct TCP_Server_Info *server = container_of(work,
+					struct TCP_Server_Info, reconnect.work);
+	struct cifs_ses *ses;
+	struct cifs_tcon *tcon, *tcon2;
+	struct list_head tmp_list;
+	int tcon_exist = false;
+
+	/* Prevent simultaneous reconnects that can corrupt tcon->rlist list */
+	mutex_lock(&server->reconnect_mutex);
+
+	INIT_LIST_HEAD(&tmp_list);
+	cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n");
+
+	spin_lock(&cifs_tcp_ses_lock);
+	list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+		list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+			if (tcon->need_reconnect) {
+				tcon->tc_count++;
+				list_add_tail(&tcon->rlist, &tmp_list);
+				tcon_exist = true;
+			}
+		}
+	}
+	/*
+	 * Get the reference to server struct to be sure that the last call of
+	 * cifs_put_tcon() in the loop below won't release the server pointer.
+	 */
+	if (tcon_exist)
+		server->srv_count++;
+
+	spin_unlock(&cifs_tcp_ses_lock);
+
+	list_for_each_entry_safe(tcon, tcon2, &tmp_list, rlist) {
+		smb2_reconnect(SMB2_ECHO, tcon);
+		list_del_init(&tcon->rlist);
+		cifs_put_tcon(tcon);
+	}
+
+	cifs_dbg(FYI, "Reconnecting tcons finished\n");
+	mutex_unlock(&server->reconnect_mutex);
+
+	/* now we can safely release srv struct */
+	if (tcon_exist)
+		cifs_put_tcp_session(server, 1);
+}
+
 int
 SMB2_echo(struct TCP_Server_Info *server)
 {
@@ -1624,32 +1672,11 @@ SMB2_echo(struct TCP_Server_Info *server
 	cifs_dbg(FYI, "In echo request\n");
 
 	if (server->tcpStatus == CifsNeedNegotiate) {
-		struct list_head *tmp, *tmp2;
-		struct cifs_ses *ses;
-		struct cifs_tcon *tcon;
-
-		cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n");
-		spin_lock(&cifs_tcp_ses_lock);
-		list_for_each(tmp, &server->smb_ses_list) {
-			ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
-			list_for_each(tmp2, &ses->tcon_list) {
-				tcon = list_entry(tmp2, struct cifs_tcon,
-						  tcon_list);
-				/* add check for persistent handle reconnect */
-				if (tcon && tcon->need_reconnect) {
-					spin_unlock(&cifs_tcp_ses_lock);
-					rc = smb2_reconnect(SMB2_ECHO, tcon);
-					spin_lock(&cifs_tcp_ses_lock);
-				}
-			}
-		}
-		spin_unlock(&cifs_tcp_ses_lock);
+		/* No need to send echo on newly established connections */
+		queue_delayed_work(cifsiod_wq, &server->reconnect, 0);
+		return rc;
 	}
 
-	/* if no session, renegotiate failed above */
-	if (server->tcpStatus == CifsNeedNegotiate)
-		return -EIO;
-
 	rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req);
 	if (rc)
 		return rc;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/cifs/smb2proto.h linux-libre-3.18.47-gnu/fs/cifs/smb2proto.h
--- linux-libre-3.18.46-gnu/fs/cifs/smb2proto.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/cifs/smb2proto.h	2017-01-18 13:51:20.000000000 -0500
@@ -95,6 +95,7 @@ extern int smb2_open_file(const unsigned
 extern int smb2_unlock_range(struct cifsFileInfo *cfile,
 			     struct file_lock *flock, const unsigned int xid);
 extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile);
+extern void smb2_reconnect_server(struct work_struct *work);
 
 /*
  * SMB2 Worker functions - most of protocol specific implementation details
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/exec.c linux-libre-3.18.47-gnu/fs/exec.c
--- linux-libre-3.18.46-gnu/fs/exec.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/exec.c	2017-01-18 13:51:20.000000000 -0500
@@ -19,7 +19,7 @@
  * current->executable is only used by the procfs.  This allows a dispatch
  * table to check for several different types  of binary formats.  We keep
  * trying until we recognize the file or we run out of supported binary
- * formats. 
+ * formats.
  */
 
 #include <linux/slab.h>
@@ -1083,6 +1083,13 @@ int flush_old_exec(struct linux_binprm *
 	flush_thread();
 	current->personality &= ~bprm->per_clear;
 
+	/*
+	 * We have to apply CLOEXEC before we change whether the process is
+	 * dumpable (in setup_new_exec) to avoid a race with a process in userspace
+	 * trying to access the should-be-closed file descriptors of a process
+	 * undergoing exec(2).
+	 */
+	do_close_on_exec(current->files);
 	return 0;
 
 out:
@@ -1132,7 +1139,6 @@ void setup_new_exec(struct linux_binprm
 	   group */
 	current->self_exec_id++;
 	flush_signal_handlers(current, 0);
-	do_close_on_exec(current->files);
 }
 EXPORT_SYMBOL(setup_new_exec);
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/ext4/ext4.h linux-libre-3.18.47-gnu/fs/ext4/ext4.h
--- linux-libre-3.18.46-gnu/fs/ext4/ext4.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/ext4/ext4.h	2017-01-18 13:51:20.000000000 -0500
@@ -233,6 +233,7 @@ struct ext4_io_submit {
 #define	EXT4_MAX_BLOCK_SIZE		65536
 #define EXT4_MIN_BLOCK_LOG_SIZE		10
 #define EXT4_MAX_BLOCK_LOG_SIZE		16
+#define EXT4_MAX_CLUSTER_LOG_SIZE	30
 #ifdef __KERNEL__
 # define EXT4_BLOCK_SIZE(s)		((s)->s_blocksize)
 #else
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/ext4/inline.c linux-libre-3.18.47-gnu/fs/ext4/inline.c
--- linux-libre-3.18.46-gnu/fs/ext4/inline.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/ext4/inline.c	2017-01-18 13:51:20.000000000 -0500
@@ -334,8 +334,10 @@ static int ext4_update_inline_data(handl
 
 	len -= EXT4_MIN_INLINE_DATA_SIZE;
 	value = kzalloc(len, GFP_NOFS);
-	if (!value)
+	if (!value) {
+		error = -ENOMEM;
 		goto out;
+	}
 
 	error = ext4_xattr_ibody_get(inode, i.name_index, i.name,
 				     value, len);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/ext4/mballoc.c linux-libre-3.18.47-gnu/fs/ext4/mballoc.c
--- linux-libre-3.18.46-gnu/fs/ext4/mballoc.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/ext4/mballoc.c	2017-01-18 13:51:20.000000000 -0500
@@ -668,7 +668,7 @@ static void ext4_mb_mark_free_simple(str
 	ext4_grpblk_t min;
 	ext4_grpblk_t max;
 	ext4_grpblk_t chunk;
-	unsigned short border;
+	unsigned int border;
 
 	BUG_ON(len > EXT4_CLUSTERS_PER_GROUP(sb));
 
@@ -2254,7 +2254,7 @@ static int ext4_mb_seq_groups_show(struc
 	struct ext4_group_info *grinfo;
 	struct sg {
 		struct ext4_group_info info;
-		ext4_grpblk_t counters[16];
+		ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];
 	} sg;
 
 	group--;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/ext4/super.c linux-libre-3.18.47-gnu/fs/ext4/super.c
--- linux-libre-3.18.46-gnu/fs/ext4/super.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/ext4/super.c	2017-01-18 13:51:20.000000000 -0500
@@ -3325,10 +3325,15 @@ static int count_overhead(struct super_b
 			ext4_set_bit(s++, buf);
 			count++;
 		}
-		for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) {
-			ext4_set_bit(EXT4_B2C(sbi, s++), buf);
-			count++;
+		j = ext4_bg_num_gdb(sb, grp);
+		if (s + j > EXT4_BLOCKS_PER_GROUP(sb)) {
+			ext4_error(sb, "Invalid number of block group "
+				   "descriptor blocks: %d", j);
+			j = EXT4_BLOCKS_PER_GROUP(sb) - s;
 		}
+		count += j;
+		for (; j > 0; j--)
+			ext4_set_bit(EXT4_B2C(sbi, s++), buf);
 	}
 	if (!count)
 		return 0;
@@ -3690,7 +3695,15 @@ static int ext4_fill_super(struct super_
 	if (blocksize < EXT4_MIN_BLOCK_SIZE ||
 	    blocksize > EXT4_MAX_BLOCK_SIZE) {
 		ext4_msg(sb, KERN_ERR,
-		       "Unsupported filesystem blocksize %d", blocksize);
+		       "Unsupported filesystem blocksize %d (%d log_block_size)",
+			 blocksize, le32_to_cpu(es->s_log_block_size));
+		goto failed_mount;
+	}
+	if (le32_to_cpu(es->s_log_block_size) >
+	    (EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {
+		ext4_msg(sb, KERN_ERR,
+			 "Invalid log block size: %u",
+			 le32_to_cpu(es->s_log_block_size));
 		goto failed_mount;
 	}
 
@@ -3766,12 +3779,16 @@ static int ext4_fill_super(struct super_
 
 	sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
 	sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
-	if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0)
-		goto cantfind_ext4;
 
 	sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);
 	if (sbi->s_inodes_per_block == 0)
 		goto cantfind_ext4;
+	if (sbi->s_inodes_per_group < sbi->s_inodes_per_block ||
+	    sbi->s_inodes_per_group > blocksize * 8) {
+		ext4_msg(sb, KERN_ERR, "invalid inodes per group: %lu\n",
+			 sbi->s_blocks_per_group);
+		goto failed_mount;
+	}
 	sbi->s_itb_per_group = sbi->s_inodes_per_group /
 					sbi->s_inodes_per_block;
 	sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
@@ -3812,6 +3829,13 @@ static int ext4_fill_super(struct super_
 				 "block size (%d)", clustersize, blocksize);
 			goto failed_mount;
 		}
+		if (le32_to_cpu(es->s_log_cluster_size) >
+		    (EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE)) {
+			ext4_msg(sb, KERN_ERR,
+				 "Invalid log cluster size: %u",
+				 le32_to_cpu(es->s_log_cluster_size));
+			goto failed_mount;
+		}
 		sbi->s_cluster_bits = le32_to_cpu(es->s_log_cluster_size) -
 			le32_to_cpu(es->s_log_block_size);
 		sbi->s_clusters_per_group =
@@ -3848,13 +3872,6 @@ static int ext4_fill_super(struct super_
 	}
 	sbi->s_cluster_ratio = clustersize / blocksize;
 
-	if (sbi->s_inodes_per_group > blocksize * 8) {
-		ext4_msg(sb, KERN_ERR,
-		       "#inodes per group too big: %lu",
-		       sbi->s_inodes_per_group);
-		goto failed_mount;
-	}
-
 	/* Do we have standard group size of clustersize * 8 blocks ? */
 	if (sbi->s_blocks_per_group == clustersize << 3)
 		set_opt2(sb, STD_GROUP_SIZE);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/f2fs/debug.c linux-libre-3.18.47-gnu/fs/f2fs/debug.c
--- linux-libre-3.18.46-gnu/fs/f2fs/debug.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/f2fs/debug.c	2017-01-18 13:51:20.000000000 -0500
@@ -295,6 +295,7 @@ static int stat_open(struct inode *inode
 }
 
 static const struct file_operations stat_fops = {
+	.owner = THIS_MODULE,
 	.open = stat_open,
 	.read = seq_read,
 	.llseek = seq_lseek,
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/nfs/file.c linux-libre-3.18.47-gnu/fs/nfs/file.c
--- linux-libre-3.18.46-gnu/fs/nfs/file.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/nfs/file.c	2017-01-18 13:51:20.000000000 -0500
@@ -410,7 +410,7 @@ static int nfs_write_end(struct file *fi
 	 */
 	if (!PageUptodate(page)) {
 		unsigned pglen = nfs_page_length(page);
-		unsigned end = offset + len;
+		unsigned end = offset + copied;
 
 		if (pglen == 0) {
 			zero_user_segments(page, 0, offset,
diff -druNp --no-dereference linux-libre-3.18.46-gnu/fs/xfs/xfs_log_recover.c linux-libre-3.18.47-gnu/fs/xfs/xfs_log_recover.c
--- linux-libre-3.18.46-gnu/fs/xfs/xfs_log_recover.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/fs/xfs/xfs_log_recover.c	2017-01-18 13:51:20.000000000 -0500
@@ -3861,6 +3861,7 @@ xlog_recover_clear_agi_bucket(
 	agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		 (sizeof(xfs_agino_t) * bucket);
+	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/include/linux/netdevice.h linux-libre-3.18.47-gnu/include/linux/netdevice.h
--- linux-libre-3.18.46-gnu/include/linux/netdevice.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/include/linux/netdevice.h	2017-01-18 13:51:20.000000000 -0500
@@ -1888,22 +1888,17 @@ struct napi_gro_cb {
 	/* Number of segments aggregated. */
 	u16	count;
 
-	/* This is non-zero if the packet may be of the same flow. */
-	u8	same_flow;
-
-	/* Free the skb? */
-	u8	free;
-#define NAPI_GRO_FREE		  1
-#define NAPI_GRO_FREE_STOLEN_HEAD 2
-
 	/* jiffies when first packet was created/queued */
 	unsigned long age;
 
 	/* Used in ipv6_gro_receive() and foo-over-udp */
 	u16	proto;
 
-	/* Used in udp_gro_receive */
-	u8	udp_mark:1;
+	/* This is non-zero if the packet may be of the same flow. */
+	u8	same_flow:1;
+
+	/* Used in tunnel GRO receive */
+	u8	encap_mark:1;
 
 	/* GRO checksum is valid */
 	u8	csum_valid:1;
@@ -1911,9 +1906,16 @@ struct napi_gro_cb {
 	/* Number of checksums via CHECKSUM_UNNECESSARY */
 	u8	csum_cnt:3;
 
+	/* Free the skb? */
+	u8	free:2;
+#define NAPI_GRO_FREE		  1
+#define NAPI_GRO_FREE_STOLEN_HEAD 2
+
 	/* Used in foo-over-udp, set in udp[46]_gro_receive */
 	u8	is_ipv6:1;
 
+	/* 7 bit hole */
+
 	/* used to support CHECKSUM_COMPLETE for tunneling protocols */
 	__wsum	csum;
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/include/net/ip.h linux-libre-3.18.47-gnu/include/net/ip.h
--- linux-libre-3.18.46-gnu/include/net/ip.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/include/net/ip.h	2017-01-18 13:51:20.000000000 -0500
@@ -233,6 +233,8 @@ static inline int inet_is_local_reserved
 }
 #endif
 
+__be32 inet_current_timestamp(void);
+
 /* From inetpeer.c */
 extern int inet_peer_threshold;
 extern int inet_peer_minttl;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/include/rdma/ib_addr.h linux-libre-3.18.47-gnu/include/rdma/ib_addr.h
--- linux-libre-3.18.46-gnu/include/rdma/ib_addr.h	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/include/rdma/ib_addr.h	2017-01-18 13:51:20.000000000 -0500
@@ -184,10 +184,12 @@ static inline void iboe_addr_get_sgid(st
 
 	dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if);
 	if (dev) {
-		ip4 = (struct in_device *)dev->ip_ptr;
-		if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address)
+		ip4 = in_dev_get(dev);
+		if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) {
 			ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address,
 					       (struct in6_addr *)gid);
+			in_dev_put(ip4);
+		}
 		dev_put(dev);
 	}
 }
diff -druNp --no-dereference linux-libre-3.18.46-gnu/kernel/trace/trace_functions_graph.c linux-libre-3.18.47-gnu/kernel/trace/trace_functions_graph.c
--- linux-libre-3.18.46-gnu/kernel/trace/trace_functions_graph.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/kernel/trace/trace_functions_graph.c	2017-01-18 13:51:20.000000000 -0500
@@ -877,6 +877,10 @@ print_graph_entry_leaf(struct trace_iter
 
 		cpu_data = per_cpu_ptr(data->cpu_data, cpu);
 
+		/* If a graph tracer ignored set_graph_notrace */
+		if (call->depth < -1)
+			call->depth += FTRACE_NOTRACE_DEPTH;
+
 		/*
 		 * Comments display at + 1 to depth. Since
 		 * this is a leaf function, keep the comments
@@ -885,7 +889,8 @@ print_graph_entry_leaf(struct trace_iter
 		cpu_data->depth = call->depth - 1;
 
 		/* No need to keep this function around for this depth */
-		if (call->depth < FTRACE_RETFUNC_DEPTH)
+		if (call->depth < FTRACE_RETFUNC_DEPTH &&
+		    !WARN_ON_ONCE(call->depth < 0))
 			cpu_data->enter_funcs[call->depth] = 0;
 	}
 
@@ -922,11 +927,16 @@ print_graph_entry_nested(struct trace_it
 		struct fgraph_cpu_data *cpu_data;
 		int cpu = iter->cpu;
 
+		/* If a graph tracer ignored set_graph_notrace */
+		if (call->depth < -1)
+			call->depth += FTRACE_NOTRACE_DEPTH;
+
 		cpu_data = per_cpu_ptr(data->cpu_data, cpu);
 		cpu_data->depth = call->depth;
 
 		/* Save this function pointer to see if the exit matches */
-		if (call->depth < FTRACE_RETFUNC_DEPTH)
+		if (call->depth < FTRACE_RETFUNC_DEPTH &&
+		    !WARN_ON_ONCE(call->depth < 0))
 			cpu_data->enter_funcs[call->depth] = call->func;
 	}
 
@@ -1179,7 +1189,8 @@ print_graph_return(struct ftrace_graph_r
 		 */
 		cpu_data->depth = trace->depth - 1;
 
-		if (trace->depth < FTRACE_RETFUNC_DEPTH) {
+		if (trace->depth < FTRACE_RETFUNC_DEPTH &&
+		    !WARN_ON_ONCE(trace->depth < 0)) {
 			if (cpu_data->enter_funcs[trace->depth] != trace->func)
 				func_match = 0;
 			cpu_data->enter_funcs[trace->depth] = 0;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/Makefile linux-libre-3.18.47-gnu/Makefile
--- linux-libre-3.18.46-gnu/Makefile	2016-12-27 16:27:13.000000000 -0500
+++ linux-libre-3.18.47-gnu/Makefile	2017-01-18 22:03:29.000000000 -0500
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 18
-SUBLEVEL = 46
+SUBLEVEL = 47
 EXTRAVERSION =-gnu
 NAME = Diseased Newt
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ceph/messenger.c linux-libre-3.18.47-gnu/net/ceph/messenger.c
--- linux-libre-3.18.46-gnu/net/ceph/messenger.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ceph/messenger.c	2017-01-18 13:51:20.000000000 -0500
@@ -1979,6 +1979,19 @@ static int process_connect(struct ceph_c
 
 	dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
 
+	if (con->auth_reply_buf) {
+		/*
+		 * Any connection that defines ->get_authorizer()
+		 * should also define ->verify_authorizer_reply().
+		 * See get_connect_authorizer().
+		 */
+		ret = con->ops->verify_authorizer_reply(con, 0);
+		if (ret < 0) {
+			con->error_msg = "bad authorize reply";
+			return ret;
+		}
+	}
+
 	switch (con->in_reply.tag) {
 	case CEPH_MSGR_TAG_FEATURES:
 		pr_err("%s%lld %s feature set mismatch,"
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/core/dev.c linux-libre-3.18.47-gnu/net/core/dev.c
--- linux-libre-3.18.46-gnu/net/core/dev.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/core/dev.c	2017-01-18 13:51:20.000000000 -0500
@@ -4020,7 +4020,7 @@ static enum gro_result dev_gro_receive(s
 		NAPI_GRO_CB(skb)->same_flow = 0;
 		NAPI_GRO_CB(skb)->flush = 0;
 		NAPI_GRO_CB(skb)->free = 0;
-		NAPI_GRO_CB(skb)->udp_mark = 0;
+		NAPI_GRO_CB(skb)->encap_mark = 0;
 
 		/* Setup for GRO checksum validation */
 		switch (skb->ip_summed) {
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv4/af_inet.c linux-libre-3.18.47-gnu/net/ipv4/af_inet.c
--- linux-libre-3.18.46-gnu/net/ipv4/af_inet.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv4/af_inet.c	2017-01-18 13:51:20.000000000 -0500
@@ -1391,6 +1391,45 @@ out:
 	return pp;
 }
 
+static struct sk_buff **ipip_gro_receive(struct sk_buff **head,
+					 struct sk_buff *skb)
+{
+	if (NAPI_GRO_CB(skb)->encap_mark) {
+		NAPI_GRO_CB(skb)->flush = 1;
+		return NULL;
+	}
+
+	NAPI_GRO_CB(skb)->encap_mark = 1;
+
+	return inet_gro_receive(head, skb);
+}
+
+#define SECONDS_PER_DAY	86400
+
+/* inet_current_timestamp - Return IP network timestamp
+ *
+ * Return milliseconds since midnight in network byte order.
+ */
+__be32 inet_current_timestamp(void)
+{
+	u32 secs;
+	u32 msecs;
+	struct timespec64 ts;
+
+	ktime_get_real_ts64(&ts);
+
+	/* Get secs since midnight. */
+	(void)div_u64_rem(ts.tv_sec, SECONDS_PER_DAY, &secs);
+	/* Convert to msecs. */
+	msecs = secs * MSEC_PER_SEC;
+	/* Convert nsec to msec. */
+	msecs += (u32)ts.tv_nsec / NSEC_PER_MSEC;
+
+	/* Convert to network byte order. */
+	return htons(msecs);
+}
+EXPORT_SYMBOL(inet_current_timestamp);
+
 int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
 {
 	if (sk->sk_family == AF_INET)
@@ -1433,6 +1472,13 @@ out_unlock:
 	return err;
 }
 
+static int ipip_gro_complete(struct sk_buff *skb, int nhoff)
+{
+	skb->encapsulation = 1;
+	skb_shinfo(skb)->gso_type |= SKB_GSO_IPIP;
+	return inet_gro_complete(skb, nhoff);
+}
+
 int inet_ctl_sock_create(struct sock **sk, unsigned short family,
 			 unsigned short type, unsigned char protocol,
 			 struct net *net)
@@ -1649,8 +1695,8 @@ static struct packet_offload ip_packet_o
 static const struct net_offload ipip_offload = {
 	.callbacks = {
 		.gso_segment	= inet_gso_segment,
-		.gro_receive	= inet_gro_receive,
-		.gro_complete	= inet_gro_complete,
+		.gro_receive	= ipip_gro_receive,
+		.gro_complete	= ipip_gro_complete,
 	},
 };
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv4/fou.c linux-libre-3.18.47-gnu/net/ipv4/fou.c
--- linux-libre-3.18.46-gnu/net/ipv4/fou.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv4/fou.c	2017-01-18 13:51:20.000000000 -0500
@@ -113,6 +113,14 @@ static struct sk_buff **fou_gro_receive(
 	u8 proto = NAPI_GRO_CB(skb)->proto;
 	const struct net_offload **offloads;
 
+	/* We can clear the encap_mark for FOU as we are essentially doing
+	 * one of two possible things.  We are either adding an L4 tunnel
+	 * header to the outer L3 tunnel header, or we are are simply
+	 * treating the GRE tunnel header as though it is a UDP protocol
+	 * specific header such as VXLAN or GENEVE.
+	 */
+	NAPI_GRO_CB(skb)->encap_mark = 0;
+
 	rcu_read_lock();
 	offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads;
 	ops = rcu_dereference(offloads[proto]);
@@ -217,6 +225,14 @@ static struct sk_buff **gue_gro_receive(
 
 	skb_gro_pull(skb, guehlen);
 
+	/* We can clear the encap_mark for GUE as we are essentially doing
+	 * one of two possible things.  We are either adding an L4 tunnel
+	 * header to the outer L3 tunnel header, or we are are simply
+	 * treating the GRE tunnel header as though it is a UDP protocol
+	 * specific header such as VXLAN or GENEVE.
+	 */
+	NAPI_GRO_CB(skb)->encap_mark = 0;
+
 	/* Adjusted NAPI_GRO_CB(skb)->csum after skb_gro_pull()*/
 	skb_gro_postpull_rcsum(skb, guehdr, guehlen);
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv4/gre_offload.c linux-libre-3.18.47-gnu/net/ipv4/gre_offload.c
--- linux-libre-3.18.46-gnu/net/ipv4/gre_offload.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv4/gre_offload.c	2017-01-18 13:51:20.000000000 -0500
@@ -128,6 +128,11 @@ static struct sk_buff **gre_gro_receive(
 	struct packet_offload *ptype;
 	__be16 type;
 
+	if (NAPI_GRO_CB(skb)->encap_mark)
+		goto out;
+
+	NAPI_GRO_CB(skb)->encap_mark = 1;
+
 	off = skb_gro_offset(skb);
 	hlen = off + sizeof(*greh);
 	greh = skb_gro_header_fast(skb, off);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv4/icmp.c linux-libre-3.18.47-gnu/net/ipv4/icmp.c
--- linux-libre-3.18.46-gnu/net/ipv4/icmp.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv4/icmp.c	2017-01-18 13:51:20.000000000 -0500
@@ -902,7 +902,6 @@ static void icmp_echo(struct sk_buff *sk
  */
 static void icmp_timestamp(struct sk_buff *skb)
 {
-	struct timespec tv;
 	struct icmp_bxm icmp_param;
 	/*
 	 *	Too short.
@@ -913,9 +912,7 @@ static void icmp_timestamp(struct sk_buf
 	/*
 	 *	Fill in the current time as ms since midnight UT:
 	 */
-	getnstimeofday(&tv);
-	icmp_param.data.times[1] = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC +
-					 tv.tv_nsec / NSEC_PER_MSEC);
+	icmp_param.data.times[1] = inet_current_timestamp();
 	icmp_param.data.times[2] = icmp_param.data.times[1];
 	if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
 		BUG();
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv4/ip_options.c linux-libre-3.18.47-gnu/net/ipv4/ip_options.c
--- linux-libre-3.18.46-gnu/net/ipv4/ip_options.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv4/ip_options.c	2017-01-18 13:51:20.000000000 -0500
@@ -58,10 +58,9 @@ void ip_options_build(struct sk_buff *sk
 		if (opt->ts_needaddr)
 			ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt);
 		if (opt->ts_needtime) {
-			struct timespec tv;
 			__be32 midtime;
-			getnstimeofday(&tv);
-			midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC);
+
+			midtime = inet_current_timestamp();
 			memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4);
 		}
 		return;
@@ -415,11 +414,10 @@ int ip_options_compile(struct net *net,
 					break;
 				}
 				if (timeptr) {
-					struct timespec tv;
-					u32  midtime;
-					getnstimeofday(&tv);
-					midtime = (tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC;
-					put_unaligned_be32(midtime, timeptr);
+					__be32 midtime;
+
+					midtime = inet_current_timestamp();
+					memcpy(timeptr, &midtime, 4);
 					opt->is_changed = 1;
 				}
 			} else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) {
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv4/udp_offload.c linux-libre-3.18.47-gnu/net/ipv4/udp_offload.c
--- linux-libre-3.18.46-gnu/net/ipv4/udp_offload.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv4/udp_offload.c	2017-01-18 13:51:20.000000000 -0500
@@ -266,14 +266,14 @@ struct sk_buff **udp_gro_receive(struct
 	unsigned int off = skb_gro_offset(skb);
 	int flush = 1;
 
-	if (NAPI_GRO_CB(skb)->udp_mark ||
+	if (NAPI_GRO_CB(skb)->encap_mark ||
 	    (skb->ip_summed != CHECKSUM_PARTIAL &&
 	     NAPI_GRO_CB(skb)->csum_cnt == 0 &&
 	     !NAPI_GRO_CB(skb)->csum_valid))
 		goto out;
 
-	/* mark that this skb passed once through the udp gro layer */
-	NAPI_GRO_CB(skb)->udp_mark = 1;
+	/* mark that this skb passed once through the tunnel gro layer */
+	NAPI_GRO_CB(skb)->encap_mark = 1;
 
 	rcu_read_lock();
 	uo_priv = rcu_dereference(udp_offload_base);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/ipv6/ip6_offload.c linux-libre-3.18.47-gnu/net/ipv6/ip6_offload.c
--- linux-libre-3.18.46-gnu/net/ipv6/ip6_offload.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/ipv6/ip6_offload.c	2017-01-18 13:51:20.000000000 -0500
@@ -258,6 +258,19 @@ out:
 	return pp;
 }
 
+static struct sk_buff **sit_gro_receive(struct sk_buff **head,
+					struct sk_buff *skb)
+{
+	if (NAPI_GRO_CB(skb)->encap_mark) {
+		NAPI_GRO_CB(skb)->flush = 1;
+		return NULL;
+	}
+
+	NAPI_GRO_CB(skb)->encap_mark = 1;
+
+	return ipv6_gro_receive(head, skb);
+}
+
 static int ipv6_gro_complete(struct sk_buff *skb, int nhoff)
 {
 	const struct net_offload *ops;
diff -druNp --no-dereference linux-libre-3.18.46-gnu/net/sunrpc/auth_gss/auth_gss.c linux-libre-3.18.47-gnu/net/sunrpc/auth_gss/auth_gss.c
--- linux-libre-3.18.46-gnu/net/sunrpc/auth_gss/auth_gss.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/net/sunrpc/auth_gss/auth_gss.c	2017-01-18 13:51:20.000000000 -0500
@@ -539,9 +539,13 @@ gss_setup_upcall(struct gss_auth *gss_au
 		return gss_new;
 	gss_msg = gss_add_msg(gss_new);
 	if (gss_msg == gss_new) {
-		int res = rpc_queue_upcall(gss_new->pipe, &gss_new->msg);
+		int res;
+		atomic_inc(&gss_msg->count);
+		res = rpc_queue_upcall(gss_new->pipe, &gss_new->msg);
 		if (res) {
 			gss_unhash_msg(gss_new);
+			atomic_dec(&gss_msg->count);
+			gss_release_msg(gss_new);
 			gss_msg = ERR_PTR(res);
 		}
 	} else
@@ -834,6 +838,7 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg
 			warn_gssd();
 		gss_release_msg(gss_msg);
 	}
+	gss_release_msg(gss_msg);
 }
 
 static void gss_pipe_dentry_destroy(struct dentry *dir,
diff -druNp --no-dereference linux-libre-3.18.46-gnu/scripts/kconfig/nconf.gui.c linux-libre-3.18.47-gnu/scripts/kconfig/nconf.gui.c
--- linux-libre-3.18.46-gnu/scripts/kconfig/nconf.gui.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/scripts/kconfig/nconf.gui.c	2017-01-18 13:51:20.000000000 -0500
@@ -364,12 +364,14 @@ int dialog_inputbox(WINDOW *main_window,
 	WINDOW *prompt_win;
 	WINDOW *form_win;
 	PANEL *panel;
-	int i, x, y;
+	int i, x, y, lines, columns, win_lines, win_cols;
 	int res = -1;
 	int cursor_position = strlen(init);
 	int cursor_form_win;
 	char *result = *resultp;
 
+	getmaxyx(stdscr, lines, columns);
+
 	if (strlen(init)+1 > *result_len) {
 		*result_len = strlen(init)+1;
 		*resultp = result = realloc(result, *result_len);
@@ -386,14 +388,19 @@ int dialog_inputbox(WINDOW *main_window,
 	if (title)
 		prompt_width = max(prompt_width, strlen(title));
 
+	win_lines = min(prompt_lines+6, lines-2);
+	win_cols = min(prompt_width+7, columns-2);
+	prompt_lines = max(win_lines-6, 0);
+	prompt_width = max(win_cols-7, 0);
+
 	/* place dialog in middle of screen */
-	y = (getmaxy(stdscr)-(prompt_lines+4))/2;
-	x = (getmaxx(stdscr)-(prompt_width+4))/2;
+	y = (lines-win_lines)/2;
+	x = (columns-win_cols)/2;
 
 	strncpy(result, init, *result_len);
 
 	/* create the windows */
-	win = newwin(prompt_lines+6, prompt_width+7, y, x);
+	win = newwin(win_lines, win_cols, y, x);
 	prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
 	form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
 	keypad(form_win, TRUE);
diff -druNp --no-dereference linux-libre-3.18.46-gnu/sound/pci/hda/patch_realtek.c linux-libre-3.18.47-gnu/sound/pci/hda/patch_realtek.c
--- linux-libre-3.18.46-gnu/sound/pci/hda/patch_realtek.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/sound/pci/hda/patch_realtek.c	2017-01-18 13:51:20.000000000 -0500
@@ -5712,6 +5712,9 @@ static const struct snd_hda_pin_quirk al
 		{0x12, 0x90a60180},
 		{0x14, 0x90170120},
 		{0x21, 0x02211030}),
+	SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
+		{0x1b, 0x01011020},
+		{0x21, 0x02211010}),
 	SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
 		ALC256_STANDARD_PINS,
 		{0x13, 0x40000000}),
diff -druNp --no-dereference linux-libre-3.18.46-gnu/sound/usb/hiface/pcm.c linux-libre-3.18.47-gnu/sound/usb/hiface/pcm.c
--- linux-libre-3.18.46-gnu/sound/usb/hiface/pcm.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/sound/usb/hiface/pcm.c	2017-01-18 13:51:20.000000000 -0500
@@ -445,6 +445,8 @@ static int hiface_pcm_prepare(struct snd
 
 	mutex_lock(&rt->stream_mutex);
 
+	hiface_pcm_stream_stop(rt);
+
 	sub->dma_off = 0;
 	sub->period_off = 0;
 
diff -druNp --no-dereference linux-libre-3.18.46-gnu/sound/usb/mixer.c linux-libre-3.18.47-gnu/sound/usb/mixer.c
--- linux-libre-3.18.46-gnu/sound/usb/mixer.c	2016-12-24 11:10:18.000000000 -0500
+++ linux-libre-3.18.47-gnu/sound/usb/mixer.c	2017-01-18 13:51:20.000000000 -0500
@@ -916,9 +916,10 @@ static void volume_control_quirks(struct
 	case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */
 	case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */
 	case USB_ID(0x046d, 0x0991):
+	case USB_ID(0x046d, 0x09a2): /* QuickCam Communicate Deluxe/S7500 */
 	/* Most audio usb devices lie about volume resolution.
 	 * Most Logitech webcams have res = 384.
-	 * Proboly there is some logitech magic behind this number --fishor
+	 * Probably there is some logitech magic behind this number --fishor
 	 */
 		if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
 			usb_audio_info(chip,
