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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user