lkml.org 
[lkml]   [2021]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] udf: fix silent AED tagLocation corruption
Date
From: Steven J. Magnani <magnani@ieee.org>

When extending a file, make sure that the pointer to the last written
extent does not get adjusted into the header (tag) portion of an
Allocation Extent Descriptor. Otherwise, a subsequent call to
udf_update_exents() can clobber the AED's tagLocation field, replacing
it with the logical block number of a file extent.

Signed-off-by: Steven J. Magnani <magnani@ieee.org>
---
--- a/fs/udf/inode.c 2020-12-28 20:51:29.000000000 -0600
+++ b/fs/udf/inode.c 2021-01-01 19:20:37.163767576 -0600
@@ -547,11 +547,14 @@ static int udf_do_extend_file(struct ino

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);
+
+ if (new_block_bytes || prealloc_len) {
+ /*
+ * 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? */
\
 
 \ /
  Last update: 2021-01-08 00:45    [W:0.049 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site