Patch "cachefiles: propagate errors from vfs_getxattr() to avoid infinite loop" has been added to the 6.9-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

    cachefiles: propagate errors from vfs_getxattr() to avoid infinite loop

to the 6.9-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:
     cachefiles-propagate-errors-from-vfs_getxattr-to-avo.patch
and it can be found in the queue-6.9 subdirectory.

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



commit d47a352fe8600270cf3da4df70547c44fd45364a
Author: Baokun Li <libaokun1@xxxxxxxxxx>
Date:   Fri Jun 28 14:29:25 2024 +0800

    cachefiles: propagate errors from vfs_getxattr() to avoid infinite loop
    
    [ Upstream commit 0ece614a52bc9d219b839a6a29282b30d10e0c48 ]
    
    In cachefiles_check_volume_xattr(), the error returned by vfs_getxattr()
    is not passed to ret, so it ends up returning -ESTALE, which leads to an
    endless loop as follows:
    
    cachefiles_acquire_volume
    retry:
      ret = cachefiles_check_volume_xattr
        ret = -ESTALE
        xlen = vfs_getxattr // return -EIO
        // The ret is not updated when xlen < 0, so -ESTALE is returned.
        return ret
      // Supposed to jump out of the loop at this judgement.
      if (ret != -ESTALE)
          goto error_dir;
      cachefiles_bury_object
        //  EIO causes rename failure
      goto retry;
    
    Hence propagate the error returned by vfs_getxattr() to avoid the above
    issue. Do the same in cachefiles_check_auxdata().
    
    Fixes: 32e150037dce ("fscache, cachefiles: Store the volume coherency data")
    Fixes: 72b957856b0c ("cachefiles: Implement metadata/coherency data storage in xattrs")
    Signed-off-by: Baokun Li <libaokun1@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240628062930.2467993-5-libaokun@xxxxxxxxxxxxxxx
    Reviewed-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index bcb6173943ee4..4dd8a993c60a8 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -110,9 +110,11 @@ int cachefiles_check_auxdata(struct cachefiles_object *object, struct file *file
 	if (xlen == 0)
 		xlen = vfs_getxattr(&nop_mnt_idmap, dentry, cachefiles_xattr_cache, buf, tlen);
 	if (xlen != tlen) {
-		if (xlen < 0)
+		if (xlen < 0) {
+			ret = xlen;
 			trace_cachefiles_vfs_error(object, file_inode(file), xlen,
 						   cachefiles_trace_getxattr_error);
+		}
 		if (xlen == -EIO)
 			cachefiles_io_error_obj(
 				object,
@@ -252,6 +254,7 @@ int cachefiles_check_volume_xattr(struct cachefiles_volume *volume)
 		xlen = vfs_getxattr(&nop_mnt_idmap, dentry, cachefiles_xattr_cache, buf, len);
 	if (xlen != len) {
 		if (xlen < 0) {
+			ret = xlen;
 			trace_cachefiles_vfs_error(NULL, d_inode(dentry), xlen,
 						   cachefiles_trace_getxattr_error);
 			if (xlen == -EIO)




[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