From: Kevin Hilman <khilman@mvista.com>
To: kmpark@infradead.org
Cc: linux-omap-open-source@linux.omap.com
Subject: Re: [RFC/PATCH] ARM: OMAP: OneNAND support for 2430SDP
Date: Wed, 21 Mar 2007 20:14:23 -0700 [thread overview]
Message-ID: <4601F48F.6000506@mvista.com> (raw)
In-Reply-To: <00c001c76c1e$4861dbe0$c7a3580a@swcenter.sec.samsung.co.kr>
Kyungmin Park wrote:
>>>> RFC: Notice the change to onenand_base.c which comments
>> out the last
>>>> OOB chunk. Without this, it would not work.
>> Previous drivers
>>>> for this board such as the 2.6.10-based MV kernel have this
>>>> same change. Anyone know what is going on here?
>>>>
>>> We got this change from MV in the patch he sent to fix an
>> issue we were
>>> seeing with mounting an empty jffs2 partition. Here are the comments
>>> that came in with it
>>>
>>> " The oobfree list in the MTD OneNAND driver is of length 8. This
>>> exceeds the maximum length of 7, because the eighth entry
>> must be used
>>> as a null terminator. The absence of a terminator causes a
>> variety of
>>> problems in various places (especially JFFS2 and YAFFS2) where the
>>> oobfree list is scanned. The fix is to do without the
>> eighth entry.
>
> Colud you point out the source code line where used the eightn entry used as a
> null terminator?
>
There are several loops in both the NAND and the OneNAND code where the
oobfree list is walked and the loop only terminates when it finds a NULL
entry (specifically, one with a zero length.)
For example, look in onenand_fill_auto_oob() where you have a couple
loops like this:
for (free = this->ecclayout->oobfree; free->length; ++free) {
}
In the case where there is 8 non-zero entries in the oobfree list, this
loop will walk off the end of the list before it terminates, and having
undefined results depending on what is after the oobfree list in memory.
Instead, these loops should probably loop over MTD_MAX_OOBFREE_ENTRIES,
and break out early if they find a zero-length entry.
I'm not sure why this works for you. For me, here's a simple way to
trigger the bug using the OneNAND device on the OMAP2430SDP:
# flash_eraseall /dev/mtd8
Erasing 128 Kibyte @ 7e80000 -- 99 % complete.
# mount -t jffs2 /dev/mtdblock8 /media/onenand
Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
empty_blocks 0, bad_blocks 0, c->nr_blocks 1013
mount: /dev/mtdblock8: can't read superblock
Kevin
next prev parent reply other threads:[~2007-03-22 3:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-21 0:40 [RFC/PATCH] ARM: OMAP: OneNAND support for 2430SDP Kevin Hilman
2007-03-21 19:15 ` Jalori, Mohit
2007-03-21 19:50 ` Kevin Hilman
2007-03-22 1:06 ` Kyungmin Park
2007-03-22 3:14 ` Kevin Hilman [this message]
2007-03-22 4:50 ` Kyungmin Park
2007-03-22 5:02 ` Kyungmin Park
2007-03-22 16:53 ` Kevin Hilman
2007-03-23 4:40 ` Kyungmin Park
2007-04-26 17:35 ` Tony Lindgren
2007-04-30 22:34 ` Kevin Hilman
2007-05-02 17:45 ` Tony Lindgren
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=4601F48F.6000506@mvista.com \
--to=khilman@mvista.com \
--cc=kmpark@infradead.org \
--cc=linux-omap-open-source@linux.omap.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