This is a note to let you know that I've just added the patch titled udf: Skip parent dir link count update if corrupted 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-skip-parent-dir-link-count-update-if-corrupted.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 5f5434426d4e1e3e3017bd83f1e0574519d4ae9d Author: Jan Kara <jack@xxxxxxx> Date: Tue Nov 26 12:46:00 2024 +0100 udf: Skip parent dir link count update if corrupted [ Upstream commit c5566903af56dd1abb092f18dcb0c770d6cd8dcb ] If the parent directory link count is too low (likely directory inode corruption), just skip updating its link count as if it goes to 0 too early it can cause unexpected issues. 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 605f182da42c..b3f57ad2b869 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -521,7 +521,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) inode->i_nlink); clear_nlink(inode); inode->i_size = 0; - inode_dec_link_count(dir); + if (dir->i_nlink >= 3) + inode_dec_link_count(dir); + else + udf_warn(inode->i_sb, "parent dir link count too low (%u)\n", + dir->i_nlink); udf_add_fid_counter(dir->i_sb, true, -1); dir->i_mtime = inode_set_ctime_to_ts(dir, inode_set_ctime_current(inode));