Commit fb50ae74 authored by Joel & Rebecca VanderZee's avatar Joel & Rebecca VanderZee Committed by Linus Torvalds

[PATCH] I/O Error attempting to read last partial block of a file in an ISO9660 file system

There was an I/O error that prevented reading the last partial block of
large files in an ISO9660 filesystem.  The error was generated when a file
comprised more than one section and had a size that was not an exact
multiple of the filesystem block size.  This patch removes the check (and
failure) for reading into the last partial block (and possibly beyond) for
multiple-section files.

It worked in my testing to prevent reading beyond the end of the section;
my first patch just incremented the sect_size block count for a partial
block and continued doing the check.  But there is a commment in the source
code about reading beyond the end of the file to fill a page cache.
Failing to access beyond the section would prevent reading beyond the end
of the file.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e4b76555
...@@ -960,30 +960,30 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s, ...@@ -960,30 +960,30 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
goto abort; goto abort;
} }
if (nextblk) { /* On the last section, nextblk == 0, section size is likely to
while (b_off >= (offset + sect_size)) { * exceed sect_size by a partial block, and access beyond the
struct inode *ninode; * end of the file will reach beyond the section size, too.
*/
offset += sect_size; while (nextblk && (b_off >= (offset + sect_size))) {
if (nextblk == 0) struct inode *ninode;
goto abort;
ninode = isofs_iget(inode->i_sb, nextblk, nextoff); offset += sect_size;
if (!ninode) ninode = isofs_iget(inode->i_sb, nextblk, nextoff);
goto abort; if (!ninode)
firstext = ISOFS_I(ninode)->i_first_extent; goto abort;
sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode); firstext = ISOFS_I(ninode)->i_first_extent;
nextblk = ISOFS_I(ninode)->i_next_section_block; sect_size = ISOFS_I(ninode)->i_section_size >> ISOFS_BUFFER_BITS(ninode);
nextoff = ISOFS_I(ninode)->i_next_section_offset; nextblk = ISOFS_I(ninode)->i_next_section_block;
iput(ninode); nextoff = ISOFS_I(ninode)->i_next_section_offset;
iput(ninode);
if (++section > 100) {
printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n"); if (++section > 100) {
printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u " printk("isofs_get_blocks: More than 100 file sections ?!?, aborting...\n");
"nextblk=%lu nextoff=%lu\n", printk("isofs_get_blocks: block=%ld firstext=%u sect_size=%u "
iblock, firstext, (unsigned) sect_size, "nextblk=%lu nextoff=%lu\n",
nextblk, nextoff); iblock, firstext, (unsigned) sect_size,
goto abort; nextblk, nextoff);
} goto abort;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment