diff -druNp --no-dereference linux-libre-3.14.38-gnu/arch/arc/kernel/signal.c linux-libre-3.14.39-gnu/arch/arc/kernel/signal.c
--- linux-libre-3.14.38-gnu/arch/arc/kernel/signal.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/arch/arc/kernel/signal.c	2015-04-19 04:11:58.000000000 -0400
@@ -67,7 +67,7 @@ stash_usr_regs(struct rt_sigframe __user
 	       sigset_t *set)
 {
 	int err;
-	err = __copy_to_user(&(sf->uc.uc_mcontext.regs), regs,
+	err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), regs,
 			     sizeof(sf->uc.uc_mcontext.regs.scratch));
 	err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
 
@@ -83,7 +83,7 @@ static int restore_usr_regs(struct pt_re
 	if (!err)
 		set_current_blocked(&set);
 
-	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs),
+	err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch),
 				sizeof(sf->uc.uc_mcontext.regs.scratch));
 
 	return err;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/arch/x86/kernel/reboot.c linux-libre-3.14.39-gnu/arch/x86/kernel/reboot.c
--- linux-libre-3.14.38-gnu/arch/x86/kernel/reboot.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/arch/x86/kernel/reboot.c	2015-04-19 04:11:58.000000000 -0400
@@ -181,6 +181,16 @@ static struct dmi_system_id __initdata r
 		},
 	},
 
+	/* ASRock */
+	{	/* Handle problems with rebooting on ASRock Q1900DC-ITX */
+		.callback = set_pci_reboot,
+		.ident = "ASRock Q1900DC-ITX",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"),
+			DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"),
+		},
+	},
+
 	/* ASUS */
 	{	/* Handle problems with rebooting on ASUS P4S800 */
 		.callback = set_bios_reboot,
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/acpi/processor_idle.c linux-libre-3.14.39-gnu/drivers/acpi/processor_idle.c
--- linux-libre-3.14.38-gnu/drivers/acpi/processor_idle.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/acpi/processor_idle.c	2015-04-19 04:11:58.000000000 -0400
@@ -962,7 +962,7 @@ static int acpi_processor_setup_cpuidle_
 		return -EINVAL;
 
 	drv->safe_state_index = -1;
-	for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
+	for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) {
 		drv->states[i].name[0] = '\0';
 		drv->states[i].desc[0] = '\0';
 	}
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/block/nbd.c linux-libre-3.14.39-gnu/drivers/block/nbd.c
--- linux-libre-3.14.38-gnu/drivers/block/nbd.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/block/nbd.c	2015-04-19 04:11:58.000000000 -0400
@@ -814,10 +814,6 @@ static int __init nbd_init(void)
 		return -EINVAL;
 	}
 
