This is a note to let you know that I've just added the patch titled udf: Do not bother merging very long extents to the 6.1-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-do-not-bother-merging-very-long-extents.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 53cafe1d6d8ef9f93318e5bfccc0d24f27d41ced Mon Sep 17 00:00:00 2001 From: Jan Kara <jack@xxxxxxx> Date: Fri, 16 Dec 2022 12:37:51 +0100 Subject: udf: Do not bother merging very long extents From: Jan Kara <jack@xxxxxxx> commit 53cafe1d6d8ef9f93318e5bfccc0d24f27d41ced upstream. When merging very long extents we try to push as much length as possible to the first extent. However this is unnecessarily complicated and not really worth the trouble. Furthermore there was a bug in the logic resulting in corrupting extents in the file as syzbot reproducer shows. So just don't bother with the merging of extents that are too long together. CC: stable@xxxxxxxxxxxxxxx Reported-by: syzbot+60f291a24acecb3c2bd5@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/udf/inode.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1094,23 +1094,8 @@ static void udf_merge_extents(struct ino blocksize - 1) >> blocksize_bits)))) { if (((li->extLength & UDF_EXTENT_LENGTH_MASK) + - (lip1->extLength & UDF_EXTENT_LENGTH_MASK) + - blocksize - 1) & ~UDF_EXTENT_LENGTH_MASK) { - lip1->extLength = (lip1->extLength - - (li->extLength & - UDF_EXTENT_LENGTH_MASK) + - UDF_EXTENT_LENGTH_MASK) & - ~(blocksize - 1); - li->extLength = (li->extLength & - UDF_EXTENT_FLAG_MASK) + - (UDF_EXTENT_LENGTH_MASK + 1) - - blocksize; - lip1->extLocation.logicalBlockNum = - li->extLocation.logicalBlockNum + - ((li->extLength & - UDF_EXTENT_LENGTH_MASK) >> - blocksize_bits); - } else { + (lip1->extLength & UDF_EXTENT_LENGTH_MASK) + + blocksize - 1) <= UDF_EXTENT_LENGTH_MASK) { li->extLength = lip1->extLength + (((li->extLength & UDF_EXTENT_LENGTH_MASK) + Patches currently in stable-queue which might be from jack@xxxxxxx are queue-6.1/sbitmap-use-single-per-bitmap-counting-to-wake-up-qu.patch queue-6.1/udf-fix-file-corruption-when-appending-just-after-end-of-preallocated-extent.patch queue-6.1/sbitmap-correct-wake_batch-recalculation-to-avoid-po.patch queue-6.1/udf-do-not-update-file-length-for-failed-writes-to-inline-files.patch queue-6.1/udf-truncate-added-extents-on-failed-expansion.patch queue-6.1/udf-detect-system-inodes-linked-into-directory-hierarchy.patch queue-6.1/udf-do-not-bother-merging-very-long-extents.patch queue-6.1/udf-define-efscorrupted-error-code.patch queue-6.1/sbitmap-remove-redundant-check-in-__sbitmap_queue_ge.patch queue-6.1/udf-preserve-link-count-of-system-files.patch