[PATCH 1/1][SRU][J] udf: Fix directory iteration for longer tail extents

Chris Chiu chris.chiu at canonical.com
Wed Apr 9 07:22:59 UTC 2025


From: Jan Kara <jack at suse.cz>

BugLink: https://bugs.launchpad.net/bugs/2103598

When directory's last extent has more that one block and its length is
not multiple of a block side, the code wrongly decided to move to the
next extent instead of processing the last partial block. This led to
directory corruption. Fix the rounding issue.

Signed-off-by: Jan Kara <jack at suse.cz>
(cherry picked from commit 1ea1cd11c72d1405a6b98440a9d5ea82dfa07166)
Signed-off-by: Chris Chiu <chris.chiu at canonical.com>
---
 fs/udf/directory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index 4f6c7b546bea..2a398f619b7d 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -171,7 +171,7 @@ static struct buffer_head *udf_fiiter_bread_blk(struct udf_fileident_iter *iter)
 static int udf_fiiter_advance_blk(struct udf_fileident_iter *iter)
 {
 	iter->loffset++;
-	if (iter->loffset < iter->elen >> iter->dir->i_blkbits)
+	if (iter->loffset < DIV_ROUND_UP(iter->elen, 1<<iter->dir->i_blkbits))
 		return 0;
 
 	iter->loffset = 0;
-- 
2.34.1




More information about the kernel-team mailing list