From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 4A608C43387 for ; Mon, 7 Jan 2019 13:14:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E914217D4 for ; Mon, 7 Jan 2019 13:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866882; bh=Is6cF+fbPMUnLMQJB3E3J5+BB0US/QHIGdx5U/ADh8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s9bMgk1f9tzNwvNWFcWDanf9/+sS7Oaoxks8uZerpXuKCCzD8qvbp0XbuYDigNNfc qR7j4ncZx6/tEjLLi/bYDeL5OUdUdjYaKEm/1H0S0NHExGd9Du/RJgySYXCEuZRHaT 0vbln8ZBqZ9b/cH2g9RVs47hoLX5jKiSKEm7yJOM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727841AbfAGNOk (ORCPT ); Mon, 7 Jan 2019 08:14:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:50232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727576AbfAGNCn (ORCPT ); Mon, 7 Jan 2019 08:02:43 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 E3BB52089F; Mon, 7 Jan 2019 13:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866162; bh=Is6cF+fbPMUnLMQJB3E3J5+BB0US/QHIGdx5U/ADh8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0V3NjlfWDN1fgWe1ACH8pOVm1Zwr2k/T1/P5vRdwGl1VWnI8c8vZXmPZVKPdNVyw WeaZjAdSdBGtvqfG+hgQreW2LCC6zkSofAap0g+RwwJUQPBK4lRCa+Ppgd1g/xRsuf vSet5WRAGG2uU/z62k9nxhDx9eAAIhfDoOpn1oAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steve Graham , Theodore Tso , stable@kernel.org Subject: [PATCH 4.14 066/101] ext4: include terminating u32 in size of xattr entries when expanding inodes Date: Mon, 7 Jan 2019 13:32:54 +0100 Message-Id: <20190107105336.558682968@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit a805622a757b6d7f65def4141d29317d8e37b8a1 upstream. In ext4_expand_extra_isize_ea(), we calculate the total size of the xattr header, plus the xattr entries so we know how much of the beginning part of the xattrs to move when expanding the inode extra size. We need to include the terminating u32 at the end of the xattr entries, or else if there is uninitialized, non-zero bytes after the xattr entries and before the xattr values, the list of xattr entries won't be properly terminated. Reported-by: Steve Graham Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2724,7 +2724,7 @@ retry: base = IFIRST(header); end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; min_offs = end - base; - total_ino = sizeof(struct ext4_xattr_ibody_header); + total_ino = sizeof(struct ext4_xattr_ibody_header) + sizeof(u32); error = xattr_check_inode(inode, header, end); if (error)