-	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
-	if (!nbd_dev)
-		return -ENOMEM;
-
 	part_shift = 0;
 	if (max_part > 0) {
 		part_shift = fls(max_part);
@@ -839,6 +835,10 @@ static int __init nbd_init(void)
 	if (nbds_max > 1UL << (MINORBITS - part_shift))
 		return -EINVAL;
 
+	nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
+	if (!nbd_dev)
+		return -ENOMEM;
+
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = alloc_disk(1 << part_shift);
 		if (!disk)
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/cpuidle/cpuidle.c linux-libre-3.14.39-gnu/drivers/cpuidle/cpuidle.c
--- linux-libre-3.14.38-gnu/drivers/cpuidle/cpuidle.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/cpuidle/cpuidle.c	2015-04-19 04:11:58.000000000 -0400
@@ -252,9 +252,6 @@ int cpuidle_enable_device(struct cpuidle
 	if (!dev->registered)
 		return -EINVAL;
 
-	if (!dev->state_count)
-		dev->state_count = drv->state_count;
-
 	ret = cpuidle_add_device_sysfs(dev);
 	if (ret)
 		return ret;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/cpuidle/sysfs.c linux-libre-3.14.39-gnu/drivers/cpuidle/sysfs.c
--- linux-libre-3.14.38-gnu/drivers/cpuidle/sysfs.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/cpuidle/sysfs.c	2015-04-19 04:11:58.000000000 -0400
@@ -398,7 +398,7 @@ static int cpuidle_add_state_sysfs(struc
 	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
 
 	/* state statistics */
-	for (i = 0; i < device->state_count; i++) {
+	for (i = 0; i < drv->state_count; i++) {
 		kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);
 		if (!kobj)
 			goto error_state;
@@ -430,9 +430,10 @@ error_state:
  */
 static void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
 {
+	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
 	int i;
 
-	for (i = 0; i < device->state_count; i++)
+	for (i = 0; i < drv->state_count; i++)
 		cpuidle_free_state_kobj(device, i);
 }
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/dma/omap-dma.c linux-libre-3.14.39-gnu/drivers/dma/omap-dma.c
--- linux-libre-3.14.38-gnu/drivers/dma/omap-dma.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/dma/omap-dma.c	2015-04-19 04:11:58.000000000 -0400
@@ -487,6 +487,7 @@ static int omap_dma_terminate_all(struct
 	 * c->desc is NULL and exit.)
 	 */
 	if (c->desc) {
+		omap_dma_desc_free(&c->desc->vd);
 		c->desc = NULL;
 		/* Avoid stopping the dma twice */
 		if (!c->paused)
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/gpu/drm/radeon/radeon_bios.c linux-libre-3.14.39-gnu/drivers/gpu/drm/radeon/radeon_bios.c
--- linux-libre-3.14.38-gnu/drivers/gpu/drm/radeon/radeon_bios.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/gpu/drm/radeon/radeon_bios.c	2015-04-19 04:11:58.000000000 -0400
@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(stru
 
 static bool radeon_read_bios(struct radeon_device *rdev)
 {
-	uint8_t __iomem *bios;
+	uint8_t __iomem *bios, val1, val2;
 	size_t size;
 
 	rdev->bios = NULL;
@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct rade
 		return false;
 	}
 
-	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+	val1 = readb(&bios[0]);
+	val2 = readb(&bios[1]);
+
+	if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
-	rdev->bios = kmemdup(bios, size, GFP_KERNEL);
+	rdev->bios = kzalloc(size, GFP_KERNEL);
 	if (rdev->bios == NULL) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
+	memcpy_fromio(rdev->bios, bios, size);
 	pci_unmap_rom(rdev->pdev, bios);
 	return true;
 }
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/iio/imu/adis_trigger.c linux-libre-3.14.39-gnu/drivers/iio/imu/adis_trigger.c
--- linux-libre-3.14.38-gnu/drivers/iio/imu/adis_trigger.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/iio/imu/adis_trigger.c	2015-04-19 04:11:58.000000000 -0400
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis
 	iio_trigger_set_drvdata(adis->trig, adis);
 	ret = iio_trigger_register(adis->trig);
 
-	indio_dev->trig = adis->trig;
+	indio_dev->trig = iio_trigger_get(adis->trig);
 	if (ret)
 		goto error_free_irq;
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c linux-libre-3.14.39-gnu/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
--- linux-libre-3.14.38-gnu/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c	2015-04-19 04:11:58.000000000 -0400
@@ -25,6 +25,16 @@
 #include <linux/poll.h>
 #include "inv_mpu_iio.h"
 
+static void inv_clear_kfifo(struct inv_mpu6050_state *st)
+{
+	unsigned long flags;
+
+	/* take the spin lock sem to avoid interrupt kick in */
+	spin_lock_irqsave(&st->time_stamp_lock, flags);
+	kfifo_reset(&st->timestamps);
+	spin_unlock_irqrestore(&st->time_stamp_lock, flags);
+}
+
 int inv_reset_fifo(struct iio_dev *indio_dev)
 {
 	int result;
@@ -51,6 +61,10 @@ int inv_reset_fifo(struct iio_dev *indio
 					INV_MPU6050_BIT_FIFO_RST);
 	if (result)
 		goto reset_fifo_fail;
+
+	/* clear timestamps fifo */
+	inv_clear_kfifo(st);
+
 	/* enable interrupt */
 	if (st->chip_config.accl_fifo_enable ||
 	    st->chip_config.gyro_fifo_enable) {
@@ -84,16 +98,6 @@ reset_fifo_fail:
 	return result;
 }
 
-static void inv_clear_kfifo(struct inv_mpu6050_state *st)
-{
-	unsigned long flags;
-
-	/* take the spin lock sem to avoid interrupt kick in */
-	spin_lock_irqsave(&st->time_stamp_lock, flags);
-	kfifo_reset(&st->timestamps);
-	spin_unlock_irqrestore(&st->time_stamp_lock, flags);
-}
-
 /**
  * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt.
  */
@@ -185,7 +189,6 @@ end_session:
 flush_fifo:
 	/* Flush HW and SW FIFOs. */
 	inv_reset_fifo(indio_dev);
-	inv_clear_kfifo(st);
 	mutex_unlock(&indio_dev->mlock);
 	iio_trigger_notify_done(indio_dev->trig);
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/infiniband/core/umem.c linux-libre-3.14.39-gnu/drivers/infiniband/core/umem.c
--- linux-libre-3.14.38-gnu/drivers/infiniband/core/umem.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/infiniband/core/umem.c	2015-04-19 04:11:58.000000000 -0400
@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_uc
 	if (dmasync)
 		dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
 
+	/*
+	 * If the combination of the addr and size requested for this memory
+	 * region causes an integer overflow, return error.
+	 */
+	if ((PAGE_ALIGN(addr + size) <= size) ||
+	    (PAGE_ALIGN(addr + size) <= addr))
+		return ERR_PTR(-EINVAL);
+
 	if (!can_do_mlock())
 		return ERR_PTR(-EPERM);
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/infiniband/core/uverbs_main.c linux-libre-3.14.39-gnu/drivers/infiniband/core/uverbs_main.c
--- linux-libre-3.14.38-gnu/drivers/infiniband/core/uverbs_main.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/infiniband/core/uverbs_main.c	2015-04-19 04:11:58.000000000 -0400
@@ -476,6 +476,7 @@ static void ib_uverbs_async_handler(stru
 
 	entry->desc.async.element    = element;
 	entry->desc.async.event_type = event;
+	entry->desc.async.reserved   = 0;
 	entry->counter               = counter;
 
 	list_add_tail(&entry->list, &file->async_file->event_list);
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/infiniband/hw/mlx4/mad.c linux-libre-3.14.39-gnu/drivers/infiniband/hw/mlx4/mad.c
--- linux-libre-3.14.38-gnu/drivers/infiniband/hw/mlx4/mad.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/infiniband/hw/mlx4/mad.c	2015-04-19 04:11:58.000000000 -0400
@@ -64,6 +64,14 @@ enum {
 #define GUID_TBL_BLK_NUM_ENTRIES 8
 #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES)
 
+/* Counters should be saturate once they reach their maximum value */
+#define ASSIGN_32BIT_COUNTER(counter, value) do {\
+	if ((value) > U32_MAX)			 \
+		counter = cpu_to_be32(U32_MAX); \
+	else					 \
+		counter = cpu_to_be32(value);	 \
+} while (0)
+
 struct mlx4_mad_rcv_buf {
 	struct ib_grh grh;
 	u8 payload[256];
@@ -730,10 +738,14 @@ static int ib_process_mad(struct ib_devi
 static void edit_counter(struct mlx4_counter *cnt,
 					struct ib_pma_portcounters *pma_cnt)
 {
-	pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2));
-	pma_cnt->port_rcv_data  = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2));
-	pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames));
-	pma_cnt->port_rcv_packets  = cpu_to_be32(be64_to_cpu(cnt->rx_frames));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data,
+			     (be64_to_cpu(cnt->tx_bytes) >> 2));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data,
+			     (be64_to_cpu(cnt->rx_bytes) >> 2));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets,
+			     be64_to_cpu(cnt->tx_frames));
+	ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets,
+			     be64_to_cpu(cnt->rx_frames));
 }
 
 static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/media/platform/s5p-mfc/s5p_mfc_common.h linux-libre-3.14.39-gnu/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
