[PATCH] Propagate CRAMFS uncompression errors

From: David VomLehn (dvomlehn)
Date: Fri Feb 06 2009 - 21:55:40 EST


If cramfs_uncompress_block detects an error uncompressing it will
return a zero value. This patch checks the return value and propagates
the error back up to the block layer.

Signed-off-by: David VomLehn <dvomlehn@xxxxxxxxx>
---
fs/cramfs/inode.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index a07338d..6ff8a5e 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -493,7 +493,15 @@ static int cramfs_readpage(struct file *file,
struct page * page)
memset(pgdata + bytes_filled, 0, PAGE_CACHE_SIZE -
bytes_filled);
kunmap(page);
flush_dcache_page(page);
- SetPageUptodate(page);
+
+ if (bytes_filled == 0) {
+ ClearPageUptodate(page);
+ SetPageError(page);
+ }
+
+ else
+ SetPageUptodate(page);
+
unlock_page(page);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/