From: Jan Kara <jack@xxxxxxx> [ Upstream commit 27ab33854873e6fb958cb074681a0107cc2ecc4c ] Syzbot reports uninitialized memory access in udf_rename() when updating checksum of '..' directory entry of a moved directory. This is indeed true as we pass on-stack diriter.fi to the udf_update_tag() and because that has only struct fileIdentDesc included in it and not the impUse or name fields, the checksumming function is going to checksum random stack contents beyond the end of the structure. This is actually harmless because the following udf_fiiter_write_fi() will recompute the checksum from on-disk buffers where everything is properly included. So all that is needed is just removing the bogus calculation. Fixes: e9109a92d2a9 ("udf: Convert udf_rename() to new directory iteration code") Link: https://lore.kernel.org/all/000000000000cf405f060d8f75a9@xxxxxxxxxx/T/ Link: https://patch.msgid.link/20240617154201.29512-1-jack@xxxxxxx Reported-by: syzbot+d31185aa54170f7fc1f5@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/udf/namei.c | 2 -- 1 file changed, 2 deletions(-) --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -857,8 +857,6 @@ static int udf_rename(struct user_namesp if (has_diriter) { diriter.fi.icb.extLocation = cpu_to_lelb(UDF_I(new_dir)->i_location); - udf_update_tag((char *)&diriter.fi, - udf_dir_entry_len(&diriter.fi)); udf_fiiter_write_fi(&diriter, NULL); udf_fiiter_release(&diriter); Patches currently in stable-queue which might be from cascardo@xxxxxxxxxx are queue-5.15/udf-handle-error-when-expanding-directory.patch queue-5.15/udf-convert-empty_dir-to-new-directory-iteration-code.patch queue-5.15/udf-fix-bogus-checksum-computation-in-udf_rename.patch queue-5.15/udf-convert-udf_expand_dir_adinicb-to-new-directory-iteration.patch queue-5.15/udf-convert-udf_unlink-to-new-directory-iteration-code.patch queue-5.15/udf-convert-udf_add_nondir-to-new-directory-iteration.patch queue-5.15/udf-convert-udf_link-to-new-directory-iteration-code.patch queue-5.15/udf-remove-old-directory-iteration-code.patch queue-5.15/udf-don-t-return-bh-from-udf_expand_dir_adinicb.patch queue-5.15/udf-new-directory-iteration-code.patch queue-5.15/udf-convert-udf_rmdir-to-new-directory-iteration-code.patch queue-5.15/udf-move-udf_expand_dir_adinicb-to-its-callsite.patch queue-5.15/udf-convert-udf_readdir-to-new-directory-iteration.patch queue-5.15/udf-convert-udf_mkdir-to-new-directory-iteration-code.patch queue-5.15/udf-provide-function-to-mark-entry-as-deleted-using-new-directory-iteration-code.patch queue-5.15/udf-convert-udf_lookup-to-use-new-directory-iteration-code.patch queue-5.15/udf-implement-adding-of-dir-entries-using-new-iteration-code.patch queue-5.15/udf-convert-udf_rename-to-new-directory-iteration-code.patch queue-5.15/udf-convert-udf_get_parent-to-new-directory-iteration-code.patch queue-5.15/udf-implement-searching-for-directory-entry-using-new-iteration-code.patch