aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2015-12-23 12:05:03 -0500
committerJan Kara <jack@suse.cz>2015-12-23 12:05:03 -0500
commit6c37157874aa2b153b722868bd984002fbcff6bb (patch)
tree550ce65d53c314bf62a71c31e423c5bdc47b4712 /fs/udf
parentfcea62babc8100aee79c716c81203c6d105b2da0 (diff)
udf: Fix lost indirect extent block
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>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/inode.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 34c2d2b79594..846294891925 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -539,9 +539,18 @@ static int udf_do_extend_file(struct inode *inode,
539 udf_add_aext(inode, last_pos, &last_ext->extLocation, 539 udf_add_aext(inode, last_pos, &last_ext->extLocation,
540 last_ext->extLength, 1); 540 last_ext->extLength, 1);
541 count++; 541 count++;
542 } else 542 } else {
543 struct kernel_lb_addr tmploc;
544 uint32_t tmplen;
545
543 udf_write_aext(inode, last_pos, &last_ext->extLocation, 546 udf_write_aext(inode, last_pos, &last_ext->extLocation,
544 last_ext->extLength, 1); 547 last_ext->extLength, 1);
548 /*
549 * We've rewritten the last extent but there may be empty
550 * indirect extent after it - enter it.
551 */
552 udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
553 }
545 554
546 /* Managed to do everything necessary? */ 555 /* Managed to do everything necessary? */
547 if (!blocks) 556 if (!blocks)