summaryrefslogtreecommitdiff
path: root/fs/udf/directory.c
diff options
context:
space:
mode:
authorZhao Mengmeng <zhaomengmeng@kylinos.cn>2024-10-01 14:54:24 +0300
committerJan Kara <jack@suse.cz>2024-10-02 15:10:50 +0300
commitb405c1e58b73981da0f8df03b00666b22b9397ae (patch)
tree70894d7f47122bfa41ce5ec4efbe54f7fff00816 /fs/udf/directory.c
parentee703a7068f95764cfb62b57db1d36e465cb9b26 (diff)
downloadlinux-b405c1e58b73981da0f8df03b00666b22b9397ae.tar.xz
udf: refactor udf_next_aext() to handle error
Since udf_current_aext() has error handling, udf_next_aext() should have error handling too. Besides, when too many indirect extents found in one inode, return -EFSCORRUPTED; when reading block failed, return -EIO. Signed-off-by: Zhao Mengmeng <zhaomengmeng@kylinos.cn> Suggested-by: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20241001115425.266556-3-zhaomzhao@126.com
Diffstat (limited to 'fs/udf/directory.c')
-rw-r--r--fs/udf/directory.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index 93153665eb37..c6950050e7ae 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -166,13 +166,19 @@ static struct buffer_head *udf_fiiter_bread_blk(struct udf_fileident_iter *iter)
*/
static int udf_fiiter_advance_blk(struct udf_fileident_iter *iter)
{
+ int8_t etype = -1;
+ int err = 0;
+
iter->loffset++;
if (iter->loffset < DIV_ROUND_UP(iter->elen, 1<<iter->dir->i_blkbits))
return 0;
iter->loffset = 0;
- if (udf_next_aext(iter->dir, &iter->epos, &iter->eloc, &iter->elen, 1)
- != (EXT_RECORDED_ALLOCATED >> 30)) {
+ err = udf_next_aext(iter->dir, &iter->epos, &iter->eloc,
+ &iter->elen, &etype, 1);
+ if (err < 0)
+ return err;
+ else if (err == 0 || etype != (EXT_RECORDED_ALLOCATED >> 30)) {
if (iter->pos == iter->dir->i_size) {
iter->elen = 0;
return 0;