diff options
author | Jan Kara <jack@suse.cz> | 2023-01-25 11:46:19 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-26 16:46:32 +0100 |
commit | ee454ad2fce7baa272fc0a69f93d47013ea06b07 (patch) | |
tree | f9263e3690d6e2d2e1256c5746f2dc2198c5ae8a /fs/udf | |
parent | udf: Zero udf name padding (diff) | |
download | linux-ee454ad2fce7baa272fc0a69f93d47013ea06b07.tar.xz linux-ee454ad2fce7baa272fc0a69f93d47013ea06b07.zip |
udf: Propagate errors from udf_advance_blk()
When we spot directory corruption when trying to load next directory
extent, we didn't propagate the error up properly, leading to possibly
indefinite looping on corrupted directories. Fix the problem by
propagating the error properly.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/directory.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c index e8cf13214c8c..b1424e2aa868 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c @@ -217,7 +217,9 @@ static int udf_fiiter_load_bhs(struct udf_fileident_iter *iter) /* Need to fetch next block to get name? */ if (off + udf_dir_entry_len(fi) > blksize) { fetch_next: - udf_fiiter_advance_blk(iter); + err = udf_fiiter_advance_blk(iter); + if (err) + goto out_brelse; iter->bh[1] = udf_fiiter_bread_blk(iter); if (!iter->bh[1]) { err = -ENOMEM; @@ -296,7 +298,9 @@ int udf_fiiter_advance(struct udf_fileident_iter *iter) iter->bh[0] = iter->bh[1]; iter->bh[1] = NULL; } else { - udf_fiiter_advance_blk(iter); + err = udf_fiiter_advance_blk(iter); + if (err < 0) + return err; } } err = udf_fiiter_load_bhs(iter); |