ext4: check the return value of ext4_xattr_inode_dec_ref()
authorLi Zhong <floridsleeves@gmail.com>
Sat, 17 Sep 2022 00:28:16 +0000 (17:28 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 1 Dec 2022 15:46:54 +0000 (10:46 -0500)
Check the return value of ext4_xattr_inode_dec_ref(), which could
return error code and need to be warned.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
Link: https://lore.kernel.org/r/20220917002816.3804400-1-floridsleeves@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/xattr.c

index 36d6ba7190b6db6d650ad2ac85c6313aae2b3ae1..718ef3987f94f2e1fbd6dfde359b5fe39eea5385 100644 (file)
@@ -1540,7 +1540,8 @@ static int ext4_xattr_inode_lookup_create(handle_t *handle, struct inode *inode,
 
        err = ext4_xattr_inode_write(handle, ea_inode, value, value_len);
        if (err) {
-               ext4_xattr_inode_dec_ref(handle, ea_inode);
+               if (ext4_xattr_inode_dec_ref(handle, ea_inode))
+                       ext4_warning_inode(ea_inode, "cleanup dec ref error %d", err);
                iput(ea_inode);
                return err;
        }