All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Cook <greg@morpheus.ws>
To: ezequiel.garcia@free-electrons.com, linux-mtd@lists.infradead.org
Cc: Greg Cook <greg@morpheus.ws>,
	miquel.raynal@free-electrons.com, sean.nyekjaer@prevas.dk
Subject: [PATCH] Fix OOB_READ bug where hardware FIFO is not drained completely. Fix potential bug for non-ECC operations.
Date: Tue, 12 Dec 2017 16:38:26 +0800	[thread overview]
Message-ID: <20171212083826.5000-1-greg@morpheus.ws> (raw)

Signed-off-by: Greg Cook <greg@morpheus.ws>
---
 drivers/mtd/nand/pxa3xx_nand.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 021374f..cfa8c71 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -677,7 +677,7 @@ static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask)
 
 static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
 {
-	if (info->ecc_bch) {
+	if (info->use_ecc && info->ecc_bch) {
 		u32 val;
 		int ret;
 
@@ -1023,7 +1023,12 @@ static int prepare_set_command(struct pxa3xx_nand_info *info, int command,
 
 		if (info->cur_chunk < info->nfullchunks) {
 			info->step_chunk_size = info->chunk_size;
-			info->step_spare_size = info->spare_size;
+			if (info->use_ecc) {
+				info->step_spare_size = info->spare_size;
+			} else {
+				info->step_spare_size = info->spare_size
+							+ info->ecc_size;
+			}
 		} else {
 			info->step_chunk_size = info->last_chunk_size;
 			info->step_spare_size = info->last_spare_size;
-- 
2.9.5

             reply	other threads:[~2017-12-12  8:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12  8:38 Greg Cook [this message]
2017-12-12 10:14 ` [PATCH] Fix OOB_READ bug where hardware FIFO is not drained completely. Fix potential bug for non-ECC operations Sean Nyekjær
2017-12-12 13:20 ` Boris Brezillon
2017-12-12 13:33   ` Sean Nyekjær
2017-12-18  7:44     ` Sean Nyekjær
2017-12-12 13:59   ` Greg Cook
2017-12-12 16:29   ` Ezequiel Garcia
2017-12-12 16:39     ` Boris Brezillon
2017-12-12 17:05       ` Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171212083826.5000-1-greg@morpheus.ws \
    --to=greg@morpheus.ws \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@free-electrons.com \
    --cc=sean.nyekjaer@prevas.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.