udf: Handle error when expanding directory

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

 



From: Jan Kara <jack@xxxxxxx>

[ Upstream commit 33e9a53cd9f099b138578f8e1a3d60775ff8cbba ]

When there is an error when adding extent to the directory to expand it,
make sure to propagate the error up properly. This is not expected to
happen currently but let's make the code more futureproof.

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 |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -192,8 +192,13 @@ static struct buffer_head *udf_expand_di
 	epos.bh = NULL;
 	epos.block = iinfo->i_location;
 	epos.offset = udf_file_entry_alloc_offset(inode);
-	udf_add_aext(inode, &epos, &eloc, inode->i_size, 0);
+	ret = udf_add_aext(inode, &epos, &eloc, inode->i_size, 0);
 	brelse(epos.bh);
+	if (ret < 0) {
+		*err = ret;
+		udf_free_blocks(inode->i_sb, inode, &eloc, 0, 1);
+		return NULL;
+	}
 	mark_inode_dirty(inode);
 
 	/* Now fixup tags in moved directory entries */


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




[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