Skip to content

Commit

Permalink
udf: Fix lost indirect extent block
Browse files Browse the repository at this point in the history
When inode ends with empty indirect extent block and we extended that
file, udf_do_extend_file() ended up just overwriting pointer to it with
another extent and thus effectively leaking the block and also
corruptiong length of allocation descriptors.

Fix the problem by properly following into next indirect extent when it
is present.

Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Dec 23, 2015
1 parent fcea62b commit 6c37157
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,18 @@ static int udf_do_extend_file(struct inode *inode,
udf_add_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
count++;
} else
} else {
struct kernel_lb_addr tmploc;
uint32_t tmplen;

udf_write_aext(inode, last_pos, &last_ext->extLocation,
last_ext->extLength, 1);
/*
* We've rewritten the last extent but there may be empty
* indirect extent after it - enter it.
*/
udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
}

/* Managed to do everything necessary? */
if (!blocks)
Expand Down

0 comments on commit 6c37157

Please sign in to comment.