From patchwork Tue Sep 15 14:12:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 263996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE61BC43461 for ; Tue, 15 Sep 2020 14:36:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7720C20829 for ; Tue, 15 Sep 2020 14:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600180561; bh=nkIwpklr8pneiu31+NTkJtbPlNAja9POFd5Lt9VjKiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QJSnkTCrYFK+L/r0VT9MQxnUfObcfyBkuXyDBFlsXZ9G7vv2Fd/2+3leY6k23hOzO VHdDHxeBH9rhq/OIgr8SDAA8Ra1CKcS1xR2WxeX4dAgtTqqX6eaIAzZ/UM9qsELRef zqE7h87JqzZU+3XnJJoUo4bbGRA5aIuR5uNofSeQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726817AbgIOOfw (ORCPT ); Tue, 15 Sep 2020 10:35:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:47666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727072AbgIOOe6 (ORCPT ); Tue, 15 Sep 2020 10:34:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B9007221EB; Tue, 15 Sep 2020 14:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600179351; bh=nkIwpklr8pneiu31+NTkJtbPlNAja9POFd5Lt9VjKiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJJ1XIxe/X2lK7D5pWuJ9e8V3POSaugGAHXcSTRuoCY0BgykKMayjmJk/1nSQ1tIk bk1GczkT0bHmn1yTI+htvnSk/63jlO0vVOJpdqGs1dvh1xh0eiLjaQZRLVJLl/G8zq Vk6eL7HPeSqnunw+1f3PEd/LhA0ibueAYGLxuXfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Eric Sandeen , Dave Chinner , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 25/78] xfs: initialize the shortform attr header padding entry Date: Tue, 15 Sep 2020 16:12:50 +0200 Message-Id: <20200915140634.817374039@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200915140633.552502750@linuxfoundation.org> References: <20200915140633.552502750@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Darrick J. Wong [ Upstream commit 125eac243806e021f33a1fdea3687eccbb9f7636 ] Don't leak kernel memory contents into the shortform attr fork. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Reviewed-by: Dave Chinner Reviewed-by: Christoph Hellwig Signed-off-by: Sasha Levin --- fs/xfs/libxfs/xfs_attr_leaf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 087a5715cf20e..bd37f4a292c3b 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -551,8 +551,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); }