diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/arm/mm/fault.c linux-libre-4.4.196-gnu/arch/arm/mm/fault.c
--- linux-libre-4.4.195-gnu/arch/arm/mm/fault.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/arm/mm/fault.c	2019-10-07 15:01:07.000000000 -0400
@@ -211,7 +211,7 @@ static inline bool access_error(unsigned
 {
 	unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
 
-	if (fsr & FSR_WRITE)
+	if ((fsr & FSR_WRITE) && !(fsr & FSR_CM))
 		mask = VM_WRITE;
 	if (fsr & FSR_LNX_PF)
 		mask = VM_EXEC;
@@ -281,7 +281,7 @@ do_page_fault(unsigned long addr, unsign
 
 	if (user_mode(regs))
 		flags |= FAULT_FLAG_USER;
-	if (fsr & FSR_WRITE)
+	if ((fsr & FSR_WRITE) && !(fsr & FSR_CM))
 		flags |= FAULT_FLAG_WRITE;
 
 	/*
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/arm/mm/fault.h linux-libre-4.4.196-gnu/arch/arm/mm/fault.h
--- linux-libre-4.4.195-gnu/arch/arm/mm/fault.h	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/arm/mm/fault.h	2019-10-07 15:01:07.000000000 -0400
@@ -5,6 +5,7 @@
  * Fault status register encodings.  We steal bit 31 for our own purposes.
  */
 #define FSR_LNX_PF		(1 << 31)
+#define FSR_CM			(1 << 13)
 #define FSR_WRITE		(1 << 11)
 #define FSR_FS4			(1 << 10)
 #define FSR_FS3_0		(15)
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/powerpc/include/asm/futex.h linux-libre-4.4.196-gnu/arch/powerpc/include/asm/futex.h
--- linux-libre-4.4.195-gnu/arch/powerpc/include/asm/futex.h	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/powerpc/include/asm/futex.h	2019-10-07 15:01:07.000000000 -0400
@@ -60,8 +60,7 @@ static inline int arch_futex_atomic_op_i
 
 	pagefault_enable();
 
-	if (!ret)
-		*oval = oldval;
+	*oval = oldval;
 
 	return ret;
 }
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/powerpc/kernel/exceptions-64s.S linux-libre-4.4.196-gnu/arch/powerpc/kernel/exceptions-64s.S
--- linux-libre-4.4.195-gnu/arch/powerpc/kernel/exceptions-64s.S	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/powerpc/kernel/exceptions-64s.S	2019-10-07 15:01:07.000000000 -0400
@@ -1465,6 +1465,10 @@ machine_check_handle_early:
 	RFI_TO_USER_OR_KERNEL
 9:
 	/* Deliver the machine check to host kernel in V mode. */
+BEGIN_FTR_SECTION
+	ld	r10,ORIG_GPR3(r1)
+	mtspr	SPRN_CFAR,r10
+END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
 	MACHINE_CHECK_HANDLER_WINDUP
 	b	machine_check_pSeries
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/powerpc/kernel/rtas.c linux-libre-4.4.196-gnu/arch/powerpc/kernel/rtas.c
--- linux-libre-4.4.195-gnu/arch/powerpc/kernel/rtas.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/powerpc/kernel/rtas.c	2019-10-07 15:01:07.000000000 -0400
@@ -857,15 +857,17 @@ static int rtas_cpu_state_change_mask(en
 		return 0;
 
 	for_each_cpu(cpu, cpus) {
+		struct device *dev = get_cpu_device(cpu);
+
 		switch (state) {
 		case DOWN:
-			cpuret = cpu_down(cpu);
+			cpuret = device_offline(dev);
 			break;
 		case UP:
-			cpuret = cpu_up(cpu);
+			cpuret = device_online(dev);
 			break;
 		}
-		if (cpuret) {
+		if (cpuret < 0) {
 			pr_debug("%s: cpu_%s for cpu#%d returned %d.\n",
 					__func__,
 					((state == UP) ? "up" : "down"),
@@ -954,6 +956,8 @@ int rtas_ibm_suspend_me(u64 handle)
 	data.token = rtas_token("ibm,suspend-me");
 	data.complete = &done;
 
+	lock_device_hotplug();
+
 	/* All present CPUs must be online */
 	cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask);
 	cpuret = rtas_online_cpus_mask(offline_mask);
@@ -985,6 +989,7 @@ int rtas_ibm_suspend_me(u64 handle)
 				__func__);
 
 out:
+	unlock_device_hotplug();
 	free_cpumask_var(offline_mask);
 	return atomic_read(&data.error);
 }
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/powerpc/platforms/pseries/mobility.c linux-libre-4.4.196-gnu/arch/powerpc/platforms/pseries/mobility.c
--- linux-libre-4.4.195-gnu/arch/powerpc/platforms/pseries/mobility.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/powerpc/platforms/pseries/mobility.c	2019-10-07 15:01:07.000000000 -0400
@@ -11,6 +11,7 @@
 
 #include <linux/kernel.h>
 #include <linux/kobject.h>
+#include <linux/sched.h>
 #include <linux/smp.h>
 #include <linux/stat.h>
 #include <linux/completion.h>
@@ -206,7 +207,11 @@ static int update_dt_node(__be32 phandle
 
 				prop_data += vd;
 			}
+
+			cond_resched();
 		}
+
+		cond_resched();
 	} while (rtas_rc == 1);
 
 	of_node_put(dn);
@@ -282,8 +287,12 @@ int pseries_devicetree_update(s32 scope)
 					add_dt_node(phandle, drc_index);
 					break;
 				}
+
+				cond_resched();
 			}
 		}
