Skip to content

Commit d8b4e5b

Browse files
committed
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
2 parents 00f178e + 81dedaf commit d8b4e5b

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

fs/isofs/inode.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,8 @@ static int isofs_read_inode(struct inode *inode, int relocated)
13221322

13231323
de = (struct iso_directory_record *) (bh->b_data + offset);
13241324
de_len = *(unsigned char *) de;
1325+
if (de_len < sizeof(struct iso_directory_record))
1326+
goto fail;
13251327

13261328
if (offset + de_len > bufsize) {
13271329
int frag1 = bufsize - offset;

fs/quota/quota_tree.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
414414
quota_error(dquot->dq_sb, "Quota structure has offset to "
415415
"other block (%u) than it should (%u)", blk,
416416
(uint)(dquot->dq_off >> info->dqi_blocksize_bits));
417+
ret = -EIO;
417418
goto out_buf;
418419
}
419420
ret = read_blk(info, blk, buf);
@@ -479,6 +480,13 @@ static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
479480
goto out_buf;
480481
}
481482
newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
483+
if (newblk < QT_TREEOFF || newblk >= info->dqi_blocks) {
484+
quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)",
485+
newblk, info->dqi_blocks);
486+
ret = -EUCLEAN;
487+
goto out_buf;
488+
}
489+
482490
if (depth == info->dqi_qtree_depth - 1) {
483491
ret = free_dqentry(info, dquot, newblk);
484492
newblk = 0;
@@ -578,6 +586,13 @@ static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
578586
blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
579587
if (!blk) /* No reference? */
580588
goto out_buf;
589+
if (blk < QT_TREEOFF || blk >= info->dqi_blocks) {
590+
quota_error(dquot->dq_sb, "Getting block too big (%u >= %u)",
591+
blk, info->dqi_blocks);
592+
ret = -EUCLEAN;
593+
goto out_buf;
594+
}
595+
581596
if (depth < info->dqi_qtree_depth - 1)
582597
ret = find_tree_dqentry(info, dquot, blk, depth+1);
583598
else

fs/reiserfs/super.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,18 +1435,13 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
14351435
unsigned long safe_mask = 0;
14361436
unsigned int commit_max_age = (unsigned int)-1;
14371437
struct reiserfs_journal *journal = SB_JOURNAL(s);
1438-
char *new_opts;
14391438
int err;
14401439
char *qf_names[REISERFS_MAXQUOTAS];
14411440
unsigned int qfmt = 0;
14421441
#ifdef CONFIG_QUOTA
14431442
int i;
14441443
#endif
14451444

1446-
new_opts = kstrdup(arg, GFP_KERNEL);
1447-
if (arg && !new_opts)
1448-
return -ENOMEM;
1449-
14501445
sync_filesystem(s);
14511446
reiserfs_write_lock(s);
14521447

@@ -1597,7 +1592,6 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
15971592
out_err_unlock:
15981593
reiserfs_write_unlock(s);
15991594
out_err:
1600-
kfree(new_opts);
16011595
return err;
16021596
}
16031597

0 commit comments

Comments
 (0)