--- linux-libre-3.14.38-gnu/drivers/media/platform/s5p-mfc/s5p_mfc_common.h	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/media/platform/s5p-mfc/s5p_mfc_common.h	2015-04-19 04:11:58.000000000 -0400
@@ -30,7 +30,7 @@
 
 /* Offset base used to differentiate between CAPTURE and OUTPUT
 *  while mmaping */
-#define DST_QUEUE_OFF_BASE      (TASK_SIZE / 2)
+#define DST_QUEUE_OFF_BASE	(1 << 30)
 
 #define MFC_BANK1_ALLOC_CTX	0
 #define MFC_BANK2_ALLOC_CTX	1
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/media/platform/sh_veu.c linux-libre-3.14.39-gnu/drivers/media/platform/sh_veu.c
--- linux-libre-3.14.38-gnu/drivers/media/platform/sh_veu.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/media/platform/sh_veu.c	2015-04-19 04:11:58.000000000 -0400
@@ -1183,6 +1183,7 @@ static int sh_veu_probe(struct platform_
 	}
 
 	*vdev = sh_veu_videodev;
+	vdev->v4l2_dev = &veu->v4l2_dev;
 	spin_lock_init(&veu->lock);
 	mutex_init(&veu->fop_lock);
 	vdev->lock = &veu->fop_lock;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/net/can/flexcan.c linux-libre-3.14.39-gnu/drivers/net/can/flexcan.c
