diff options
author | Neil Brown <neilb@suse.de> | 2006-07-30 06:03:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-31 16:28:36 -0400 |
commit | 2ccb48ebb4de139eef4fcefd5f2bb823cb0d81b9 (patch) | |
tree | e06a83c7306e143175a87df2328b45e1ef34da5b /fs/ext3/inode.c | |
parent | f712c0c7e1796f92e45e4de144e247816d974b8f (diff) |
[PATCH] ext3: avoid triggering ext3_error on bad NFS file handle
The inode number out of an NFS file handle gets passed eventually to
ext3_get_inode_block() without any checking. If ext3_get_inode_block()
allows it to trigger an error, then bad filehandles can have unpleasant
effect - ext3_error() will usually cause a forced read-only remount, or a
panic if `errors=panic' was used.
So remove the call to ext3_error there and put a matching check in
ext3/namei.c where inode numbers are read off storage.
[akpm@osdl.org: fix off-by-one error]
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: <stable@kernel.org>
Cc: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r-- | fs/ext3/inode.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index f804d5e9d60c..ab034d3053ea 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -2402,14 +2402,15 @@ static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, | |||
2402 | struct buffer_head *bh; | 2402 | struct buffer_head *bh; |
2403 | struct ext3_group_desc * gdp; | 2403 | struct ext3_group_desc * gdp; |
2404 | 2404 | ||
2405 | 2405 | if (!ext3_valid_inum(sb, ino)) { | |
2406 | if ((ino != EXT3_ROOT_INO && ino != EXT3_JOURNAL_INO && | 2406 | /* |
2407 | ino != EXT3_RESIZE_INO && ino < EXT3_FIRST_INO(sb)) || | 2407 | * This error is already checked for in namei.c unless we are |
2408 | ino > le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)) { | 2408 | * looking at an NFS filehandle, in which case no error |
2409 | ext3_error(sb, "ext3_get_inode_block", | 2409 | * report is needed |
2410 | "bad inode number: %lu", ino); | 2410 | */ |
2411 | return 0; | 2411 | return 0; |
2412 | } | 2412 | } |
2413 | |||
2413 | block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); | 2414 | block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); |
2414 | if (block_group >= EXT3_SB(sb)->s_groups_count) { | 2415 | if (block_group >= EXT3_SB(sb)->s_groups_count) { |
2415 | ext3_error(sb,"ext3_get_inode_block","group >= groups count"); | 2416 | ext3_error(sb,"ext3_get_inode_block","group >= groups count"); |