-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEq1nRK9aeMoq1VSgcnJ2qBz9kQNkFAmGFNuMACgkQnJ2qBz9k
 QNnIdAgA6T5QBAAfzKj5l+NsNbhmFBIOSvDW+65l8B1ioJaTNivc9Q9sfAaYdICs
 6bGA59FDvnlFe+RyX0Jysphp9Nc4tx7of1fsIhC+gR5U1PwJ/2KvIpZlrz7y4LuP
 yZ4YV9Q2R+4e+68KjzAhAs3izEVmI9L+2LC4/4w18EtIM8NfqIqVYg/nRD/DI1Oz
 /GC21YOYvE6BAtS721DBCONamvp5g3duX7SMjjYuZDeALnfikIdArklNXYUj0dsQ
 a3K+9w0vL+6zCZ7YsLiamoh/PCbNhbU0FseCcKnzELglNQw69KfNk6J7XV64VLqL
 1NW0x4TupUW7TU+mIvmK3jqbXJWe/g==
 =vHTT
 -----END PGP SIGNATURE-----

Merge tag 'fs_for_v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull quota, isofs, and reiserfs updates from Jan Kara:
 "Fixes for handling of corrupted quota files, fix for handling of
  corrupted isofs filesystem, and a small cleanup for reiserfs"

* tag 'fs_for_v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  fs: reiserfs: remove useless new_opts in reiserfs_remount
  isofs: Fix out of bound access for corrupted isofs image
  quota: correct error number in free_dqentry()
  quota: check block number when reading the block in quota file
This commit is contained in:
Linus Torvalds 2021-11-06 16:40:48 -07:00
commit d8b4e5bd48
3 changed files with 17 additions and 6 deletions

View File

@ -1322,6 +1322,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
de = (struct iso_directory_record *) (bh->b_data + offset);
de_len = *(unsigned char *) de;
if (de_len < sizeof(struct iso_directory_record))
goto fail;
if (offset + de_len > bufsize) {
int frag1 = bufsize - offset;

View File

@ -414,6 +414,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
quota_error(dquot->dq_sb, "Quota structure has offset to "
"other block (%u) than it should (%u)", blk,
(uint)(dquot->dq_off >> info->dqi_blocksize_bits));
ret = -EIO;
goto out_buf;
}
ret = read_blk(info, blk, buf);
@ -479,6 +480,13 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
goto out_buf;
}
newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
if (newblk < QT_TREEOFF || newblk >= info->dqi_blocks) {
quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)",
newblk, info->dqi_blocks);
ret = -EUCLEAN;
goto out_buf;
}
if (depth == info->dqi_qtree_depth - 1) {
ret = free_dqentry(info, dquot, newblk);
newblk = 0;
@ -578,6 +586,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
if (!blk) /* No reference? */
goto out_buf;
if (blk < QT_TREEOFF || blk >= info->dqi_blocks) {
quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)",
blk, info->dqi_blocks);
ret = -EUCLEAN;
goto out_buf;
}
if (depth < info->dqi_qtree_depth - 1)
ret = find_tree_dqentry(info, dquot, blk, depth+1);
else

View File

@ -1435,7 +1435,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
unsigned long safe_mask = 0;
unsigned int commit_max_age = (unsigned int)-1;
struct reiserfs_journal *journal = SB_JOURNAL(s);
char *new_opts;
int err;
char *qf_names[REISERFS_MAXQUOTAS];
unsigned int qfmt = 0;
@ -1443,10 +1442,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
int i;
#endif
new_opts = kstrdup(arg, GFP_KERNEL);
if (arg && !new_opts)
return -ENOMEM;
sync_filesystem(s);
reiserfs_write_lock(s);
@ -1597,7 +1592,6 @@ out_ok_unlocked:
out_err_unlock:
reiserfs_write_unlock(s);
out_err:
kfree(new_opts);
return err;
}