diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-08-27 04:23:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-08-27 14:01:29 -0400 |
commit | 7fd5aecc5d32882f8e29b14370e9ce2520e7e56f (patch) | |
tree | 99fb19859089dae6b5c139df1b563220ec80ffee /drivers/mtd | |
parent | 6946bd636364effce06ea46fe8f8cd6e2edb004e (diff) |
[PATCH] mtd corruption fix
Read the return value before we release the nand device otherwise the
value can become corrupted by another user of chip->ops, ultimately
resulting in filesystem corruption.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 62b861304e03..c8cbc00243fe 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1093,9 +1093,10 @@ static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
1093 | 1093 | ||
1094 | ret = nand_do_read_ops(mtd, from, &chip->ops); | 1094 | ret = nand_do_read_ops(mtd, from, &chip->ops); |
1095 | 1095 | ||
1096 | *retlen = chip->ops.retlen; | ||
1097 | |||
1096 | nand_release_device(mtd); | 1098 | nand_release_device(mtd); |
1097 | 1099 | ||
1098 | *retlen = chip->ops.retlen; | ||
1099 | return ret; | 1100 | return ret; |
1100 | } | 1101 | } |
1101 | 1102 | ||
@@ -1691,9 +1692,10 @@ static int nand_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
1691 | 1692 | ||
1692 | ret = nand_do_write_ops(mtd, to, &chip->ops); | 1693 | ret = nand_do_write_ops(mtd, to, &chip->ops); |
1693 | 1694 | ||
1695 | *retlen = chip->ops.retlen; | ||
1696 | |||
1694 | nand_release_device(mtd); | 1697 | nand_release_device(mtd); |
1695 | 1698 | ||
1696 | *retlen = chip->ops.retlen; | ||
1697 | return ret; | 1699 | return ret; |
1698 | } | 1700 | } |
1699 | 1701 | ||