Skip to content

Commit 3d24694

Browse files
committed
Merge tag 'fs_for_v6.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull quota and udf fixes from Jan Kara: "Two small UDF fixes for better handling of corrupted filesystem and a quota fix to fix handling of filesystem freezing" * tag 'fs_for_v6.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: udf: Verify inode link counts before performing rename udf: Skip parent dir link count update if corrupted quota: flush quota_release_work upon quota writeback
2 parents 9141c5d + 6756af9 commit 3d24694

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

fs/quota/dquot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,8 @@ int dquot_writeback_dquots(struct super_block *sb, int type)
688688

689689
WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount));
690690

691+
flush_delayed_work(&quota_release_work);
692+
691693
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
692694
if (type != -1 && cnt != type)
693695
continue;

fs/udf/namei.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
517517
inode->i_nlink);
518518
clear_nlink(inode);
519519
inode->i_size = 0;
520-
inode_dec_link_count(dir);
520+
if (dir->i_nlink >= 3)
521+
inode_dec_link_count(dir);
522+
else
523+
udf_warn(inode->i_sb, "parent dir link count too low (%u)\n",
524+
dir->i_nlink);
521525
udf_add_fid_counter(dir->i_sb, true, -1);
522526
inode_set_mtime_to_ts(dir,
523527
inode_set_ctime_to_ts(dir, inode_set_ctime_current(inode)));
@@ -787,8 +791,18 @@ static int udf_rename(struct mnt_idmap *idmap, struct inode *old_dir,
787791
retval = -ENOTEMPTY;
788792
if (!empty_dir(new_inode))
789793
goto out_oiter;
794+
retval = -EFSCORRUPTED;
795+
if (new_inode->i_nlink != 2)
796+
goto out_oiter;
790797
}
798+
retval = -EFSCORRUPTED;
799+
if (old_dir->i_nlink < 3)
800+
goto out_oiter;
791801
is_dir = true;
802+
} else if (new_inode) {
803+
retval = -EFSCORRUPTED;
804+
if (new_inode->i_nlink < 1)
805+
goto out_oiter;
792806
}
793807
if (is_dir && old_dir != new_dir) {
794808
retval = udf_fiiter_find_entry(old_inode, &dotdot_name,

0 commit comments

Comments
 (0)