[PATCH v2] fs/ext4/xattr: check the return value of ext4_xattr_inode_dec_ref()

Li Zhong posted 1 patch 3 years, 6 months ago
fs/ext4/xattr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v2] fs/ext4/xattr: check the return value of ext4_xattr_inode_dec_ref()
Posted by Li Zhong 3 years, 6 months ago
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>
---
 fs/ext4/xattr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 533216e80fa2..e6d62fd4ac31 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -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;
 	}
-- 
2.25.1
Re: [PATCH v2] fs/ext4/xattr: check the return value of ext4_xattr_inode_dec_ref()
Posted by Theodore Ts'o 3 years, 4 months ago
On Fri, 16 Sep 2022 17:28:16 -0700, Li Zhong wrote:
> Check the return value of ext4_xattr_inode_dec_ref(), which could return
> error code and need to be warned.
> 
> 

Applied, thanks!

[1/1] fs/ext4/xattr: check the return value of ext4_xattr_inode_dec_ref()
      commit: 883a86e4276a9facf1a0fe6950e504f52b841853

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>