Skip to content

Commit

Permalink
xfs: prevent reading uninitialized stack memory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Rosenberg authored and Alex Elder committed Sep 10, 2010
1 parent cc491e2 commit a122eb2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/xfs/linux-2.6/xfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a122eb2

Please sign in to comment.