From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Eric Bénard" <eric@eukrea.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mtdraw: fix oob read and write
Date: Fri, 12 Apr 2013 19:29:02 +0200 [thread overview]
Message-ID: <20130412172902.GV1906@pengutronix.de> (raw)
In-Reply-To: <1365681891-9135-1-git-send-email-eric@eukrea.com>
On Thu, Apr 11, 2013 at 02:04:51PM +0200, Eric Bénard wrote:
> actually ops.ooboffs is not defaulted so when its value gets
> added to chip->oob_poi in nand_fill_oob or nand_transfer_oob
> the respective memcpy is using a wrong address.
>
> With this patch, both md -s /dev/nandraw0 and cp xyz /dev/nandraw0.sb
> are working fine on an i.MX28 target (instead of crashing the board).
>
> Signed-off-by: Eric Bénard <eric@eukrea.com>
Applied, thanks
Sascha
> ---
> drivers/mtd/mtdraw.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
> index 384104e..c289e8d 100644
> --- a/drivers/mtd/mtdraw.c
> +++ b/drivers/mtd/mtdraw.c
> @@ -98,6 +98,7 @@ static ssize_t mtdraw_read_unaligned(struct mtd_info *mtd, void *dst,
> if (!tmp)
> return -ENOMEM;
> ops.mode = MTD_OOB_RAW;
> + ops.ooboffs = 0;
> ops.datbuf = tmp;
> ops.len = mtd->writesize;
> ops.oobbuf = tmp + mtd->writesize;
> @@ -152,6 +153,7 @@ static ssize_t mtdraw_blkwrite(struct mtd_info *mtd, const void *buf,
> int ret;
>
> ops.mode = MTD_OOB_RAW;
> + ops.ooboffs = 0;
> ops.datbuf = (void *)buf;
> ops.len = mtd->writesize;
> ops.oobbuf = (void *)buf + mtd->writesize;
> --
> 1.7.11.7
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-04-12 17:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-11 12:04 Eric Bénard
2013-04-12 17:29 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130412172902.GV1906@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=eric@eukrea.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox