Patch "ubifs: Rectify space budget for ubifs_xrename()" has been added to the 4.14-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

    ubifs: Rectify space budget for ubifs_xrename()

to the 4.14-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:
     ubifs-rectify-space-budget-for-ubifs_xrename.patch
and it can be found in the queue-4.14 subdirectory.

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



commit 3d02f84d30aedd1cddacb90b45b8e6749f1e1434
Author: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
Date:   Tue Oct 11 11:47:28 2022 +0800

    ubifs: Rectify space budget for ubifs_xrename()
    
    [ Upstream commit 1b2ba09060e41adb356b9ae58ef94a7390928004 ]
    
    There is no space budget for ubifs_xrename(). It may let
    make_reservation() return with -ENOSPC, which could turn
    ubifs to read-only mode in do_writepage() process.
    Fix it by adding space budget for ubifs_xrename().
    
    Fetch a reproducer in [Link].
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216569
    Fixes: 9ec64962afb170 ("ubifs: Implement RENAME_EXCHANGE")
    Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
    Signed-off-by: Richard Weinberger <richard@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 299611052bbf0..99e3692264aea 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1605,6 +1605,10 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
 		return err;
 	}
 
+	err = ubifs_budget_space(c, &req);
+	if (err)
+		goto out;
+
 	lock_4_inodes(old_dir, new_dir, NULL, NULL);
 
 	time = current_time(old_dir);
@@ -1630,6 +1634,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,
 	unlock_4_inodes(old_dir, new_dir, NULL, NULL);
 	ubifs_release_budget(c, &req);
 
+out:
 	fscrypt_free_filename(&fst_nm);
 	fscrypt_free_filename(&snd_nm);
 	return err;



[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