All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] [MTD] OneNAND: Do not allow oob write past end of page
Date: Fri, 02 Feb 2007 09:54:33 +0200	[thread overview]
Message-ID: <45C2EE39.7050909@nokia.com> (raw)

>From ba01b89188f21ca9a982e33452217e5c6874fd0b Mon Sep 17 00:00:00 2001
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
Date: Thu, 1 Feb 2007 16:04:50 +0200
Subject: [MTD] OneNAND: Do not allow oob write past end of page

OneNAND can write oob to successive pages, but NAND
does not do that.  For compatibility, disallow OneNAND
from writing past the end of the page.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
 drivers/mtd/onenand/onenand_base.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 9ec28bb..b7da84a 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1191,6 +1191,13 @@ static int onenand_do_write_oob(struct m
 		return -EINVAL;
 	}
 
+	/* For compatibility with NAND: Do not allow write past end of page */
+	if (column + len > oobsize) {
+		DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: "
+		      "Attempt to write past end of page\n");
+		return -EINVAL;
+	}
+
 	/* Do not allow reads past end of device */
 	if (unlikely(to >= mtd->size ||
 		     column + len > ((mtd->size >> this->page_shift) -
-- 
1.4.3

             reply	other threads:[~2007-02-02  7:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-02  7:54 Adrian Hunter [this message]
2007-02-05  6:38 ` [PATCH] [MTD] OneNAND: Do not allow oob write past end of page Kyungmin Park
2007-02-05  7:22   ` Adrian Hunter
2007-02-05  7:44     ` Kyungmin Park
2007-02-05  8:30       ` Artem Bityutskiy
2007-02-06  2:15         ` Kyungmin Park
2007-02-08 14:11           ` Adrian Hunter
2007-02-09  0:20             ` Kyungmin Park

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=45C2EE39.7050909@nokia.com \
    --to=ext-adrian.hunter@nokia.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.