summaryrefslogtreecommitdiffstats
path: root/fs/udf/namei.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2022-12-19 19:50:14 +0100
committerJan Kara <jack@suse.cz>2023-01-09 10:39:52 +0100
commit33e9a53cd9f099b138578f8e1a3d60775ff8cbba (patch)
tree8d2f43473dae39a6514c7158d06fb963c82bec9a /fs/udf/namei.c
parentudf: Do not bother merging very long extents (diff)
downloadlinux-33e9a53cd9f099b138578f8e1a3d60775ff8cbba.tar.xz
linux-33e9a53cd9f099b138578f8e1a3d60775ff8cbba.zip
udf: Handle error when expanding directory
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@suse.cz>
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r--fs/udf/namei.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index ff9455b8c2fd..a4e8284043c1 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -192,8 +192,13 @@ static struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
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 */