+
+		cond_resched();
 	} while (rc == 1);
 
 	kfree(rtas_buf);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/powerpc/platforms/pseries/setup.c linux-libre-4.4.196-gnu/arch/powerpc/platforms/pseries/setup.c
--- linux-libre-4.4.195-gnu/arch/powerpc/platforms/pseries/setup.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/powerpc/platforms/pseries/setup.c	2019-10-07 15:01:07.000000000 -0400
@@ -369,6 +369,9 @@ static void pseries_lpar_idle(void)
 	 * low power mode by cedeing processor to hypervisor
 	 */
 
+	if (!prep_irq_for_idle())
+		return;
+
 	/* Indicate to hypervisor that we are idle. */
 	get_lppaca()->idle = 1;
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/arch/s390/hypfs/inode.c linux-libre-4.4.196-gnu/arch/s390/hypfs/inode.c
--- linux-libre-4.4.195-gnu/arch/s390/hypfs/inode.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/arch/s390/hypfs/inode.c	2019-10-07 15:01:07.000000000 -0400
@@ -267,7 +267,7 @@ static int hypfs_show_options(struct seq
 static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct inode *root_inode;
-	struct dentry *root_dentry;
+	struct dentry *root_dentry, *update_file;
 	int rc = 0;
 	struct hypfs_sb_info *sbi;
 
@@ -298,9 +298,10 @@ static int hypfs_fill_super(struct super
 		rc = hypfs_diag_create_files(root_dentry);
 	if (rc)
 		return rc;
-	sbi->update_file = hypfs_create_update_file(root_dentry);
-	if (IS_ERR(sbi->update_file))
-		return PTR_ERR(sbi->update_file);
+	update_file = hypfs_create_update_file(root_dentry);
+	if (IS_ERR(update_file))
+		return PTR_ERR(update_file);
+	sbi->update_file = update_file;
 	hypfs_update_update(sb);
 	pr_info("Hypervisor filesystem mounted\n");
 	return 0;
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/android/binder.c linux-libre-4.4.196-gnu/drivers/android/binder.c
--- linux-libre-4.4.195-gnu/drivers/android/binder.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/android/binder.c	2019-10-07 15:01:07.000000000 -0400
@@ -334,7 +334,8 @@ enum {
 	BINDER_LOOPER_STATE_EXITED      = 0x04,
 	BINDER_LOOPER_STATE_INVALID     = 0x08,
 	BINDER_LOOPER_STATE_WAITING     = 0x10,
-	BINDER_LOOPER_STATE_NEED_RETURN = 0x20
+	BINDER_LOOPER_STATE_NEED_RETURN = 0x20,
+	BINDER_LOOPER_STATE_POLL	= 0x40,
 };
 
 struct binder_thread {
@@ -2610,6 +2611,27 @@ static int binder_free_thread(struct bin
 		} else
 			BUG();
 	}
+
+	/*
+	 * If this thread used poll, make sure we remove the waitqueue
+	 * from any epoll data structures holding it with POLLFREE.
+	 * waitqueue_active() is safe to use here because we're holding
+	 * the global lock.
+	 */
+	if ((thread->looper & BINDER_LOOPER_STATE_POLL) &&
+	    waitqueue_active(&thread->wait)) {
+		wake_up_poll(&thread->wait, POLLHUP | POLLFREE);
+	}
+
+	/*
+	 * This is needed to avoid races between wake_up_poll() above and
+	 * and ep_remove_waitqueue() called for other reasons (eg the epoll file
+	 * descriptor being closed); ep_remove_waitqueue() holds an RCU read
+	 * lock, so we can be sure it's done after calling synchronize_rcu().
+	 */
+	if (thread->looper & BINDER_LOOPER_STATE_POLL)
+		synchronize_rcu();
+
 	if (send_reply)
 		binder_send_failed_reply(send_reply, BR_DEAD_REPLY);
 	binder_release_work(&thread->todo);
@@ -2633,6 +2655,8 @@ static unsigned int binder_poll(struct f
 		return POLLERR;
 	}
 
+	thread->looper |= BINDER_LOOPER_STATE_POLL;
+
 	wait_for_proc_work = thread->transaction_stack == NULL &&
 		list_empty(&thread->todo) && thread->return_error == BR_OK;
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/char/ipmi/ipmi_si_intf.c linux-libre-4.4.196-gnu/drivers/char/ipmi/ipmi_si_intf.c
--- linux-libre-4.4.195-gnu/drivers/char/ipmi/ipmi_si_intf.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/char/ipmi/ipmi_si_intf.c	2019-10-07 15:01:07.000000000 -0400
@@ -281,6 +281,9 @@ struct smi_info {
 	 */
 	bool irq_enable_broken;
 
+	/* Is the driver in maintenance mode? */
+	bool in_maintenance_mode;
+
 	/*
 	 * Did we get an attention that we did not handle?
 	 */
@@ -1091,11 +1094,20 @@ static int ipmi_thread(void *data)
 		spin_unlock_irqrestore(&(smi_info->si_lock), flags);
 		busy_wait = ipmi_thread_busy_wait(smi_result, smi_info,
 						  &busy_until);
-		if (smi_result == SI_SM_CALL_WITHOUT_DELAY)
+		if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
 			; /* do nothing */
-		else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait)
-			schedule();
-		else if (smi_result == SI_SM_IDLE) {
+		} else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) {
+			/*
+			 * In maintenance mode we run as fast as
+			 * possible to allow firmware updates to
+			 * complete as fast as possible, but normally
+			 * don't bang on the scheduler.
+			 */
+			if (smi_info->in_maintenance_mode)
+				schedule();
+			else
+				usleep_range(100, 200);
+		} else if (smi_result == SI_SM_IDLE) {
 			if (atomic_read(&smi_info->need_watch)) {
 				schedule_timeout_interruptible(100);
 			} else {
@@ -1103,8 +1115,9 @@ static int ipmi_thread(void *data)
 				__set_current_state(TASK_INTERRUPTIBLE);
 				schedule();
 			}
-		} else
+		} else {
 			schedule_timeout_interruptible(1);
+		}
 	}
 	return 0;
 }
