Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udf: Fix directory iteration for longer tail extents

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@suse.cz>

Jan Kara 1ea1cd11 ee454ad2

+1 -1
+1 -1
fs/udf/directory.c
··· 170 170 static int udf_fiiter_advance_blk(struct udf_fileident_iter *iter) 171 171 { 172 172 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)) 174 174 return 0; 175 175 176 176 iter->loffset = 0;