Re: [syzbot] [ocfs2?] KMSAN: uninit-value in from_kuid (2)

Edward Adam Davis
2024-09-21T02:40:32Z

use inode's uid and gid to replace attr

#syz test

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index ccc57038a977..d4be183bf149 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1129,8 +1129,8 @@ int ocfs2_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
(unsigned long long)OCFS2_I(inode)->ip_blkno,
dentry->d_name.len, dentry->d_name.name,
attr->ia_valid, attr->ia_mode,
- from_kuid(&init_user_ns, attr->ia_uid),
- from_kgid(&init_user_ns, attr->ia_gid));
+ from_kuid(&init_user_ns, inode->i_uid),
+ from_kgid(&init_user_ns, inode->i_gid));

/* ensuring we don't even attempt to truncate a symlink */
if (S_ISLNK(inode->i_mode))