Patch "fs: Fix uninitialized value issue in from_kuid and from_kgid" has been added to the 4.19-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

    fs: Fix uninitialized value issue in from_kuid and from_kgid

to the 4.19-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:
     fs-fix-uninitialized-value-issue-in-from_kuid-and-fr.patch
and it can be found in the queue-4.19 subdirectory.

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



commit b7b31257b0b4b08b77b80fa9e1d171695d377b97
Author: Alessandro Zanni <alessandro.zanni87@xxxxxxxxx>
Date:   Thu Oct 17 14:05:51 2024 +0200

    fs: Fix uninitialized value issue in from_kuid and from_kgid
    
    [ Upstream commit 15f34347481648a567db67fb473c23befb796af5 ]
    
    ocfs2_setattr() uses attr->ia_mode, attr->ia_uid and attr->ia_gid in
    a trace point even though ATTR_MODE, ATTR_UID and ATTR_GID aren't set.
    
    Initialize all fields of newattrs to avoid uninitialized variables, by
    checking if ATTR_MODE, ATTR_UID, ATTR_GID are initialized, otherwise 0.
    
    Reported-by: syzbot+6c55f725d1bdc8c52058@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://syzkaller.appspot.com/bug?extid=6c55f725d1bdc8c52058
    Signed-off-by: Alessandro Zanni <alessandro.zanni87@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20241017120553.55331-1-alessandro.zanni87@xxxxxxxxx
    Reviewed-by: Jan Kara <jack@xxxxxxx>
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 3c71c05a0581b..9062002fd56c6 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1143,9 +1143,12 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
 	trace_ocfs2_setattr(inode, 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));
+			    attr->ia_valid,
+				attr->ia_valid & ATTR_MODE ? attr->ia_mode : 0,
+				attr->ia_valid & ATTR_UID ?
+					from_kuid(&init_user_ns, attr->ia_uid) : 0,
+				attr->ia_valid & ATTR_GID ?
+					from_kgid(&init_user_ns, attr->ia_gid) : 0);
 
 	/* ensuring we don't even attempt to truncate a symlink */
 	if (S_ISLNK(inode->i_mode))




[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