]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
xfs: initialize the shortform attr header padding entry
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 26 Aug 2020 21:12:18 +0000 (14:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 08:46:27 +0000 (10:46 +0200)
[ Upstream commit 125eac243806e021f33a1fdea3687eccbb9f7636 ]

Don't leak kernel memory contents into the shortform attr fork.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/libxfs/xfs_attr_leaf.c

index 73a541755d5b73bb82b607480a6686765664495c..299d17b088e21c87dc79e24a1210fabf90fa9558 100644 (file)
@@ -520,8 +520,8 @@ xfs_attr_shortform_create(xfs_da_args_t *args)
                ASSERT(ifp->if_flags & XFS_IFINLINE);
        }
        xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK);
-       hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data;
-       hdr->count = 0;
+       hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data;
+       memset(hdr, 0, sizeof(*hdr));
        hdr->totsize = cpu_to_be16(sizeof(*hdr));
        xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
 }