[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9562d38c3e848f5f6e81722369.ps@mail.parknet.co.jp>
Date: Wed, 15 Oct 2008 22:58:00 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, hirofumi@...l.parknet.co.jp
Subject: [PATCH 17/21] fat: Fix _fat_bmap() race
fat_get_cluster() assumes the requested blocknr isn't truncated during
read. _fat_bmap() doesn't follow this rule.
This protects it by ->i_mutex.
Signed-off-by: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
---
fs/fat/inode.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff -puN fs/fat/inode.c~fat_fat_bmap-fix fs/fat/inode.c
--- linux-2.6/fs/fat/inode.c~fat_fat_bmap-fix 2008-09-14 05:25:34.000000000 +0900
+++ linux-2.6-hirofumi/fs/fat/inode.c 2008-09-14 06:28:26.000000000 +0900
@@ -199,7 +199,14 @@ static ssize_t fat_direct_IO(int rw, str
static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
{
- return generic_block_bmap(mapping, block, fat_get_block);
+ sector_t blocknr;
+
+ /* fat_get_cluster() assumes the requested blocknr isn't truncated. */
+ mutex_lock(&mapping->host->i_mutex);
+ blocknr = generic_block_bmap(mapping, block, fat_get_block);
+ mutex_unlock(&mapping->host->i_mutex);
+
+ return blocknr;
}
static const struct address_space_operations fat_aops = {
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists