]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
xfs: prevent reading uninitialized stack memory
authorDan Rosenberg <dan.j.rosenberg@gmail.com>
Mon, 6 Sep 2010 22:24:57 +0000 (18:24 -0400)
committerAlex Elder <aelder@sgi.com>
Fri, 10 Sep 2010 12:39:28 +0000 (07:39 -0500)
The XFS_IOC_FSGETXATTR ioctl allows unprivileged users to read 12
bytes of uninitialized stack memory, because the fsxattr struct
declared on the stack in xfs_ioc_fsgetxattr() does not alter (or zero)
the 12-byte fsx_pad member before copying it back to the user.  This
patch takes care of it.

Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
fs/xfs/linux-2.6/xfs_ioctl.c

index 4fec427b83efc9dbf42ae9cda3aa64c5c71cdbec..3b9e626f7cd1562877cc340d0c43c5a776dd2e35 100644 (file)
@@ -785,6 +785,8 @@ xfs_ioc_fsgetxattr(
 {
        struct fsxattr          fa;
 
+       memset(&fa, 0, sizeof(struct fsxattr));
+
        xfs_ilock(ip, XFS_ILOCK_SHARED);
        fa.fsx_xflags = xfs_ip2xflags(ip);
        fa.fsx_extsize = ip->i_d.di_extsize << ip->i_mount->m_sb.sb_blocklog;