@@ -1283,6 +1296,7 @@ static void set_maintenance_mode(void *s
 
 	if (!enable)
 		atomic_set(&smi_info->req_events, 0);
+	smi_info->in_maintenance_mode = enable;
 }
 
 static const struct ipmi_smi_handlers handlers = {
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/clk/clk-qoriq.c linux-libre-4.4.196-gnu/drivers/clk/clk-qoriq.c
--- linux-libre-4.4.195-gnu/drivers/clk/clk-qoriq.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/clk/clk-qoriq.c	2019-10-07 15:01:07.000000000 -0400
@@ -540,7 +540,7 @@ static const struct clockgen_chipinfo ch
 		.guts_compat = "fsl,qoriq-device-config-1.0",
 		.init_periph = p5020_init_periph,
 		.cmux_groups = {
-			&p2041_cmux_grp1, &p2041_cmux_grp2
+			&p5020_cmux_grp1, &p5020_cmux_grp2
 		},
 		.cmux_to_group = {
 			0, 1, -1
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/clk/sirf/clk-common.c linux-libre-4.4.196-gnu/drivers/clk/sirf/clk-common.c
--- linux-libre-4.4.195-gnu/drivers/clk/sirf/clk-common.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/clk/sirf/clk-common.c	2019-10-07 15:01:07.000000000 -0400
@@ -298,9 +298,10 @@ static u8 dmn_clk_get_parent(struct clk_
 {
 	struct clk_dmn *clk = to_dmnclk(hw);
 	u32 cfg = clkc_readl(clk->regofs);
+	const char *name = clk_hw_get_name(hw);
 
 	/* parent of io domain can only be pll3 */
-	if (strcmp(hw->init->name, "io") == 0)
+	if (strcmp(name, "io") == 0)
 		return 4;
 
 	WARN_ON((cfg & (BIT(3) - 1)) > 4);
@@ -312,9 +313,10 @@ static int dmn_clk_set_parent(struct clk
 {
 	struct clk_dmn *clk = to_dmnclk(hw);
 	u32 cfg = clkc_readl(clk->regofs);
+	const char *name = clk_hw_get_name(hw);
 
 	/* parent of io domain can only be pll3 */
-	if (strcmp(hw->init->name, "io") == 0)
+	if (strcmp(name, "io") == 0)
 		return -EINVAL;
 
 	cfg &= ~(BIT(3) - 1);
@@ -354,7 +356,8 @@ static long dmn_clk_round_rate(struct cl
 {
 	unsigned long fin;
 	unsigned ratio, wait, hold;
-	unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
+	const char *name = clk_hw_get_name(hw);
+	unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4;
 
 	fin = *parent_rate;
 	ratio = fin / rate;
@@ -376,7 +379,8 @@ static int dmn_clk_set_rate(struct clk_h
 	struct clk_dmn *clk = to_dmnclk(hw);
 	unsigned long fin;
 	unsigned ratio, wait, hold, reg;
-	unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4;
+	const char *name = clk_hw_get_name(hw);
+	unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4;
 
 	fin = parent_rate;
 	ratio = fin / rate;
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/gpu/drm/radeon/radeon_connectors.c linux-libre-4.4.196-gnu/drivers/gpu/drm/radeon/radeon_connectors.c
--- linux-libre-4.4.195-gnu/drivers/gpu/drm/radeon/radeon_connectors.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/gpu/drm/radeon/radeon_connectors.c	2019-10-07 15:01:07.000000000 -0400
@@ -758,7 +758,7 @@ static int radeon_connector_set_property
 
 		radeon_encoder->output_csc = val;
 
-		if (connector->encoder->crtc) {
+		if (connector->encoder && connector->encoder->crtc) {
 			struct drm_crtc *crtc  = connector->encoder->crtc;
 			const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
 			struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/hid/hid-apple.c linux-libre-4.4.196-gnu/drivers/hid/hid-apple.c
--- linux-libre-4.4.195-gnu/drivers/hid/hid-apple.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/hid/hid-apple.c	2019-10-07 15:01:07.000000000 -0400
@@ -55,7 +55,6 @@ MODULE_PARM_DESC(swap_opt_cmd, "Swap the
 struct apple_sc {
 	unsigned long quirks;
 	unsigned int fn_on;
-	DECLARE_BITMAP(pressed_fn, KEY_CNT);
 	DECLARE_BITMAP(pressed_numlock, KEY_CNT);
 };
 
@@ -182,6 +181,8 @@ static int hidinput_apple_event(struct h
 {
 	struct apple_sc *asc = hid_get_drvdata(hid);
 	const struct apple_key_translation *trans, *table;
+	bool do_translate;
+	u16 code = 0;
 
 	if (usage->code == KEY_FN) {
 		asc->fn_on = !!value;
@@ -190,8 +191,6 @@ static int hidinput_apple_event(struct h
 	}
 
 	if (fnmode) {
-		int do_translate;
-
 		if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
 				hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
 			table = macbookair_fn_keys;
@@ -203,25 +202,33 @@ static int hidinput_apple_event(struct h
 		trans = apple_find_translation (table, usage->code);
 
 		if (trans) {
-			if (test_bit(usage->code, asc->pressed_fn))
-				do_translate = 1;
-			else if (trans->flags & APPLE_FLAG_FKEY)
-				do_translate = (fnmode == 2 && asc->fn_on) ||
-					(fnmode == 1 && !asc->fn_on);
-			else
-				do_translate = asc->fn_on;
-
-			if (do_translate) {
-				if (value)
-					set_bit(usage->code, asc->pressed_fn);
-				else
-					clear_bit(usage->code, asc->pressed_fn);
+			if (test_bit(trans->from, input->key))
+				code = trans->from;
+			else if (test_bit(trans->to, input->key))
+				code = trans->to;
 
-				input_event(input, usage->type, trans->to,
-						value);
+			if (!code) {
+				if (trans->flags & APPLE_FLAG_FKEY) {
+					switch (fnmode) {
+					case 1:
+						do_translate = !asc->fn_on;
+						break;
+					case 2:
+						do_translate = asc->fn_on;
+						break;
+					default:
+						/* should never happen */
+						do_translate = false;
+					}
+				} else {
+					do_translate = asc->fn_on;
+				}
 
-				return 1;
+				code = do_translate ? trans->to : trans->from;
 			}
+
+			input_event(input, usage->type, code, value);
+			return 1;
 		}
 
 		if (asc->quirks & APPLE_NUMLOCK_EMULATION &&
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/mfd/intel-lpss-pci.c linux-libre-4.4.196-gnu/drivers/mfd/intel-lpss-pci.c
--- linux-libre-4.4.195-gnu/drivers/mfd/intel-lpss-pci.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/mfd/intel-lpss-pci.c	2019-10-07 15:01:07.000000000 -0400
@@ -38,6 +38,8 @@ static int intel_lpss_pci_probe(struct p
 	info->mem = &pdev->resource[0];
 	info->irq = pdev->irq;
 
+	pdev->d3cold_delay = 0;
+
 	/* Probably it is enough to set this for iDMA capable devices only */
 	pci_set_master(pdev);
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/net/ethernet/qlogic/qla3xxx.c linux-libre-4.4.196-gnu/drivers/net/ethernet/qlogic/qla3xxx.c
--- linux-libre-4.4.195-gnu/drivers/net/ethernet/qlogic/qla3xxx.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/net/ethernet/qlogic/qla3xxx.c	2019-10-07 15:01:07.000000000 -0400
@@ -2783,6 +2783,7 @@ static int ql_alloc_large_buffers(struct
 				netdev_err(qdev->ndev,
 					   "PCI mapping failed with error: %d\n",
 					   err);
+				dev_kfree_skb_irq(skb);
 				ql_free_large_buffers(qdev);
 				return -ENOMEM;
 			}
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/net/usb/hso.c linux-libre-4.4.196-gnu/drivers/net/usb/hso.c
--- linux-libre-4.4.195-gnu/drivers/net/usb/hso.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/net/usb/hso.c	2019-10-07 15:01:07.000000000 -0400
@@ -2650,14 +2650,18 @@ static struct hso_device *hso_create_bul
 		 */
 		if (serial->tiocmget) {
 			tiocmget = serial->tiocmget;
+			tiocmget->endp = hso_get_ep(interface,
+						    USB_ENDPOINT_XFER_INT,
+						    USB_DIR_IN);
+			if (!tiocmget->endp) {
+				dev_err(&interface->dev, "Failed to find INT IN ep\n");
+				goto exit;
+			}
+
 			tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
 			if (tiocmget->urb) {
 				mutex_init(&tiocmget->mutex);
 				init_waitqueue_head(&tiocmget->waitq);
-				tiocmget->endp = hso_get_ep(
-					interface,
-					USB_ENDPOINT_XFER_INT,
-					USB_DIR_IN);
 			} else
 				hso_free_tiomget(serial);
 		}
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/net/xen-netfront.c linux-libre-4.4.196-gnu/drivers/net/xen-netfront.c
--- linux-libre-4.4.195-gnu/drivers/net/xen-netfront.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/net/xen-netfront.c	2019-10-07 15:01:07.000000000 -0400
@@ -874,9 +874,9 @@ static int xennet_set_skb_gso(struct sk_
 	return 0;
 }
 
-static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
-				  struct sk_buff *skb,
-				  struct sk_buff_head *list)
+static int xennet_fill_frags(struct netfront_queue *queue,
+			     struct sk_buff *skb,
+			     struct sk_buff_head *list)
 {
 	RING_IDX cons = queue->rx.rsp_cons;
 	struct sk_buff *nskb;
@@ -895,7 +895,7 @@ static RING_IDX xennet_fill_frags(struct
 		if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
 			queue->rx.rsp_cons = ++cons + skb_queue_len(list);
 			kfree_skb(nskb);
-			return ~0U;
+			return -ENOENT;
 		}
 
 		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
@@ -906,7 +906,9 @@ static RING_IDX xennet_fill_frags(struct
 		kfree_skb(nskb);
 	}
 
-	return cons;
+	queue->rx.rsp_cons = cons;
+
+	return 0;
 }
 
 static int checksum_setup(struct net_device *dev, struct sk_buff *skb)
@@ -1032,8 +1034,7 @@ err:
 		skb->data_len = rx->status;
 		skb->len += rx->status;
 
-		i = xennet_fill_frags(queue, skb, &tmpq);
-		if (unlikely(i == ~0U))
+		if (unlikely(xennet_fill_frags(queue, skb, &tmpq)))
 			goto err;
 
 		if (rx->flags & XEN_NETRXF_csum_blank)
@@ -1043,7 +1044,7 @@ err:
 
 		__skb_queue_tail(&rxq, skb);
 
-		queue->rx.rsp_cons = ++i;
+		i = ++queue->rx.rsp_cons;
 		work_done++;
 	}
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/pinctrl/pinctrl-tegra.c linux-libre-4.4.196-gnu/drivers/pinctrl/pinctrl-tegra.c
--- linux-libre-4.4.195-gnu/drivers/pinctrl/pinctrl-tegra.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/pinctrl/pinctrl-tegra.c	2019-10-07 15:01:07.000000000 -0400
@@ -52,7 +52,9 @@ static inline u32 pmx_readl(struct tegra
 
 static inline void pmx_writel(struct tegra_pmx *pmx, u32 val, u32 bank, u32 reg)
 {
-	writel(val, pmx->regs[bank] + reg);
+	writel_relaxed(val, pmx->regs[bank] + reg);
+	/* make sure pinmux register write completed */
+	pmx_readl(pmx, bank, reg);
 }
 
 static int tegra_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/scsi/scsi_logging.c linux-libre-4.4.196-gnu/drivers/scsi/scsi_logging.c
--- linux-libre-4.4.195-gnu/drivers/scsi/scsi_logging.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/scsi/scsi_logging.c	2019-10-07 15:01:07.000000000 -0400
@@ -16,57 +16,15 @@
 #include <scsi/scsi_eh.h>
 #include <scsi/scsi_dbg.h>
 
-#define SCSI_LOG_SPOOLSIZE 4096
-
-#if (SCSI_LOG_SPOOLSIZE / SCSI_LOG_BUFSIZE) > BITS_PER_LONG
-#warning SCSI logging bitmask too large
-#endif
-
-struct scsi_log_buf {
-	char buffer[SCSI_LOG_SPOOLSIZE];
-	unsigned long map;
-};
-
-static DEFINE_PER_CPU(struct scsi_log_buf, scsi_format_log);
-
 static char *scsi_log_reserve_buffer(size_t *len)
 {
-	struct scsi_log_buf *buf;
-	unsigned long map_bits = sizeof(buf->buffer) / SCSI_LOG_BUFSIZE;
-	unsigned long idx = 0;
-
-	preempt_disable();
-	buf = this_cpu_ptr(&scsi_format_log);
-	idx = find_first_zero_bit(&buf->map, map_bits);
-	if (likely(idx < map_bits)) {
-		while (test_and_set_bit(idx, &buf->map)) {
-			idx = find_next_zero_bit(&buf->map, map_bits, idx);
-			if (idx >= map_bits)
-				break;
-		}
-	}
-	if (WARN_ON(idx >= map_bits)) {
-		preempt_enable();
-		return NULL;
-	}
-	*len = SCSI_LOG_BUFSIZE;
-	return buf->buffer + idx * SCSI_LOG_BUFSIZE;
+	*len = 128;
+	return kmalloc(*len, GFP_ATOMIC);
 }
 
 static void scsi_log_release_buffer(char *bufptr)
 {
-	struct scsi_log_buf *buf;
-	unsigned long idx;
-	int ret;
-
-	buf = this_cpu_ptr(&scsi_format_log);
-	if (bufptr >= buf->buffer &&
-	    bufptr < buf->buffer + SCSI_LOG_SPOOLSIZE) {
-		idx = (bufptr - buf->buffer) / SCSI_LOG_BUFSIZE;
-		ret = test_and_clear_bit(idx, &buf->map);
-		WARN_ON(!ret);
-	}
-	preempt_enable();
+	kfree(bufptr);
 }
 
 static inline const char *scmd_name(const struct scsi_cmnd *scmd)
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/vfio/pci/vfio_pci.c linux-libre-4.4.196-gnu/drivers/vfio/pci/vfio_pci.c
--- linux-libre-4.4.195-gnu/drivers/vfio/pci/vfio_pci.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/vfio/pci/vfio_pci.c	2019-10-07 15:01:07.000000000 -0400
@@ -221,11 +221,20 @@ static void vfio_pci_disable(struct vfio
 	pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
 
 	/*
-	 * Try to reset the device.  The success of this is dependent on
-	 * being able to lock the device, which is not always possible.
+	 * Try to get the locks ourselves to prevent a deadlock. The
+	 * success of this is dependent on being able to lock the device,
+	 * which is not always possible.
+	 * We can not use the "try" reset interface here, which will
+	 * overwrite the previously restored configuration information.
 	 */
-	if (vdev->reset_works && !pci_try_reset_function(pdev))
-		vdev->needs_reset = false;
+	if (vdev->reset_works && pci_cfg_access_trylock(pdev)) {
+		if (device_trylock(&pdev->dev)) {
+			if (!__pci_reset_function_locked(pdev))
+				vdev->needs_reset = false;
+			device_unlock(&pdev->dev);
+		}
+		pci_cfg_access_unlock(pdev);
+	}
 
 	pci_restore_state(pdev);
 out:
diff -druNp --no-dereference linux-libre-4.4.195-gnu/drivers/video/fbdev/ssd1307fb.c linux-libre-4.4.196-gnu/drivers/video/fbdev/ssd1307fb.c
--- linux-libre-4.4.195-gnu/drivers/video/fbdev/ssd1307fb.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/drivers/video/fbdev/ssd1307fb.c	2019-10-07 15:01:07.000000000 -0400
@@ -421,7 +421,7 @@ static int ssd1307fb_init(struct ssd1307
 	if (ret < 0)
 		return ret;
 
-	ret = ssd1307fb_write_cmd(par->client, 0x0);
+	ret = ssd1307fb_write_cmd(par->client, par->page_offset);
 	if (ret < 0)
 		return ret;
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/fs/fat/dir.c linux-libre-4.4.196-gnu/fs/fat/dir.c
--- linux-libre-4.4.195-gnu/fs/fat/dir.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/fs/fat/dir.c	2019-10-07 15:01:07.000000000 -0400
@@ -1097,8 +1097,11 @@ static int fat_zeroed_cluster(struct ino
 			err = -ENOMEM;
 			goto error;
 		}
+		/* Avoid race with userspace read via bdev */
+		lock_buffer(bhs[n]);
 		memset(bhs[n]->b_data, 0, sb->s_blocksize);
 		set_buffer_uptodate(bhs[n]);
+		unlock_buffer(bhs[n]);
 		mark_buffer_dirty_inode(bhs[n], dir);
 
 		n++;
@@ -1155,6 +1158,8 @@ int fat_alloc_new_dir(struct inode *dir,
 	fat_time_unix2fat(sbi, ts, &time, &date, &time_cs);
 
 	de = (struct msdos_dir_entry *)bhs[0]->b_data;
+	/* Avoid race with userspace read via bdev */
+	lock_buffer(bhs[0]);
 	/* filling the new directory slots ("." and ".." entries) */
 	memcpy(de[0].name, MSDOS_DOT, MSDOS_NAME);
 	memcpy(de[1].name, MSDOS_DOTDOT, MSDOS_NAME);
@@ -1177,6 +1182,7 @@ int fat_alloc_new_dir(struct inode *dir,
 	de[0].size = de[1].size = 0;
 	memset(de + 2, 0, sb->s_blocksize - 2 * sizeof(*de));
 	set_buffer_uptodate(bhs[0]);
+	unlock_buffer(bhs[0]);
 	mark_buffer_dirty_inode(bhs[0], dir);
 
 	err = fat_zeroed_cluster(dir, blknr, 1, bhs, MAX_BUF_PER_PAGE);
@@ -1234,11 +1240,14 @@ static int fat_add_new_entries(struct in
 
 			/* fill the directory entry */
 			copy = min(size, sb->s_blocksize);
+			/* Avoid race with userspace read via bdev */
+			lock_buffer(bhs[n]);
 			memcpy(bhs[n]->b_data, slots, copy);
-			slots += copy;
-			size -= copy;
 			set_buffer_uptodate(bhs[n]);
+			unlock_buffer(bhs[n]);
 			mark_buffer_dirty_inode(bhs[n], dir);
+			slots += copy;
+			size -= copy;
 			if (!size)
 				break;
 			n++;
diff -druNp --no-dereference linux-libre-4.4.195-gnu/fs/fat/fatent.c linux-libre-4.4.196-gnu/fs/fat/fatent.c
--- linux-libre-4.4.195-gnu/fs/fat/fatent.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/fs/fat/fatent.c	2019-10-07 15:01:07.000000000 -0400
@@ -389,8 +389,11 @@ static int fat_mirror_bhs(struct super_b
 				err = -ENOMEM;
 				goto error;
 			}
+			/* Avoid race with userspace read via bdev */
+			lock_buffer(c_bh);
 			memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize);
 			set_buffer_uptodate(c_bh);
+			unlock_buffer(c_bh);
 			mark_buffer_dirty_inode(c_bh, sbi->fat_inode);
 			if (sb->s_flags & MS_SYNCHRONOUS)
 				err = sync_dirty_buffer(c_bh);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/fs/ocfs2/dlm/dlmunlock.c linux-libre-4.4.196-gnu/fs/ocfs2/dlm/dlmunlock.c
--- linux-libre-4.4.195-gnu/fs/ocfs2/dlm/dlmunlock.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/fs/ocfs2/dlm/dlmunlock.c	2019-10-07 15:01:07.000000000 -0400
@@ -105,7 +105,8 @@ static enum dlm_status dlmunlock_common(
 	enum dlm_status status;
 	int actions = 0;
 	int in_use;
-        u8 owner;
+	u8 owner;
+	int recovery_wait = 0;
 
 	mlog(0, "master_node = %d, valblk = %d\n", master_node,
 	     flags & LKM_VALBLK);
@@ -208,9 +209,12 @@ static enum dlm_status dlmunlock_common(
 		}
 		if (flags & LKM_CANCEL)
 			lock->cancel_pending = 0;
-		else
-			lock->unlock_pending = 0;
-
+		else {
+			if (!lock->unlock_pending)
+				recovery_wait = 1;
+			else
+				lock->unlock_pending = 0;
+		}
 	}
 
 	/* get an extra ref on lock.  if we are just switching
@@ -244,6 +248,17 @@ leave:
 	spin_unlock(&res->spinlock);
 	wake_up(&res->wq);
 
+	if (recovery_wait) {
+		spin_lock(&res->spinlock);
+		/* Unlock request will directly succeed after owner dies,
+		 * and the lock is already removed from grant list. We have to
+		 * wait for RECOVERING done or we miss the chance to purge it
+		 * since the removement is much faster than RECOVERING proc.
+		 */
+		__dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_RECOVERING);
+		spin_unlock(&res->spinlock);
+	}
+
 	/* let the caller's final dlm_lock_put handle the actual kfree */
 	if (actions & DLM_UNLOCK_FREE_LOCK) {
 		/* this should always be coupled with list removal */
diff -druNp --no-dereference linux-libre-4.4.195-gnu/include/scsi/scsi_dbg.h linux-libre-4.4.196-gnu/include/scsi/scsi_dbg.h
--- linux-libre-4.4.195-gnu/include/scsi/scsi_dbg.h	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/include/scsi/scsi_dbg.h	2019-10-07 15:01:07.000000000 -0400
@@ -5,8 +5,6 @@ struct scsi_cmnd;
 struct scsi_device;
 struct scsi_sense_hdr;
 
-#define SCSI_LOG_BUFSIZE 128
-
 extern void scsi_print_command(struct scsi_cmnd *);
 extern size_t __scsi_format_command(char *, size_t,
 				   const unsigned char *, size_t);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/lib/Kconfig.debug linux-libre-4.4.196-gnu/lib/Kconfig.debug
--- linux-libre-4.4.195-gnu/lib/Kconfig.debug	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/lib/Kconfig.debug	2019-10-07 15:01:07.000000000 -0400
@@ -521,7 +521,7 @@ config DEBUG_KMEMLEAK_EARLY_LOG_SIZE
 	int "Maximum kmemleak early log entries"
 	depends on DEBUG_KMEMLEAK
 	range 200 40000
-	default 400
+	default 16000
 	help
 	  Kmemleak must track all the memory allocations to avoid
 	  reporting false positives. Since memory may be allocated or
diff -druNp --no-dereference linux-libre-4.4.195-gnu/Makefile linux-libre-4.4.196-gnu/Makefile
--- linux-libre-4.4.195-gnu/Makefile	2019-10-05 13:43:43.000000000 -0400
+++ linux-libre-4.4.196-gnu/Makefile	2019-10-08 01:41:48.000000000 -0400
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 195
+SUBLEVEL = 196
 EXTRAVERSION = -gnu
 NAME = Blurry Fish Butt
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/ipv4/route.c linux-libre-4.4.196-gnu/net/ipv4/route.c
--- linux-libre-4.4.195-gnu/net/ipv4/route.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/ipv4/route.c	2019-10-07 15:01:07.000000000 -0400
@@ -897,16 +897,15 @@ void ip_rt_send_redirect(struct sk_buff
 	if (peer->rate_tokens == 0 ||
 	    time_after(jiffies,
 		       (peer->rate_last +
-			(ip_rt_redirect_load << peer->rate_tokens)))) {
+			(ip_rt_redirect_load << peer->n_redirects)))) {
 		__be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr);
 
 		icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
 		peer->rate_last = jiffies;
-		++peer->rate_tokens;
 		++peer->n_redirects;
 #ifdef CONFIG_IP_ROUTE_VERBOSE
 		if (log_martians &&
-		    peer->rate_tokens == ip_rt_redirect_number)
+		    peer->n_redirects == ip_rt_redirect_number)
 			net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
 					     &ip_hdr(skb)->saddr, inet_iif(skb),
 					     &ip_hdr(skb)->daddr, &gw);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/ipv6/ip6_input.c linux-libre-4.4.196-gnu/net/ipv6/ip6_input.c
--- linux-libre-4.4.195-gnu/net/ipv6/ip6_input.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/ipv6/ip6_input.c	2019-10-07 15:01:07.000000000 -0400
@@ -151,6 +151,16 @@ int ipv6_rcv(struct sk_buff *skb, struct
 	if (ipv6_addr_is_multicast(&hdr->saddr))
 		goto err;
 
+	/* While RFC4291 is not explicit about v4mapped addresses
+	 * in IPv6 headers, it seems clear linux dual-stack
+	 * model can not deal properly with these.
+	 * Security models could be fooled by ::ffff:127.0.0.1 for example.
+	 *
+	 * https://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02
+	 */
+	if (ipv6_addr_v4mapped(&hdr->saddr))
+		goto err;
+
 	skb->transport_header = skb->network_header + sizeof(*hdr);
 	IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/nfc/llcp_sock.c linux-libre-4.4.196-gnu/net/nfc/llcp_sock.c
--- linux-libre-4.4.195-gnu/net/nfc/llcp_sock.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/nfc/llcp_sock.c	2019-10-07 15:01:07.000000000 -0400
@@ -118,9 +118,14 @@ static int llcp_sock_bind(struct socket
 	llcp_sock->service_name = kmemdup(llcp_addr.service_name,
 					  llcp_sock->service_name_len,
 					  GFP_KERNEL);
-
+	if (!llcp_sock->service_name) {
+		ret = -ENOMEM;
+		goto put_dev;
+	}
 	llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
 	if (llcp_sock->ssap == LLCP_SAP_MAX) {
+		kfree(llcp_sock->service_name);
+		llcp_sock->service_name = NULL;
 		ret = -EADDRINUSE;
 		goto put_dev;
 	}
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/nfc/netlink.c linux-libre-4.4.196-gnu/net/nfc/netlink.c
--- linux-libre-4.4.195-gnu/net/nfc/netlink.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/nfc/netlink.c	2019-10-07 15:01:07.000000000 -0400
@@ -936,7 +936,8 @@ static int nfc_genl_dep_link_down(struct
 	int rc;
 	u32 idx;
 
-	if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
+	if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
+	    !info->attrs[NFC_ATTR_TARGET_INDEX])
 		return -EINVAL;
 
 	idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
@@ -985,7 +986,8 @@ static int nfc_genl_llc_get_params(struc
 	struct sk_buff *msg = NULL;
 	u32 idx;
 
-	if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
+	if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
+	    !info->attrs[NFC_ATTR_FIRMWARE_NAME])
 		return -EINVAL;
 
 	idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/rds/ib.c linux-libre-4.4.196-gnu/net/rds/ib.c
--- linux-libre-4.4.195-gnu/net/rds/ib.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/rds/ib.c	2019-10-07 15:01:07.000000000 -0400
@@ -146,6 +146,9 @@ static void rds_ib_add_one(struct ib_dev
 	atomic_set(&rds_ibdev->refcount, 1);
 	INIT_WORK(&rds_ibdev->free_work, rds_ib_dev_free);
 
+	INIT_LIST_HEAD(&rds_ibdev->ipaddr_list);
+	INIT_LIST_HEAD(&rds_ibdev->conn_list);
+
 	rds_ibdev->max_wrs = dev_attr->max_qp_wr;
 	rds_ibdev->max_sge = min(dev_attr->max_sge, RDS_IB_MAX_SGE);
 
@@ -187,9 +190,6 @@ static void rds_ib_add_one(struct ib_dev
 		 rds_ibdev->fmr_max_remaps, rds_ibdev->max_1m_fmrs,
 		 rds_ibdev->max_8k_fmrs);
 
-	INIT_LIST_HEAD(&rds_ibdev->ipaddr_list);
-	INIT_LIST_HEAD(&rds_ibdev->conn_list);
-
 	down_write(&rds_ib_devices_lock);
 	list_add_tail_rcu(&rds_ibdev->list, &rds_ib_devices);
 	up_write(&rds_ib_devices_lock);
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/sched/sch_cbq.c linux-libre-4.4.196-gnu/net/sched/sch_cbq.c
--- linux-libre-4.4.195-gnu/net/sched/sch_cbq.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/sched/sch_cbq.c	2019-10-07 15:01:07.000000000 -0400
@@ -1340,6 +1340,26 @@ static const struct nla_policy cbq_polic
 	[TCA_CBQ_POLICE]	= { .len = sizeof(struct tc_cbq_police) },
 };
 
+static int cbq_opt_parse(struct nlattr *tb[TCA_CBQ_MAX + 1], struct nlattr *opt)
+{
+	int err;
+
+	if (!opt)
+		return -EINVAL;
+
+	err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy);
+	if (err < 0)
+		return err;
+
+	if (tb[TCA_CBQ_WRROPT]) {
+		const struct tc_cbq_wrropt *wrr = nla_data(tb[TCA_CBQ_WRROPT]);
+
+		if (wrr->priority > TC_CBQ_MAXPRIO)
+			err = -EINVAL;
+	}
+	return err;
+}
+
 static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
 {
 	struct cbq_sched_data *q = qdisc_priv(sch);
@@ -1347,7 +1367,7 @@ static int cbq_init(struct Qdisc *sch, s
 	struct tc_ratespec *r;
 	int err;
 
-	err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy);
+	err = cbq_opt_parse(tb, opt);
 	if (err < 0)
 		return err;
 
@@ -1728,10 +1748,7 @@ cbq_change_class(struct Qdisc *sch, u32
 	struct cbq_class *parent;
 	struct qdisc_rate_table *rtab = NULL;
 
-	if (opt == NULL)
-		return -EINVAL;
-
-	err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy);
+	err = cbq_opt_parse(tb, opt);
 	if (err < 0)
 		return err;
 
diff -druNp --no-dereference linux-libre-4.4.195-gnu/net/sched/sch_dsmark.c linux-libre-4.4.196-gnu/net/sched/sch_dsmark.c
--- linux-libre-4.4.195-gnu/net/sched/sch_dsmark.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/net/sched/sch_dsmark.c	2019-10-07 15:01:07.000000000 -0400
@@ -362,6 +362,8 @@ static int dsmark_init(struct Qdisc *sch
 		goto errout;
 
 	err = -EINVAL;
+	if (!tb[TCA_DSMARK_INDICES])
+		goto errout;
 	indices = nla_get_u16(tb[TCA_DSMARK_INDICES]);
 
 	if (hweight32(indices) != 1)
diff -druNp --no-dereference linux-libre-4.4.195-gnu/security/smack/smack_access.c linux-libre-4.4.196-gnu/security/smack/smack_access.c
--- linux-libre-4.4.195-gnu/security/smack/smack_access.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/security/smack/smack_access.c	2019-10-07 15:01:07.000000000 -0400
@@ -474,7 +474,7 @@ char *smk_parse_smack(const char *string
 	if (i == 0 || i >= SMK_LONGLABEL)
 		return ERR_PTR(-EINVAL);
 
-	smack = kzalloc(i + 1, GFP_KERNEL);
+	smack = kzalloc(i + 1, GFP_NOFS);
 	if (smack == NULL)
 		return ERR_PTR(-ENOMEM);
 
@@ -545,7 +545,7 @@ struct smack_known *smk_import_entry(con
 	if (skp != NULL)
 		goto freeout;
 
-	skp = kzalloc(sizeof(*skp), GFP_KERNEL);
+	skp = kzalloc(sizeof(*skp), GFP_NOFS);
 	if (skp == NULL) {
 		skp = ERR_PTR(-ENOMEM);
 		goto freeout;
diff -druNp --no-dereference linux-libre-4.4.195-gnu/security/smack/smack_lsm.c linux-libre-4.4.196-gnu/security/smack/smack_lsm.c
--- linux-libre-4.4.195-gnu/security/smack/smack_lsm.c	2019-10-05 06:27:56.000000000 -0400
+++ linux-libre-4.4.196-gnu/security/smack/smack_lsm.c	2019-10-07 15:01:07.000000000 -0400
@@ -268,7 +268,7 @@ static struct smack_known *smk_fetch(con
 	if (ip->i_op->getxattr == NULL)
 		return ERR_PTR(-EOPNOTSUPP);
 
-	buffer = kzalloc(SMK_LONGLABEL, GFP_KERNEL);
+	buffer = kzalloc(SMK_LONGLABEL, GFP_NOFS);
 	if (buffer == NULL)
 		return ERR_PTR(-ENOMEM);
 
@@ -932,7 +932,8 @@ static int smack_bprm_set_creds(struct l
 
 		if (rc != 0)
 			return rc;
-	} else if (bprm->unsafe)
+	}
+	if (bprm->unsafe & ~LSM_UNSAFE_PTRACE)
 		return -EPERM;
 
 	bsp->smk_task = isp->smk_task;
@@ -3986,6 +3987,8 @@ access_check:
 			skp = smack_ipv6host_label(&sadd);
 		if (skp == NULL)
 			skp = smack_net_ambient;
+		if (skb == NULL)
+			break;
 #ifdef CONFIG_AUDIT
 		smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
 		ad.a.u.net->family = sk->sk_family;
