--- /dev/null
+From 47b2c3fff4932e6fc17ce13d51a43c6969714e20 Mon Sep 17 00:00:00 2001
+From: Bilal Amarni <bilal.amarni@gmail.com>
+Date: Thu, 8 Jun 2017 14:47:26 +0100
+Subject: security/keys: add CONFIG_KEYS_COMPAT to Kconfig
+
+From: Bilal Amarni <bilal.amarni@gmail.com>
+
+commit 47b2c3fff4932e6fc17ce13d51a43c6969714e20 upstream.
+
+CONFIG_KEYS_COMPAT is defined in arch-specific Kconfigs and is missing for
+several 64-bit architectures : mips, parisc, tile.
+
+At the moment and for those architectures, calling in 32-bit userspace the
+keyctl syscall would return an ENOSYS error.
+
+This patch moves the CONFIG_KEYS_COMPAT option to security/keys/Kconfig, to
+make sure the compatibility wrapper is registered by default for any 64-bit
+architecture as long as it is configured with CONFIG_COMPAT.
+
+[DH: Modified to remove arm64 compat enablement also as requested by Eric
+ Biggers]
+
+Signed-off-by: Bilal Amarni <bilal.amarni@gmail.com>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Reviewed-by: Arnd Bergmann <arnd@arndb.de>
+cc: Eric Biggers <ebiggers3@gmail.com>
+Signed-off-by: James Morris <james.l.morris@oracle.com>
+Cc: James Cowgill <james.cowgill@mips.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/Kconfig | 5 -----
+ arch/s390/Kconfig | 3 ---
+ arch/sparc/Kconfig | 3 ---
+ arch/x86/Kconfig | 4 ----
+ security/keys/Kconfig | 4 ++++
+ 5 files changed, 4 insertions(+), 15 deletions(-)
+
+--- a/arch/powerpc/Kconfig
++++ b/arch/powerpc/Kconfig
+@@ -1070,11 +1070,6 @@ source "arch/powerpc/Kconfig.debug"
+
+ source "security/Kconfig"
+
+-config KEYS_COMPAT
+- bool
+- depends on COMPAT && KEYS
+- default y
+-
+ source "crypto/Kconfig"
+
+ config PPC_LIB_RHEAP
+--- a/arch/s390/Kconfig
++++ b/arch/s390/Kconfig
+@@ -332,9 +332,6 @@ config COMPAT
+ config SYSVIPC_COMPAT
+ def_bool y if COMPAT && SYSVIPC
+
+-config KEYS_COMPAT
+- def_bool y if COMPAT && KEYS
+-
+ config SMP
+ def_bool y
+ prompt "Symmetric multi-processing support"
+--- a/arch/sparc/Kconfig
++++ b/arch/sparc/Kconfig
+@@ -542,9 +542,6 @@ config SYSVIPC_COMPAT
+ depends on COMPAT && SYSVIPC
+ default y
+
+-config KEYS_COMPAT
+- def_bool y if COMPAT && KEYS
+-
+ endmenu
+
+ source "net/Kconfig"
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -2471,10 +2471,6 @@ config COMPAT_FOR_U64_ALIGNMENT
+ config SYSVIPC_COMPAT
+ def_bool y
+ depends on SYSVIPC
+-
+-config KEYS_COMPAT
+- def_bool y
+- depends on KEYS
+ endif
+
+ endmenu
+--- a/security/keys/Kconfig
++++ b/security/keys/Kconfig
+@@ -20,6 +20,10 @@ config KEYS
+
+ If you are unsure as to whether this is required, answer N.
+
++config KEYS_COMPAT
++ def_bool y
++ depends on COMPAT && KEYS
++
+ config PERSISTENT_KEYRINGS
+ bool "Enable register of persistent per-UID keyrings"
+ depends on KEYS
--- /dev/null
+From 59b6986dbfcdab96a971f9663221849de79a7556 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bart.vanassche@sandisk.com>
+Date: Thu, 5 Jan 2017 12:39:57 +0100
+Subject: target/iscsi: Fix iSCSI task reassignment handling
+
+From: Bart Van Assche <bart.vanassche@sandisk.com>
+
+commit 59b6986dbfcdab96a971f9663221849de79a7556 upstream.
+
+Allocate a task management request structure for all task management
+requests, including task reassignment. This change avoids that the
+se_tmr->response assignment dereferences an uninitialized se_tmr
+pointer.
+
+Reported-by: Moshe David <mdavid@infinidat.com>
+Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Cc: Moshe David <mdavid@infinidat.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+
+---
+ drivers/target/iscsi/iscsi_target.c | 19 +++++++------------
+ include/target/target_core_base.h | 1 +
+ 2 files changed, 8 insertions(+), 12 deletions(-)
+
+--- a/drivers/target/iscsi/iscsi_target.c
++++ b/drivers/target/iscsi/iscsi_target.c
+@@ -1749,7 +1749,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_
+ struct iscsi_tm *hdr;
+ int out_of_order_cmdsn = 0, ret;
+ bool sess_ref = false;
+- u8 function;
++ u8 function, tcm_function = TMR_UNKNOWN;
+
+ hdr = (struct iscsi_tm *) buf;
+ hdr->flags &= ~ISCSI_FLAG_CMD_FINAL;
+@@ -1795,10 +1795,6 @@ iscsit_handle_task_mgt_cmd(struct iscsi_
+ * LIO-Target $FABRIC_MOD
+ */
+ if (function != ISCSI_TM_FUNC_TASK_REASSIGN) {
+-
+- u8 tcm_function;
+- int ret;
+-
+ transport_init_se_cmd(&cmd->se_cmd,
+ &lio_target_fabric_configfs->tf_ops,
+ conn->sess->se_sess, 0, DMA_NONE,
+@@ -1835,15 +1831,14 @@ iscsit_handle_task_mgt_cmd(struct iscsi_
+ return iscsit_add_reject_cmd(cmd,
+ ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf);
+ }
+-
+- ret = core_tmr_alloc_req(&cmd->se_cmd, cmd->tmr_req,
+- tcm_function, GFP_KERNEL);
+- if (ret < 0)
+- return iscsit_add_reject_cmd(cmd,
++ }
++ ret = core_tmr_alloc_req(&cmd->se_cmd, cmd->tmr_req, tcm_function,
++ GFP_KERNEL);
++ if (ret < 0)
++ return iscsit_add_reject_cmd(cmd,
+ ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf);
+
+- cmd->tmr_req->se_tmr_req = cmd->se_cmd.se_tmr_req;
+- }
++ cmd->tmr_req->se_tmr_req = cmd->se_cmd.se_tmr_req;
+
+ cmd->iscsi_opcode = ISCSI_OP_SCSI_TMFUNC;
+ cmd->i_state = ISTATE_SEND_TASKMGTRSP;
+--- a/include/target/target_core_base.h
++++ b/include/target/target_core_base.h
+@@ -231,6 +231,7 @@ enum tcm_tmreq_table {
+ TMR_LUN_RESET = 5,
+ TMR_TARGET_WARM_RESET = 6,
+ TMR_TARGET_COLD_RESET = 7,
++ TMR_UNKNOWN = 0xff,
+ };
+
+ /* fabric independent task management response values */