Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=646fd12784d506180353005f40f90bcf08c84a3e
Commit:     646fd12784d506180353005f40f90bcf08c84a3e
Parent:     7c48c56e9b5a51263269dd419cc32531db141340
Author:     Massimo Cirillo <[EMAIL PROTECTED]>
AuthorDate: Fri Jan 11 10:24:11 2008 +0000
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Jan 11 11:44:37 2008 -0800

    cache invalidation error for buffered write
    
    The bug causes corruptions of data read from flash.
    
    The original code performs cache invalidation from "adr" to "adr + len"
    in do_write_buffer().  Since len and adr could be updated in the code
    before invalidation - it causes improper setting of cache invalidation
    regions.
    
    Signed-off-by: Massimo Cirillo <[EMAIL PROTECTED]>
    Signed-off-by: Giuseppe D'Eliseo <[EMAIL PROTECTED]>
    Acked-by: Nicolas Pitre <[EMAIL PROTECTED]>
    Acked-by: Jörn Engel <[EMAIL PROTECTED]>
    Signed-off-by: David Woohouse <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/mtd/chips/cfi_cmdset_0001.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index a9eb1c5..1707f98 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1504,9 +1504,12 @@ static int __xipram do_write_buffer(struct map_info 
*map, struct flchip *chip,
        int ret, wbufsize, word_gap, words;
        const struct kvec *vec;
        unsigned long vec_seek;
+       unsigned long initial_adr;
+       int initial_len = len;
 
        wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
        adr += chip->start;
+       initial_adr = adr;
        cmd_adr = adr & ~(wbufsize-1);
 
        /* Let's determine this according to the interleave only once */
@@ -1519,7 +1522,7 @@ static int __xipram do_write_buffer(struct map_info *map, 
struct flchip *chip,
                return ret;
        }
 
-       XIP_INVAL_CACHED_RANGE(map, adr, len);
+       XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
        ENABLE_VPP(map);
        xip_disable(map, chip, cmd_adr);
 
@@ -1610,7 +1613,7 @@ static int __xipram do_write_buffer(struct map_info *map, 
struct flchip *chip,
        chip->state = FL_WRITING;
 
        ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
-                                  adr, len,
+                                  initial_adr, initial_len,
                                   chip->buffer_write_time);
        if (ret) {
                map_write(map, CMD(0x70), cmd_adr);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to