Skip to content

Commit 6c45048

Browse files
jankaragregkh
authored andcommitted
udf: Fix directory iteration for longer tail extents
commit 1ea1cd11c72d1405a6b98440a9d5ea82dfa07166 upstream. 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 <[email protected]> Cc: Shreenidhi Shedi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 91542d1 commit 6c45048

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/udf/directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static struct buffer_head *udf_fiiter_bread_blk(struct udf_fileident_iter *iter)
170170
static int udf_fiiter_advance_blk(struct udf_fileident_iter *iter)
171171
{
172172
iter->loffset++;
173-
if (iter->loffset < iter->elen >> iter->dir->i_blkbits)
173+
if (iter->loffset < DIV_ROUND_UP(iter->elen, 1<<iter->dir->i_blkbits))
174174
return 0;
175175

176176
iter->loffset = 0;

0 commit comments

Comments
 (0)