* [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area
@ 2012-06-26 15:26 Sascha Hauer
2012-06-27 2:18 ` Huang Shijie
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-06-26 15:26 UTC (permalink / raw)
To: linux-mtd
Cc: Subodh Nijsure, Artem Bityutskiy, Sascha Hauer, stable,
Huang Shijie, kernel, Brian Norris
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 <computersforpeace@gmail.com>
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 <computersforpeace@gmail.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>
This patch fixes this. The bug is encountered with UBI which uses a vmalloced
buffer for the volume table.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: stable@vger.kernel.org
Cc: Huang Shijie <b32955@freescale.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Subodh Nijsure <snijsure@grid-net.com>
---
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;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area
2012-06-26 15:26 [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area Sascha Hauer
@ 2012-06-27 2:18 ` Huang Shijie
2012-06-27 6:24 ` Sascha Hauer
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2012-06-27 2:18 UTC (permalink / raw)
To: Sascha Hauer
Cc: Subodh Nijsure, Artem Bityutskiy, stable, linux-mtd, kernel,
Brian Norris
于 2012年06月26日 23:26, Sascha Hauer 写道:
> 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 <computersforpeace@gmail.com>
> 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 <computersforpeace@gmail.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>
>
> This patch fixes this. The bug is encountered with UBI which uses a vmalloced
> buffer for the volume table.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: stable@vger.kernel.org
> Cc: Huang Shijie <b32955@freescale.com>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Cc: Subodh Nijsure <snijsure@grid-net.com>
> ---
> 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;
> }
Thanks a lot for debugging this bug. I am really busy recently, and have
no time to debug it.
Acked-by: Huang Shijie <b32955@freescale.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area
2012-06-26 15:26 [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area Sascha Hauer
2012-06-27 2:18 ` Huang Shijie
@ 2012-06-27 6:24 ` Sascha Hauer
2012-06-27 22:07 ` Subodh Nijsure
2012-06-29 7:10 ` Artem Bityutskiy
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-06-27 6:24 UTC (permalink / raw)
To: linux-mtd
Cc: Subodh Nijsure, Artem Bityutskiy, stable, Huang Shijie, kernel,
Brian Norris
On Tue, Jun 26, 2012 at 05:26:16PM +0200, 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 <computersforpeace@gmail.com>
> 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 <computersforpeace@gmail.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>
>
> This patch fixes this. The bug is encountered with UBI which uses a vmalloced
> buffer for the volume table.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: stable@vger.kernel.org
Sorry, please remove the stable tag, this bug was introduced in the last
merge window.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area
2012-06-26 15:26 [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area Sascha Hauer
2012-06-27 2:18 ` Huang Shijie
2012-06-27 6:24 ` Sascha Hauer
@ 2012-06-27 22:07 ` Subodh Nijsure
2012-06-29 7:10 ` Artem Bityutskiy
3 siblings, 0 replies; 5+ messages in thread
From: Subodh Nijsure @ 2012-06-27 22:07 UTC (permalink / raw)
To: Sascha Hauer
Cc: Artem Bityutskiy, stable, Huang Shijie, linux-mtd, kernel,
Brian Norris
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 <computersforpeace@gmail.com>
> 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 <computersforpeace@gmail.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>
>
> This patch fixes this. The bug is encountered with UBI which uses a vmalloced
> buffer for the volume table.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: stable@vger.kernel.org
> Cc: Huang Shijie <b32955@freescale.com>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Cc: Subodh Nijsure <snijsure@grid-net.com>
> ---
> 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;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area
2012-06-26 15:26 [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area Sascha Hauer
` (2 preceding siblings ...)
2012-06-27 22:07 ` Subodh Nijsure
@ 2012-06-29 7:10 ` Artem Bityutskiy
3 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2012-06-29 7:10 UTC (permalink / raw)
To: Sascha Hauer
Cc: Huang Shijie, Brian Norris, linux-mtd, Subodh Nijsure, kernel
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
On Tue, 2012-06-26 at 17:26 +0200, 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:
Pushed to l2-mtd.git, thanks.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-29 7:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 15:26 [PATCH] mtd gpmi-nand: Fix read page when reading to vmalloced area Sascha Hauer
2012-06-27 2:18 ` Huang Shijie
2012-06-27 6:24 ` Sascha Hauer
2012-06-27 22:07 ` Subodh Nijsure
2012-06-29 7:10 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox