All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix OOB_READ bug where hardware FIFO is not drained completely. Fix potential bug for non-ECC operations.
@ 2017-12-12  8:38 Greg Cook
  2017-12-12 10:14 ` Sean Nyekjær
  2017-12-12 13:20 ` Boris Brezillon
  0 siblings, 2 replies; 9+ messages in thread
From: Greg Cook @ 2017-12-12  8:38 UTC (permalink / raw)
  To: ezequiel.garcia, linux-mtd; +Cc: Greg Cook, miquel.raynal, sean.nyekjaer

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-12-18  7:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-12  8:38 [PATCH] Fix OOB_READ bug where hardware FIFO is not drained completely. Fix potential bug for non-ECC operations Greg Cook
2017-12-12 10:14 ` 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

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.