Patch "udf: Verify inode link counts before performing rename" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    udf: Verify inode link counts before performing rename

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     udf-verify-inode-link-counts-before-performing-renam.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 38e7b6d3ef558f9dcbb437d094ee2efc9fa2b784
Author: Jan Kara <jack@xxxxxxx>
Date:   Tue Nov 26 12:55:12 2024 +0100

    udf: Verify inode link counts before performing rename
    
    [ Upstream commit 6756af923e06aa33ad8894aaecbf9060953ba00f ]
    
    During rename, we are updating link counts of various inodes either when
    rename deletes target or when moving directory across directories.
    Verify involved link counts are sane so that we don't trip warnings in
    VFS.
    
    Reported-by: syzbot+3ff7365dc04a6bcafa66@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Jan Kara <jack@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 0461a7b1e9b4..8ac73f41d6eb 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -792,8 +792,18 @@ static int udf_rename(struct mnt_idmap *idmap, struct inode *old_dir,
 			retval = -ENOTEMPTY;
 			if (!empty_dir(new_inode))
 				goto out_oiter;
+			retval = -EFSCORRUPTED;
+			if (new_inode->i_nlink != 2)
+				goto out_oiter;
 		}
+		retval = -EFSCORRUPTED;
+		if (old_dir->i_nlink < 3)
+			goto out_oiter;
 		is_dir = true;
+	} else if (new_inode) {
+		retval = -EFSCORRUPTED;
+		if (new_inode->i_nlink < 1)
+			goto out_oiter;
 	}
 	if (is_dir && old_dir != new_dir) {
 		retval = udf_fiiter_find_entry(old_inode, &dotdot_name,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux