From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.grid-net.com ([97.65.115.2]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sk0P3-0002Kj-Oh for linux-mtd@lists.infradead.org; Wed, 27 Jun 2012 22:08:02 +0000 Message-ID: <4FEB8433.2090001@grid-net.com> Date: Wed, 27 Jun 2012 15:07:47 -0700 From: Subodh Nijsure MIME-Version: 1.0 To: Sascha Hauer Subject: Re: [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area References: <1340724377-22279-1-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1340724377-22279-1-git-send-email-s.hauer@pengutronix.de> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: Artem Bityutskiy , stable@vger.kernel.org, Huang Shijie , linux-mtd@lists.infradead.org, kernel@pengutronix.de, Brian Norris List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Tested this modification on MX28 hardware that I have access to. With this patch I can now create UBI file system on flash. Tested-by: snijsure@grid-net.com Thanks! -Subodh On 06/26/2012 08:26 AM, Sascha Hauer wrote: > 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 > Author: Brian Norris > Date: Wed May 2 10:15:02 2012 -0700 > > mtd: gpmi-nand: utilize oob_requested parameter > > Don't read OOB if the caller didn't request it. > > Signed-off-by: Brian Norris > Acked-by: Huang Shijie > Signed-off-by: Artem Bityutskiy > Signed-off-by: David Woodhouse > > This patch fixes this. The bug is encountered with UBI which uses a vmalloced > buffer for the volume table. > > Signed-off-by: Sascha Hauer > Cc: stable@vger.kernel.org > Cc: Huang Shijie > Cc: Brian Norris > Cc: Subodh Nijsure > --- > drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 10 +++++----- > 1 file 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 6bb6f48..0179685 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; > }