--- /dev/null
+From d1f3b65d2d6fdb4bf0edd4b67e86e191af48daee Mon Sep 17 00:00:00 2001
+From: Nathan Williams <nathan@traverse.com.au>
+Date: Thu, 22 Nov 2012 10:42:52 +1100
+Subject: mtd cs553x_nand: Initialise ecc.strength before nand_scan()
+
+From: Nathan Williams <nathan@traverse.com.au>
+
+commit d1f3b65d2d6fdb4bf0edd4b67e86e191af48daee upstream.
+
+Loading cs553x_nand with Hynix H27U1G8F2BTR NAND flash causes this bug:
+
+kernel BUG at drivers/mtd/nand/nand_base.c:3345!
+invalid opcode: 0000 [#1]
+Modules linked in: cs553x_nand(+) vfat fat usb_storage ehci_hcd usbcore usb_comr
+Pid: 436, comm: modprobe Not tainted 3.6.7 #1
+EIP: 0060:[<c118d205>] EFLAGS: 00010296 CPU: 0
+EIP is at nand_scan_tail+0x64c/0x69c
+EAX: 00000034 EBX: cea6ed98 ECX: 00000000 EDX: 00000000
+ESI: cea6ec00 EDI: cea6ec00 EBP: 20000000 ESP: cdd17e48
+ DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
+CR0: 8005003b CR2: 0804e119 CR3: 0d850000 CR4: 00000090
+DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
+DR6: ffff0ff0 DR7: 00000400
+Process modprobe (pid: 436, ti=cdd16000 task=cdd1c320 task.ti=cdd16000)
+Stack:
+ c12e962c c118f7ef 00000003 cea6ed98 d014b25c 20000000 fffff007 00000001
+ 00000000 cdd53b00 d014b000 c1001021 cdd53b00 d01493c0 cdd53b00 cdd53b00
+ d01493c0 c1047f83 d014b4a0 00000000 cdd17f9c ce4be454 cdd17f48 cdd1c320
+Call Trace:
+ [<c118f7ef>] ? nand_scan+0x1b/0x4d
+ [<d014b25c>] ? init_module+0x25c/0x2de [cs553x_nand]
+ [<d014b000>] ? 0xd014afff
+ [<c1001021>] ? do_one_initcall+0x21/0x111
+ [<c1047f83>] ? sys_init_module+0xe4/0x1261
+ [<c1031207>] ? task_work_run+0x36/0x43
+ [<c1265ced>] ? syscall_call+0x7/0xb
+Code: fa ff ff c7 86 d8 00 00 00 01 00 00 00 e9 5f fc ff ff 68 f8 26 2e c1 e8 a7
+EIP: [<c118d205>] nand_scan_tail+0x64c/0x69c SS:ESP 0068:cdd17e48
+
+Initialising ecc.strength before the call to nand_scan() fixes this.
+
+Signed-off-by: Nathan Williams <nathan@traverse.com.au>
+Acked-by: Brian Norris <computersforpeace@gmail.com>
+Acked-by: Mike Dunn <mikedunn@newsguy.com>
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/nand/cs553x_nand.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/mtd/nand/cs553x_nand.c
++++ b/drivers/mtd/nand/cs553x_nand.c
+@@ -237,6 +237,7 @@ static int __init cs553x_init_one(int cs
+ this->ecc.hwctl = cs_enable_hwecc;
+ this->ecc.calculate = cs_calculate_ecc;
+ this->ecc.correct = nand_correct_data;
++ this->ecc.strength = 1;
+
+ /* Enable the following for a flash based bad block table */
+ this->bbt_options = NAND_BBT_USE_FLASH;
+@@ -248,8 +249,6 @@ static int __init cs553x_init_one(int cs
+ goto out_ior;
+ }
+
+- this->ecc.strength = 1;
+-
+ new_mtd->name = kasprintf(GFP_KERNEL, "cs553x_nand_cs%d", cs);
+
+ cs553x_mtd[cs] = new_mtd;
--- /dev/null
+From 6f2a6a52560ad8d85710aabd92b7a3239b3a6b07 Mon Sep 17 00:00:00 2001
+From: Wolfram Sang <w.sang@pengutronix.de>
+Date: Wed, 5 Dec 2012 21:46:02 +0100
+Subject: mtd: nand: gpmi: reset BCH earlier, too, to avoid NAND startup problems
+
+From: Wolfram Sang <w.sang@pengutronix.de>
+
+commit 6f2a6a52560ad8d85710aabd92b7a3239b3a6b07 upstream.
+
+It could happen (1 out of 100 times) that NAND did not start up
+correctly after warm rebooting, so the kernel could not find the UBI or
+DMA timed out due to a stalled BCH. When resetting BCH together with
+GPMI, the issue could not be observed anymore (after 10000+ reboots). We
+probably need the consistent state already before sending any command to
+NAND, even when no ECC is needed. I chose to keep the extra reset for
+BCH when changing the flash layout to be on the safe side.
+
+Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
+Acked-by: Huang Shijie <b32955@freescale.com>
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
++++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+@@ -135,6 +135,15 @@ int gpmi_init(struct gpmi_nand_data *thi
+ if (ret)
+ goto err_out;
+
++ /*
++ * Reset BCH here, too. We got failures otherwise :(
++ * See later BCH reset for explanation of MX23 handling
++ */
++ ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this));
++ if (ret)
++ goto err_out;
++
++
+ /* Choose NAND mode. */
+ writel(BM_GPMI_CTRL1_GPMI_MODE, r->gpmi_regs + HW_GPMI_CTRL1_CLR);
+
mfd-only-unregister-platform-devices-allocated-by-the-mfd-core.patch
ext4-fix-memory-leak-in-ext4_xattr_set_acl-s-error-path.patch
ext4-fix-possible-use-after-free-with-metadata-csum.patch
+mtd-cs553x_nand-initialise-ecc.strength-before-nand_scan.patch
+mtd-nand-gpmi-reset-bch-earlier-too-to-avoid-nand-startup-problems.patch
+sunrpc-continue-run-over-clients-list-on-pipefs-event-instead-of-break.patch
+sunrpc-ensure-that-we-free-the-rpc_task-after-cleanups-are-done.patch
+sunrpc-ensure-we-release-the-socket-write-lock-if-the-rpc_task-exits-early.patch
--- /dev/null
+From cd6c5968582a273561464fe6b1e8cc8214be02df Mon Sep 17 00:00:00 2001
+From: Stanislav Kinsbursky <skinsbursky@parallels.com>
+Date: Mon, 17 Dec 2012 20:18:52 +0300
+Subject: SUNRPC: continue run over clients list on PipeFS event instead of break
+
+From: Stanislav Kinsbursky <skinsbursky@parallels.com>
+
+commit cd6c5968582a273561464fe6b1e8cc8214be02df upstream.
+
+There are SUNRPC clients, which program doesn't have pipe_dir_name. These
+clients can be skipped on PipeFS events, because nothing have to be created or
+destroyed. But instead of breaking in case of such a client was found, search
+for suitable client over clients list have to be continued. Otherwise some
+clients could not be covered by PipeFS event handler.
+
+Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/clnt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/sunrpc/clnt.c
++++ b/net/sunrpc/clnt.c
+@@ -236,7 +236,7 @@ static struct rpc_clnt *rpc_get_client_f
+ spin_lock(&sn->rpc_client_lock);
+ list_for_each_entry(clnt, &sn->all_clients, cl_clients) {
+ if (clnt->cl_program->pipe_dir_name == NULL)
+- break;
++ continue;
+ if (rpc_clnt_skip_event(clnt, event))
+ continue;
+ if (atomic_inc_not_zero(&clnt->cl_count) == 0)
--- /dev/null
+From c6567ed1402c55e19b012e66a8398baec2a726f3 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Fri, 4 Jan 2013 12:23:21 -0500
+Subject: SUNRPC: Ensure that we free the rpc_task after cleanups are done
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit c6567ed1402c55e19b012e66a8398baec2a726f3 upstream.
+
+This patch ensures that we free the rpc_task after the cleanup callbacks
+are done in order to avoid a deadlock problem that can be triggered if
+the callback needs to wait for another workqueue item to complete.
+
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Cc: Weston Andros Adamson <dros@netapp.com>
+Cc: Tejun Heo <tj@kernel.org>
+Cc: Bruce Fields <bfields@fieldses.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/sched.c | 27 +++++++++++++++++++++++----
+ 1 file changed, 23 insertions(+), 4 deletions(-)
+
+--- a/net/sunrpc/sched.c
++++ b/net/sunrpc/sched.c
+@@ -915,16 +915,35 @@ struct rpc_task *rpc_new_task(const stru
+ return task;
+ }
+
++/*
++ * rpc_free_task - release rpc task and perform cleanups
++ *
++ * Note that we free up the rpc_task _after_ rpc_release_calldata()
++ * in order to work around a workqueue dependency issue.
++ *
++ * Tejun Heo states:
++ * "Workqueue currently considers two work items to be the same if they're
++ * on the same address and won't execute them concurrently - ie. it
++ * makes a work item which is queued again while being executed wait
++ * for the previous execution to complete.
++ *
++ * If a work function frees the work item, and then waits for an event
++ * which should be performed by another work item and *that* work item
++ * recycles the freed work item, it can create a false dependency loop.
++ * There really is no reliable way to detect this short of verifying
++ * every memory free."
++ *
++ */
+ static void rpc_free_task(struct rpc_task *task)
+ {
+- const struct rpc_call_ops *tk_ops = task->tk_ops;
+- void *calldata = task->tk_calldata;
++ unsigned short tk_flags = task->tk_flags;
+
+- if (task->tk_flags & RPC_TASK_DYNAMIC) {
++ rpc_release_calldata(task->tk_ops, task->tk_calldata);
++
++ if (tk_flags & RPC_TASK_DYNAMIC) {
+ dprintk("RPC: %5u freeing task\n", task->tk_pid);
+ mempool_free(task, rpc_task_mempool);
+ }
+- rpc_release_calldata(tk_ops, calldata);
+ }
+
+ static void rpc_async_release(struct work_struct *work)
--- /dev/null
+From 87ed50036b866db2ec2ba16b2a7aec4a2b0b7c39 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Mon, 7 Jan 2013 14:30:46 -0500
+Subject: SUNRPC: Ensure we release the socket write lock if the rpc_task exits early
+
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+
+commit 87ed50036b866db2ec2ba16b2a7aec4a2b0b7c39 upstream.
+
+If the rpc_task exits while holding the socket write lock before it has
+allocated an rpc slot, then the usual mechanism for releasing the write
+lock in xprt_release() is defeated.
+
+The problem occurs if the call to xprt_lock_write() initially fails, so
+that the rpc_task is put on the xprt->sending wait queue. If the task
+exits after being assigned the lock by __xprt_lock_write_func, but
+before it has retried the call to xprt_lock_and_alloc_slot(), then
+it calls xprt_release() while holding the write lock, but will
+immediately exit due to the test for task->tk_rqstp != NULL.
+
+Reported-by: Chris Perl <chris.perl@gmail.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/sunrpc/sched.c | 3 +--
+ net/sunrpc/xprt.c | 12 ++++++++++--
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+--- a/net/sunrpc/sched.c
++++ b/net/sunrpc/sched.c
+@@ -953,8 +953,7 @@ static void rpc_async_release(struct wor
+
+ static void rpc_release_resources_task(struct rpc_task *task)
+ {
+- if (task->tk_rqstp)
+- xprt_release(task);
++ xprt_release(task);
+ if (task->tk_msg.rpc_cred) {
+ put_rpccred(task->tk_msg.rpc_cred);
+ task->tk_msg.rpc_cred = NULL;
+--- a/net/sunrpc/xprt.c
++++ b/net/sunrpc/xprt.c
+@@ -1139,10 +1139,18 @@ static void xprt_request_init(struct rpc
+ void xprt_release(struct rpc_task *task)
+ {
+ struct rpc_xprt *xprt;
+- struct rpc_rqst *req;
++ struct rpc_rqst *req = task->tk_rqstp;
+
+- if (!(req = task->tk_rqstp))
++ if (req == NULL) {
++ if (task->tk_client) {
++ rcu_read_lock();
++ xprt = rcu_dereference(task->tk_client->cl_xprt);
++ if (xprt->snd_task == task)
++ xprt_release_write(xprt, task);
++ rcu_read_unlock();
++ }
+ return;
++ }
+
+ xprt = req->rq_xprt;
+ if (task->tk_ops->rpc_count_stats != NULL)