Patch "udf: fix silent AED tagLocation corruption" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    udf: fix silent AED tagLocation corruption

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     udf-fix-silent-aed-taglocation-corruption.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2d9b28d222a258c8e8a209b4b38021c894b94d83
Author: Steven J. Magnani <magnani@xxxxxxxx>
Date:   Thu Jan 7 17:41:16 2021 -0600

    udf: fix silent AED tagLocation corruption
    
    [ Upstream commit 63c9e47a1642fc817654a1bc18a6ec4bbcc0f056 ]
    
    When extending a file, udf_do_extend_file() may enter following empty
    indirect extent. At the end of udf_do_extend_file() we revert prev_epos
    to point to the last written extent. However if we end up not adding any
    further extent in udf_do_extend_file(), the reverting points prev_epos
    into the header area of the AED and following updates of the extents
    (in udf_update_extents()) will corrupt the header.
    
    Make sure that we do not follow indirect extent if we are not going to
    add any more extents so that returning back to the last written extent
    works correctly.
    
    Link: https://lore.kernel.org/r/20210107234116.6190-2-magnani@xxxxxxxx
    Signed-off-by: Steven J. Magnani <magnani@xxxxxxxx>
    Signed-off-by: Jan Kara <jack@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index dd57bd446340..e0e2bc19c929 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -540,11 +540,14 @@ static int udf_do_extend_file(struct inode *inode,
 
 		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.
+		 * We've rewritten the last extent. If we are going to add
+		 * more extents, we may need to enter possible following
+		 * empty indirect extent.
 		 */
-		udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
+		if (new_block_bytes || prealloc_len)
+			udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
 	}
 
 	/* Managed to do everything necessary? */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux