Commit 6023813a2d5949ba368e7df464f2ccb649719777

Authored by Sascha Hauer
Committed by David Woodhouse
1 parent 096bcc231f

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@pengutronix.de>
Tested-by: snijsure@grid-net.com
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff

drivers/mtd/nand/gpmi-nand/gpmi-nand.c
... ... @@ -920,12 +920,12 @@
920 920 */
921 921 memset(chip->oob_poi, ~0, mtd->oobsize);
922 922 chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0];
923   -
924   - read_page_swap_end(this, buf, mtd->writesize,
925   - this->payload_virt, this->payload_phys,
926   - nfc_geo->payload_size,
927   - payload_virt, payload_phys);
928 923 }
  924 +
  925 + read_page_swap_end(this, buf, mtd->writesize,
  926 + this->payload_virt, this->payload_phys,
  927 + nfc_geo->payload_size,
  928 + payload_virt, payload_phys);
929 929 exit_nfc:
930 930 return ret;
931 931 }