mtd: gpmi-nand: fix read page when reading to vmalloced area

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Jul 6 10:59:01 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=6023813a2d5949ba368e7df464f2ccb649719777
Commit:     6023813a2d5949ba368e7df464f2ccb649719777
Parent:     096bcc231fd263bc8df215f0d616b08e3696c6db
Author:     Sascha Hauer <s.hauer at pengutronix.de>
AuthorDate: Tue Jun 26 17:26:16 2012 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Jul 6 15:06:23 2012 +0100

    mtd: gpmi-nand: fix read page when reading to vmalloced area
    
    The gpmi-nand driver uses virt_addr_valid() to check whether a buffer
    is suitable for dma. If it's not, a driver allocated buffer is used
    instead. Then after a page read the driver allocated buffer must be
    copied to the user supplied buffer. This does not happen since commit
    7725cc85932bd02dd12c23108e0ef748c551ccba.
    
    This patch fixes the issue. The bug is encountered with UBI which uses a
    vmalloced buffer for the volume table.
    
    Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
    Tested-by: snijsure at grid-net.com
    Acked-by: Huang Shijie <b32955 at freescale.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index a05b7b4..a6cad5c 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -920,12 +920,12 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
 		 */
 		memset(chip->oob_poi, ~0, mtd->oobsize);
 		chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0];
-
-		read_page_swap_end(this, buf, mtd->writesize,
-				this->payload_virt, this->payload_phys,
-				nfc_geo->payload_size,
-				payload_virt, payload_phys);
 	}
+
+	read_page_swap_end(this, buf, mtd->writesize,
+			this->payload_virt, this->payload_phys,
+			nfc_geo->payload_size,
+			payload_virt, payload_phys);
 exit_nfc:
 	return ret;
 }



More information about the linux-mtd-cvs mailing list