--- linux-libre-3.14.38-gnu/drivers/net/can/flexcan.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/net/can/flexcan.c	2015-04-19 04:11:58.000000000 -0400
@@ -1095,12 +1095,19 @@ static int flexcan_probe(struct platform
 	const struct flexcan_devtype_data *devtype_data;
 	struct net_device *dev;
 	struct flexcan_priv *priv;
+	struct regulator *reg_xceiver;
 	struct resource *mem;
 	struct clk *clk_ipg = NULL, *clk_per = NULL;
 	void __iomem *base;
 	int err, irq;
 	u32 clock_freq = 0;
 
+	reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
+	if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+	else if (IS_ERR(reg_xceiver))
+		reg_xceiver = NULL;
+
 	if (pdev->dev.of_node)
 		of_property_read_u32(pdev->dev.of_node,
 						"clock-frequency", &clock_freq);
@@ -1162,9 +1169,7 @@ static int flexcan_probe(struct platform
 	priv->pdata = dev_get_platdata(&pdev->dev);
 	priv->devtype_data = devtype_data;
 
-	priv->reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
-	if (IS_ERR(priv->reg_xceiver))
-		priv->reg_xceiver = NULL;
+	priv->reg_xceiver = reg_xceiver;
 
 	netif_napi_add(dev, &priv->napi, flexcan_poll, FLEXCAN_NAPI_WEIGHT);
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/net/wireless/iwlwifi/dvm/dev.h linux-libre-3.14.39-gnu/drivers/net/wireless/iwlwifi/dvm/dev.h
--- linux-libre-3.14.38-gnu/drivers/net/wireless/iwlwifi/dvm/dev.h	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/net/wireless/iwlwifi/dvm/dev.h	2015-04-19 04:11:58.000000000 -0400
@@ -708,7 +708,6 @@ struct iwl_priv {
 	unsigned long reload_jiffies;
 	int reload_count;
 	bool ucode_loaded;
-	bool init_ucode_run;		/* Don't run init uCode again */
 
 	u8 plcp_delta_threshold;
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/net/wireless/iwlwifi/dvm/ucode.c linux-libre-3.14.39-gnu/drivers/net/wireless/iwlwifi/dvm/ucode.c
--- linux-libre-3.14.38-gnu/drivers/net/wireless/iwlwifi/dvm/ucode.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/net/wireless/iwlwifi/dvm/ucode.c	2015-04-19 04:11:58.000000000 -0400
@@ -418,9 +418,6 @@ int iwl_run_init_ucode(struct iwl_priv *
 	if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len)
 		return 0;
 
-	if (priv->init_ucode_run)
-		return 0;
-
 	iwl_init_notification_wait(&priv->notif_wait, &calib_wait,
 				   calib_complete, ARRAY_SIZE(calib_complete),
 				   iwlagn_wait_calib, priv);
@@ -440,8 +437,6 @@ int iwl_run_init_ucode(struct iwl_priv *
 	 */
 	ret = iwl_wait_notification(&priv->notif_wait, &calib_wait,
 					UCODE_CALIB_TIMEOUT);
-	if (!ret)
-		priv->init_ucode_run = true;
 
 	goto out;
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/pci/pcie/aer/aerdrv_errprint.c linux-libre-3.14.39-gnu/drivers/pci/pcie/aer/aerdrv_errprint.c
--- linux-libre-3.14.38-gnu/drivers/pci/pcie/aer/aerdrv_errprint.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/pci/pcie/aer/aerdrv_errprint.c	2015-04-19 04:11:58.000000000 -0400
@@ -127,16 +127,8 @@ static const char *aer_agent_string[] =
 static void __print_tlp_header(struct pci_dev *dev,
 			       struct aer_header_log_regs *t)
 {
-	unsigned char *tlp = (unsigned char *)&t;
-
-	dev_err(&dev->dev, "  TLP Header:"
-		" %02x%02x%02x%02x %02x%02x%02x%02x"
-		" %02x%02x%02x%02x %02x%02x%02x%02x\n",
-		*(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
-		*(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
-		*(tlp + 11), *(tlp + 10), *(tlp + 9),
-		*(tlp + 8), *(tlp + 15), *(tlp + 14),
-		*(tlp + 13), *(tlp + 12));
+	dev_err(&dev->dev, "  TLP Header: %08x %08x %08x %08x\n",
+		t->dw0, t->dw1, t->dw2, t->dw3);
 }
 
 static void __aer_print_error(struct pci_dev *dev,
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/scsi/be2iscsi/be_main.c linux-libre-3.14.39-gnu/drivers/scsi/be2iscsi/be_main.c
--- linux-libre-3.14.38-gnu/drivers/scsi/be2iscsi/be_main.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/scsi/be2iscsi/be_main.c	2015-04-19 04:11:58.000000000 -0400
@@ -5684,9 +5684,9 @@ free_port:
 hba_free:
 	if (phba->msix_enabled)
 		pci_disable_msix(phba->pcidev);
-	iscsi_host_remove(phba->shost);
 	pci_dev_put(phba->pcidev);
 	iscsi_host_free(phba->shost);
+	pci_set_drvdata(pcidev, NULL);
 disable_pci:
 	pci_disable_device(pcidev);
 	return ret;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/scsi/scsi_lib.c linux-libre-3.14.39-gnu/drivers/scsi/scsi_lib.c
--- linux-libre-3.14.38-gnu/drivers/scsi/scsi_lib.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/scsi/scsi_lib.c	2015-04-19 04:11:58.000000000 -0400
@@ -1258,9 +1258,11 @@ int scsi_prep_state_check(struct scsi_de
 				    "rejecting I/O to dead device\n");
 			ret = BLKPREP_KILL;
 			break;
-		case SDEV_QUIESCE:
 		case SDEV_BLOCK:
 		case SDEV_CREATED_BLOCK:
+			ret = BLKPREP_DEFER;
+			break;
+		case SDEV_QUIESCE:
 			/*
 			 * If the devices is blocked we defer normal commands.
 			 */
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/target/iscsi/iscsi_target.c linux-libre-3.14.39-gnu/drivers/target/iscsi/iscsi_target.c
--- linux-libre-3.14.38-gnu/drivers/target/iscsi/iscsi_target.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/target/iscsi/iscsi_target.c	2015-04-19 04:11:58.000000000 -0400
@@ -1165,7 +1165,7 @@ iscsit_handle_scsi_cmd(struct iscsi_conn
 	 * traditional iSCSI block I/O.
 	 */
 	if (iscsit_allocate_iovecs(cmd) < 0) {
-		return iscsit_add_reject_cmd(cmd,
+		return iscsit_reject_cmd(cmd,
 				ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf);
 	}
 	immed_data = cmd->immediate_data;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/tty/n_tty.c linux-libre-3.14.39-gnu/drivers/tty/n_tty.c
--- linux-libre-3.14.38-gnu/drivers/tty/n_tty.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/tty/n_tty.c	2015-04-19 04:11:58.000000000 -0400
@@ -247,8 +247,6 @@ static void n_tty_write_wakeup(struct tt
 
 static void n_tty_check_throttle(struct tty_struct *tty)
 {
-	if (tty->driver->type == TTY_DRIVER_TYPE_PTY)
-		return;
 	/*
 	 * Check the remaining room for the input canonicalization
 	 * mode.  We don't want to throttle the driver if we're in
@@ -1512,23 +1510,6 @@ n_tty_receive_char_lnext(struct tty_stru
 		n_tty_receive_char_flagged(tty, c, flag);
 }
 
-/**
- *	n_tty_receive_buf	-	data receive
- *	@tty: terminal device
- *	@cp: buffer
- *	@fp: flag buffer
- *	@count: characters
- *
- *	Called by the terminal driver when a block of characters has
- *	been received. This function must be called from soft contexts
- *	not from interrupt context. The driver is responsible for making
- *	calls one at a time and in order (or using flush_to_ldisc)
- *
- *	n_tty_receive_buf()/producer path:
- *		claims non-exclusive termios_rwsem
- *		publishes read_head and canon_head
- */
-
 static void
 n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp,
 			   char *fp, int count)
@@ -1684,24 +1665,85 @@ static void __receive_buf(struct tty_str
 	}
 }
 
+/**
+ *	n_tty_receive_buf_common	-	process input
+ *	@tty: device to receive input
+ *	@cp: input chars
+ *	@fp: flags for each char (if NULL, all chars are TTY_NORMAL)
+ *	@count: number of input chars in @cp
+ *
+ *	Called by the terminal driver when a block of characters has
+ *	been received. This function must be called from soft contexts
+ *	not from interrupt context. The driver is responsible for making
+ *	calls one at a time and in order (or using flush_to_ldisc)
+ *
+ *	Returns the # of input chars from @cp which were processed.
+ *
+ *	In canonical mode, the maximum line length is 4096 chars (including
+ *	the line termination char); lines longer than 4096 chars are
+ *	truncated. After 4095 chars, input data is still processed but
+ *	not stored. Overflow processing ensures the tty can always
+ *	receive more input until at least one line can be read.
+ *
+ *	In non-canonical mode, the read buffer will only accept 4095 chars;
+ *	this provides the necessary space for a newline char if the input
+ *	mode is switched to canonical.
+ *
+ *	Note it is possible for the read buffer to _contain_ 4096 chars
+ *	in non-canonical mode: the read buffer could already contain the
+ *	maximum canon line of 4096 chars when the mode is switched to
+ *	non-canonical.
+ *
+ *	n_tty_receive_buf()/producer path:
+ *		claims non-exclusive termios_rwsem
+ *		publishes commit_head or canon_head
+ */
 static int
 n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
 			 char *fp, int count, int flow)
 {
 	struct n_tty_data *ldata = tty->disc_data;
-	int room, n, rcvd = 0;
+	int room, n, rcvd = 0, overflow;
 
 	down_read(&tty->termios_rwsem);
 
 	while (1) {
-		room = receive_room(tty);
+		/*
+		 * When PARMRK is set, each input char may take up to 3 chars
+		 * in the read buf; reduce the buffer space avail by 3x
+		 *
+		 * If we are doing input canonicalization, and there are no
+		 * pending newlines, let characters through without limit, so
+		 * that erase characters will be handled.  Other excess
+		 * characters will be beeped.
+		 *
+		 * paired with store in *_copy_from_read_buf() -- guarantees
+		 * the consumer has loaded the data in read_buf up to the new
+		 * read_tail (so this producer will not overwrite unread data)
+		 */
+		size_t tail = ldata->read_tail;
+
+		room = N_TTY_BUF_SIZE - (ldata->read_head - tail);
+		if (I_PARMRK(tty))
+			room = (room + 2) / 3;
+		room--;
+		if (room <= 0) {
+			overflow = ldata->icanon && ldata->canon_head == tail;
+			if (overflow && room < 0)
+				ldata->read_head--;
+			room = overflow;
+			ldata->no_room = flow && !room;
+		} else
+			overflow = 0;
+
 		n = min(count, room);
-		if (!n) {
-			if (flow && !room)
-				ldata->no_room = 1;
+		if (!n)
 			break;
-		}
-		__receive_buf(tty, cp, fp, n);
+
+		/* ignore parity errors if handling overflow */
+		if (!overflow || !fp || *fp != TTY_PARITY)
+			__receive_buf(tty, cp, fp, n);
+
 		cp += n;
 		if (fp)
 			fp += n;
@@ -1710,7 +1752,17 @@ n_tty_receive_buf_common(struct tty_stru
 	}
 
 	tty->receive_room = room;
-	n_tty_check_throttle(tty);
+
+	/* Unthrottle if handling overflow on pty */
+	if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
+		if (overflow) {
+			tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE);
+			tty_unthrottle_safe(tty);
+			__tty_set_flow_change(tty, 0);
+		}
+	} else
+		n_tty_check_throttle(tty);
+
 	up_read(&tty->termios_rwsem);
 
 	return rcvd;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/tty/serial/fsl_lpuart.c linux-libre-3.14.39-gnu/drivers/tty/serial/fsl_lpuart.c
--- linux-libre-3.14.38-gnu/drivers/tty/serial/fsl_lpuart.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/tty/serial/fsl_lpuart.c	2015-04-19 04:11:58.000000000 -0400
@@ -362,6 +362,9 @@ static void lpuart_setup_watermark(struc
 	writeb(val | UARTPFIFO_TXFE | UARTPFIFO_RXFE,
 			sport->port.membase + UARTPFIFO);
 
+	/* explicitly clear RDRF */
+	readb(sport->port.membase + UARTSR1);
+
 	/* flush Tx and Rx FIFO */
 	writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH,
 			sport->port.membase + UARTCFIFO);
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/usb/host/xhci-hub.c linux-libre-3.14.39-gnu/drivers/usb/host/xhci-hub.c
--- linux-libre-3.14.38-gnu/drivers/usb/host/xhci-hub.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/usb/host/xhci-hub.c	2015-04-19 04:11:58.000000000 -0400
@@ -383,6 +383,10 @@ static void xhci_clear_port_change_bit(s
 		status = PORT_PLC;
 		port_change_bit = "link state";
 		break;
+	case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
+		status = PORT_CEC;
+		port_change_bit = "config error";
+		break;
 	default:
 		/* Should never happen */
 		return;
@@ -584,6 +588,8 @@ static u32 xhci_get_port_status(struct u
 			status |= USB_PORT_STAT_C_LINK_STATE << 16;
 		if ((raw_port_status & PORT_WRC))
 			status |= USB_PORT_STAT_C_BH_RESET << 16;
+		if ((raw_port_status & PORT_CEC))
+			status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
 	}
 
 	if (hcd->speed != HCD_USB3) {
@@ -999,6 +1005,7 @@ int xhci_hub_control(struct usb_hcd *hcd
 		case USB_PORT_FEAT_C_OVER_CURRENT:
 		case USB_PORT_FEAT_C_ENABLE:
 		case USB_PORT_FEAT_C_PORT_LINK_STATE:
+		case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
 			xhci_clear_port_change_bit(xhci, wValue, wIndex,
 					port_array[wIndex], temp);
 			break;
@@ -1063,7 +1070,7 @@ int xhci_hub_status_data(struct usb_hcd
 	 */
 	status = bus_state->resuming_ports;
 
-	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;
+	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
 
 	spin_lock_irqsave(&xhci->lock, flags);
 	/* For each port, did anything change?  If so, set that bit in buf. */
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/usb/host/xhci-pci.c linux-libre-3.14.39-gnu/drivers/usb/host/xhci-pci.c
--- linux-libre-3.14.38-gnu/drivers/usb/host/xhci-pci.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/usb/host/xhci-pci.c	2015-04-19 04:11:58.000000000 -0400
@@ -108,6 +108,7 @@ static void xhci_pci_quirks(struct devic
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 		xhci->quirks |= XHCI_INTEL_HOST;
+		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 			pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
@@ -123,7 +124,6 @@ static void xhci_pci_quirks(struct devic
 		 * PPT chipsets.
 		 */
 		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
-		xhci->quirks |= XHCI_AVOID_BEI;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 	    (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI ||
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/usb/serial/ftdi_sio.c linux-libre-3.14.39-gnu/drivers/usb/serial/ftdi_sio.c
--- linux-libre-3.14.38-gnu/drivers/usb/serial/ftdi_sio.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/usb/serial/ftdi_sio.c	2015-04-19 04:11:58.000000000 -0400
@@ -617,6 +617,7 @@ static const struct usb_device_id id_tab
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+	{ USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
 	/*
 	 * ELV devices:
 	 */
@@ -1901,8 +1902,12 @@ static int ftdi_8u2232c_probe(struct usb
 {
 	struct usb_device *udev = serial->dev;
 
-	if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) ||
-	    (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2")))
+	if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems"))
+		return ftdi_jtag_probe(serial);
+
+	if (udev->product &&
+		(!strcmp(udev->product, "BeagleBone/XDS100V2") ||
+		 !strcmp(udev->product, "SNAP Connect E10")))
 		return ftdi_jtag_probe(serial);
 
 	return 0;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/drivers/usb/serial/ftdi_sio_ids.h linux-libre-3.14.39-gnu/drivers/usb/serial/ftdi_sio_ids.h
--- linux-libre-3.14.38-gnu/drivers/usb/serial/ftdi_sio_ids.h	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/drivers/usb/serial/ftdi_sio_ids.h	2015-04-19 04:11:58.000000000 -0400
@@ -561,6 +561,12 @@
  */
 #define FTDI_NT_ORIONLXM_PID	0x7c90	/* OrionLXm Substation Automation Platform */
 
+/*
+ * Synapse Wireless product ids (FTDI_VID)
+ * http://www.synapse-wireless.com
+ */
+#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
+
 
 /********************************/
 /** third-party VID/PID combos **/
diff -druNp --no-dereference linux-libre-3.14.38-gnu/fs/aio.c linux-libre-3.14.39-gnu/fs/aio.c
--- linux-libre-3.14.38-gnu/fs/aio.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/fs/aio.c	2015-04-19 04:11:58.000000000 -0400
@@ -719,6 +719,9 @@ static struct kioctx *ioctx_alloc(unsign
 err_cleanup:
 	aio_nr_sub(ctx->max_reqs);
 err_ctx:
+	atomic_set(&ctx->dead, 1);
+	if (ctx->mmap_size)
+		vm_munmap(ctx->mmap_base, ctx->mmap_size);
 	aio_free_ring(ctx);
 err:
 	mutex_unlock(&ctx->ring_lock);
diff -druNp --no-dereference linux-libre-3.14.38-gnu/fs/btrfs/tree-log.c linux-libre-3.14.39-gnu/fs/btrfs/tree-log.c
--- linux-libre-3.14.38-gnu/fs/btrfs/tree-log.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/fs/btrfs/tree-log.c	2015-04-19 04:11:58.000000000 -0400
@@ -1235,21 +1235,13 @@ out:
 }
 
 static int insert_orphan_item(struct btrfs_trans_handle *trans,
-			      struct btrfs_root *root, u64 offset)
+			      struct btrfs_root *root, u64 ino)
 {
 	int ret;
-	struct btrfs_path *path;
-
-	path = btrfs_alloc_path();
-	if (!path)
-		return -ENOMEM;
-
-	ret = btrfs_find_item(root, path, BTRFS_ORPHAN_OBJECTID,
-			offset, BTRFS_ORPHAN_ITEM_KEY, NULL);
-	if (ret > 0)
-		ret = btrfs_insert_orphan_item(trans, root, offset);
 
-	btrfs_free_path(path);
+	ret = btrfs_insert_orphan_item(trans, root, ino);
+	if (ret == -EEXIST)
+		ret = 0;
 
 	return ret;
 }
diff -druNp --no-dereference linux-libre-3.14.38-gnu/fs/cifs/file.c linux-libre-3.14.39-gnu/fs/cifs/file.c
--- linux-libre-3.14.38-gnu/fs/cifs/file.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/fs/cifs/file.c	2015-04-19 04:11:58.000000000 -0400
@@ -1821,6 +1821,7 @@ refind_writable:
 			cifsFileInfo_put(inv_file);
 			spin_lock(&cifs_file_list_lock);
 			++refind;
+			inv_file = NULL;
 			goto refind_writable;
 		}
 	}
diff -druNp --no-dereference linux-libre-3.14.38-gnu/fs/cifs/smb2ops.c linux-libre-3.14.39-gnu/fs/cifs/smb2ops.c
--- linux-libre-3.14.38-gnu/fs/cifs/smb2ops.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/fs/cifs/smb2ops.c	2015-04-19 04:11:58.000000000 -0400
@@ -630,7 +630,8 @@ smb2_clone_range(const unsigned int xid,
 
 			/* No need to change MaxChunks since already set to 1 */
 			chunk_sizes_updated = true;
-		}
+		} else
+			goto cchunk_out;
 	}
 
 cchunk_out:
diff -druNp --no-dereference linux-libre-3.14.38-gnu/fs/ocfs2/file.c linux-libre-3.14.39-gnu/fs/ocfs2/file.c
--- linux-libre-3.14.38-gnu/fs/ocfs2/file.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/fs/ocfs2/file.c	2015-04-19 04:11:58.000000000 -0400
@@ -2391,10 +2391,14 @@ out_dio:
 	/* buffered aio wouldn't have proper lock coverage today */
 	BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT));
 
+	if (unlikely(written <= 0))
+		goto no_sync;
+
 	if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) ||
 	    ((file->f_flags & O_DIRECT) && !direct_io)) {
-		ret = filemap_fdatawrite_range(file->f_mapping, *ppos,
-					       *ppos + count - 1);
+		ret = filemap_fdatawrite_range(file->f_mapping,
+					       iocb->ki_pos - written,
+					       iocb->ki_pos - 1);
 		if (ret < 0)
 			written = ret;
 
@@ -2407,10 +2411,12 @@ out_dio:
 		}
 
 		if (!ret)
-			ret = filemap_fdatawait_range(file->f_mapping, *ppos,
-						      *ppos + count - 1);
+			ret = filemap_fdatawait_range(file->f_mapping,
+						      iocb->ki_pos - written,
+						      iocb->ki_pos - 1);
 	}
 
+no_sync:
 	/*
 	 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
 	 * function pointer which is called when o_direct io completes so that
diff -druNp --no-dereference linux-libre-3.14.38-gnu/include/linux/blk_types.h linux-libre-3.14.39-gnu/include/linux/blk_types.h
--- linux-libre-3.14.38-gnu/include/linux/blk_types.h	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/include/linux/blk_types.h	2015-04-19 04:11:58.000000000 -0400
@@ -180,7 +180,9 @@ enum rq_flag_bits {
 	__REQ_ELVPRIV,		/* elevator private data attached */
 	__REQ_FAILED,		/* set if the request failed */
 	__REQ_QUIET,		/* don't worry about errors */
-	__REQ_PREEMPT,		/* set for "ide_preempt" requests */
+	__REQ_PREEMPT,		/* set for "ide_preempt" requests and also
+				   for requests for which the SCSI "quiesce"
+				   state must be ignored. */
 	__REQ_ALLOCED,		/* request came from our alloc pool */
 	__REQ_COPY_USER,	/* contains copies of user pages */
 	__REQ_FLUSH_SEQ,	/* request for flush sequence */
diff -druNp --no-dereference linux-libre-3.14.38-gnu/include/linux/cpuidle.h linux-libre-3.14.39-gnu/include/linux/cpuidle.h
--- linux-libre-3.14.38-gnu/include/linux/cpuidle.h	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/include/linux/cpuidle.h	2015-04-19 04:11:58.000000000 -0400
@@ -69,7 +69,6 @@ struct cpuidle_device {
 	unsigned int		cpu;
 
 	int			last_residency;
-	int			state_count;
 	struct cpuidle_state_usage	states_usage[CPUIDLE_STATE_MAX];
 	struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
 	struct cpuidle_driver_kobj *kobj_driver;
diff -druNp --no-dereference linux-libre-3.14.38-gnu/kernel/sched/core.c linux-libre-3.14.39-gnu/kernel/sched/core.c
--- linux-libre-3.14.38-gnu/kernel/sched/core.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/kernel/sched/core.c	2015-04-19 04:11:58.000000000 -0400
@@ -2980,6 +2980,8 @@ void rt_mutex_setprio(struct task_struct
 	} else {
 		if (dl_prio(oldprio))
 			p->dl.dl_boosted = 0;
+		if (rt_prio(oldprio))
+			p->rt.timeout = 0;
 		p->sched_class = &fair_sched_class;
 	}
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/Makefile linux-libre-3.14.39-gnu/Makefile
--- linux-libre-3.14.38-gnu/Makefile	2015-04-13 17:03:26.000000000 -0400
+++ linux-libre-3.14.39-gnu/Makefile	2015-04-20 07:20:10.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 14
-SUBLEVEL = 38
+SUBLEVEL = 39
 EXTRAVERSION =-gnu
 NAME = Remembering Coco
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/mm/memory_hotplug.c linux-libre-3.14.39-gnu/mm/memory_hotplug.c
--- linux-libre-3.14.38-gnu/mm/memory_hotplug.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/mm/memory_hotplug.c	2015-04-19 04:11:58.000000000 -0400
@@ -1016,6 +1016,10 @@ static pg_data_t __ref *hotadd_new_pgdat
 			return NULL;
 
 		arch_refresh_nodedata(nid, pgdat);
+	} else {
+		/* Reset the nr_zones and classzone_idx to 0 before reuse */
+		pgdat->nr_zones = 0;
+		pgdat->classzone_idx = 0;
 	}
 
 	/* we can use NODE_DATA(nid) from here */
@@ -1863,15 +1867,6 @@ void try_offline_node(int nid)
 		if (is_vmalloc_addr(zone->wait_table))
 			vfree(zone->wait_table);
 	}
-
-	/*
-	 * Since there is no way to guarentee the address of pgdat/zone is not
-	 * on stack of any kernel threads or used by other kernel objects
-	 * without reference counting or other symchronizing method, do not
-	 * reset node_data and free pgdat here. Just reset it to 0 and reuse
-	 * the memory when the node is online again.
-	 */
-	memset(pgdat, 0, sizeof(*pgdat));
 }
 EXPORT_SYMBOL(try_offline_node);
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/mm/page-writeback.c linux-libre-3.14.39-gnu/mm/page-writeback.c
--- linux-libre-3.14.38-gnu/mm/page-writeback.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/mm/page-writeback.c	2015-04-19 04:11:58.000000000 -0400
@@ -878,8 +878,11 @@ static void bdi_update_write_bandwidth(s
 	 *                   bw * elapsed + write_bandwidth * (period - elapsed)
 	 * write_bandwidth = ---------------------------------------------------
 	 *                                          period
+	 *
+	 * @written may have decreased due to account_page_redirty().
+	 * Avoid underflowing @bw calculation.
 	 */
-	bw = written - bdi->written_stamp;
+	bw = written - min(written, bdi->written_stamp);
 	bw *= HZ;
 	if (unlikely(elapsed > period)) {
 		do_div(bw, elapsed);
@@ -943,7 +946,7 @@ static void global_update_bandwidth(unsi
 				    unsigned long now)
 {
 	static DEFINE_SPINLOCK(dirty_lock);
-	static unsigned long update_time;
+	static unsigned long update_time = INITIAL_JIFFIES;
 
 	/*
 	 * check locklessly first to optimize away locking for the most time
diff -druNp --no-dereference linux-libre-3.14.38-gnu/net/ipv4/tcp_output.c linux-libre-3.14.39-gnu/net/ipv4/tcp_output.c
--- linux-libre-3.14.38-gnu/net/ipv4/tcp_output.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/net/ipv4/tcp_output.c	2015-04-19 04:11:58.000000000 -0400
@@ -2933,6 +2933,7 @@ static int tcp_send_syn_data(struct sock
 		goto fallback;
 	syn_data->ip_summed = CHECKSUM_PARTIAL;
 	memcpy(syn_data->cb, syn->cb, sizeof(syn->cb));
+	skb_shinfo(syn_data)->gso_segs = 1;
 	if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space),
 					 fo->data->msg_iov, 0, space))) {
 		kfree_skb(syn_data);
diff -druNp --no-dereference linux-libre-3.14.38-gnu/net/llc/sysctl_net_llc.c linux-libre-3.14.39-gnu/net/llc/sysctl_net_llc.c
--- linux-libre-3.14.38-gnu/net/llc/sysctl_net_llc.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/net/llc/sysctl_net_llc.c	2015-04-19 04:11:58.000000000 -0400
@@ -18,28 +18,28 @@ static struct ctl_table llc2_timeout_tab
 	{
 		.procname	= "ack",
 		.data		= &sysctl_llc2_ack_timeout,
-		.maxlen		= sizeof(long),
+		.maxlen		= sizeof(sysctl_llc2_ack_timeout),
 		.mode		= 0644,
 		.proc_handler   = proc_dointvec_jiffies,
 	},
 	{
 		.procname	= "busy",
 		.data		= &sysctl_llc2_busy_timeout,
-		.maxlen		= sizeof(long),
+		.maxlen		= sizeof(sysctl_llc2_busy_timeout),
 		.mode		= 0644,
 		.proc_handler   = proc_dointvec_jiffies,
 	},
 	{
 		.procname	= "p",
 		.data		= &sysctl_llc2_p_timeout,
-		.maxlen		= sizeof(long),
+		.maxlen		= sizeof(sysctl_llc2_p_timeout),
 		.mode		= 0644,
 		.proc_handler   = proc_dointvec_jiffies,
 	},
 	{
 		.procname	= "rej",
 		.data		= &sysctl_llc2_rej_timeout,
-		.maxlen		= sizeof(long),
+		.maxlen		= sizeof(sysctl_llc2_rej_timeout),
 		.mode		= 0644,
 		.proc_handler   = proc_dointvec_jiffies,
 	},
diff -druNp --no-dereference linux-libre-3.14.38-gnu/net/rds/sysctl.c linux-libre-3.14.39-gnu/net/rds/sysctl.c
--- linux-libre-3.14.38-gnu/net/rds/sysctl.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/net/rds/sysctl.c	2015-04-19 04:11:58.000000000 -0400
@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_t
 	{
 		.procname	= "max_unacked_packets",
 		.data		= &rds_sysctl_max_unacked_packets,
-		.maxlen         = sizeof(unsigned long),
+		.maxlen         = sizeof(int),
 		.mode           = 0644,
 		.proc_handler   = proc_dointvec,
 	},
 	{
 		.procname	= "max_unacked_bytes",
 		.data		= &rds_sysctl_max_unacked_bytes,
-		.maxlen         = sizeof(unsigned long),
+		.maxlen         = sizeof(int),
 		.mode           = 0644,
 		.proc_handler   = proc_dointvec,
 	},
diff -druNp --no-dereference linux-libre-3.14.38-gnu/security/selinux/selinuxfs.c linux-libre-3.14.39-gnu/security/selinux/selinuxfs.c
--- linux-libre-3.14.38-gnu/security/selinux/selinuxfs.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/security/selinux/selinuxfs.c	2015-04-19 04:11:58.000000000 -0400
@@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct
 		goto out;
 
 	/* No partial writes. */
-	length = EINVAL;
+	length = -EINVAL;
 	if (*ppos != 0)
 		goto out;
 
diff -druNp --no-dereference linux-libre-3.14.38-gnu/sound/pci/hda/patch_realtek.c linux-libre-3.14.39-gnu/sound/pci/hda/patch_realtek.c
--- linux-libre-3.14.38-gnu/sound/pci/hda/patch_realtek.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/sound/pci/hda/patch_realtek.c	2015-04-19 04:11:58.000000000 -0400
@@ -271,7 +271,7 @@ static void alc_auto_setup_eapd(struct h
 {
 	/* We currently only handle front, HP */
 	static hda_nid_t pins[] = {
-		0x0f, 0x10, 0x14, 0x15, 0
+		0x0f, 0x10, 0x14, 0x15, 0x17, 0
 	};
 	hda_nid_t *p;
 	for (p = pins; *p; p++)
@@ -2885,6 +2885,8 @@ static void alc283_init(struct hda_codec
 
 	if (!hp_pin)
 		return;
+
+	msleep(30);
 	hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
 
 	/* Index 0x43 Direct Drive HP AMP LPM Control 1 */
@@ -3951,6 +3953,7 @@ enum {
 	ALC269_FIXUP_QUANTA_MUTE,
 	ALC269_FIXUP_LIFEBOOK,
 	ALC269_FIXUP_LIFEBOOK_EXTMIC,
+	ALC269_FIXUP_LIFEBOOK_HP_PIN,
 	ALC269_FIXUP_AMIC,
 	ALC269_FIXUP_DMIC,
 	ALC269VB_FIXUP_AMIC,
@@ -4085,6 +4088,13 @@ static const struct hda_fixup alc269_fix
 			{ }
 		},
 	},
+	[ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
+		.type = HDA_FIXUP_PINS,
+		.v.pins = (const struct hda_pintbl[]) {
+			{ 0x21, 0x0221102f }, /* HP out */
+			{ }
+		},
+	},
 	[ALC269_FIXUP_AMIC] = {
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
@@ -4538,6 +4548,7 @@ static const struct snd_pci_quirk alc269
 	SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
 	SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
 	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
+	SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
 	SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
 	SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
diff -druNp --no-dereference linux-libre-3.14.38-gnu/sound/usb/mixer_quirks.c linux-libre-3.14.39-gnu/sound/usb/mixer_quirks.c
--- linux-libre-3.14.38-gnu/sound/usb/mixer_quirks.c	2015-04-13 08:03:16.000000000 -0400
+++ linux-libre-3.14.39-gnu/sound/usb/mixer_quirks.c	2015-04-19 04:11:58.000000000 -0400
@@ -178,6 +178,7 @@ static const struct rc_config {
 	{ USB_ID(0x041e, 0x3040), 2, 2, 6, 6,  2,  0x6e91 }, /* Live! 24-bit */
 	{ USB_ID(0x041e, 0x3042), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 */
 	{ USB_ID(0x041e, 0x30df), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 Pro */
+	{ USB_ID(0x041e, 0x3237), 0, 1, 1, 1,  1,  0x000d }, /* Usb X-Fi S51 Pro */
 	{ USB_ID(0x041e, 0x3048), 2, 2, 6, 6,  2,  0x6e91 }, /* Toshiba SB0500 */
 };
 
