-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEq1nRK9aeMoq1VSgcnJ2qBz9kQNkFAmq2Qs8ACgkQnJ2qBz9k
 QNnBEAf5AXGzuQPeOHZQ0+kXhe0y+2Epj1oqSH0YIDI2263nav9go3wjz4uyL/J2
 0bbALzEX0Em0n0OfYOSKPdOx22AFZdZVKrFiACXeaUQmK1R0zwLOJPxDvpyWhHQS
 8Rn+HxMVxdqbobIClHQvGsU3EkBZR+d2ZSDfG4A3Gqc4O2vkgB3CvDvw5d7OdDNB
 5Et2tydekYTSUH2JZvJxlzwvbfsvvgSEEVupYILYZvMOv01EMxOTLCCv/8KWOFNE
 Xjen/maE+1ks+nGmTgDQC2bOALB3nCQhoMlL31nsYzP89Dg/C0IGCbVX25yUvlzX
 0FXMPKVVEEvpZVhTc5Hy7HYhDatC5Q==
 =IeuV
 -----END PGP SIGNATURE-----

Merge tag 'fs_for_v7.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull isofs fix from Jan Kara:
 "A fix for reading tightly packed isofs directories"

* tag 'fs_for_v7.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  isofs: Fix handling of directories with tight blocks
This commit is contained in:
Linus Torvalds 2026-09-25 11:07:44 -07:00
commit a2ff1b626e
2 changed files with 17 additions and 19 deletions

View File

@ -110,25 +110,21 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
return 0;
}
de = (struct iso_directory_record *) (bh->b_data + offset);
de_len = *(unsigned char *)de;
de = (struct iso_directory_record *)(bh->b_data + offset);
/*
* If the length byte is zero, we should move on to the next
* CDROM sector. If we are at the end of the directory, we
* kick out of the while loop.
* If we are at the end of a block (or at its zero-padded
* tail), move on to the next CDROM sector. If we are at the
* end of the directory, we'll abort the while loop.
*/
if (de_len == 0) {
if (offset >= bufsize || de->length[0] == 0) {
brelse(bh);
bh = NULL;
ctx->pos = (ctx->pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1);
block = ctx->pos >> bufbits;
block++;
ctx->pos = (loff_t)block << bufbits;
offset = 0;
continue;
}
de_len = de->length[0];
block_saved = block;
offset_saved = offset;
offset += de_len;

View File

@ -74,18 +74,20 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
return 0;
}
de = (struct iso_directory_record *) (bh->b_data + offset);
de_len = *(unsigned char *) de;
if (!de_len) {
de = (struct iso_directory_record *)(bh->b_data + offset);
/*
* If we are at the end of the block or at its zero-padded
* tail, move to the next block.
*/
if (offset >= bufsize || de->length[0] == 0) {
brelse(bh);
bh = NULL;
f_pos = (f_pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1);
block = f_pos >> bufbits;
block++;
f_pos = block << bufbits;
offset = 0;
continue;
}
de_len = de->length[0];
block_saved = bh->b_blocknr;
offset_saved = offset;
offset += de_len;