Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3713530imu; Mon, 7 Jan 2019 08:10:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN4XP7OqRYdJLLgOa0ubNSW6/Q/CvO7m7kU3Y/Y50iLrxaBAMkNvume3iUsjkANXB7aKmBXW X-Received: by 2002:a63:bc02:: with SMTP id q2mr30646698pge.116.1546877418348; Mon, 07 Jan 2019 08:10:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546877418; cv=none; d=google.com; s=arc-20160816; b=R1d1Xx3yLfZ7GYBSfyeu80mQ6bcEa0BwNI/e61GUrhfNZNFK6fID+ILFycs1khA+C8 Hz2TlbX5qQ7a2rViEim+bL/f5vNQyuedAWX21Mfd2TughHGehH/o49Ak+2L3A8QJPHmc wNXPNeBUAztI8pKujVmaUoH5mQ0eWQg2CdZzzAPLSJyEwwicMo2jlMZ+U6764oNUAFLE N/mHankcNW1AX7JXHlR47d9Sxu9r8FMS6pDjRzalAZhe0/CGL9+VfXBkvcvl+Xn1Eqj8 ZPqtV7iLxSvobEZeIbuYVx2nlXDCirY4TJ7yozR6sDFMsIU+2C+2xllMSQkinuSSUnl7 Um+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y3//UCcgOSKUQdBBqS7wQ2WiHamPed7uFzVUJi7WsDs=; b=q18S4bYBlOOJ+kwY/XjSTbtMhdJlvyrh08JJhqdaZAMHyyzCUD6qdmUlba0Tnv1/Jv iI/TtDXtiwjr4+JDwxwTkrKeE+uU6PuNleQdovNmqtlZXUU1FzF7ALh3ztBYepl/4HGP +IdfX9kcaCPhaKyo8t7bVfpHtqo9j53oveSvnLdiPt1BXrka+DqX2dyNCLsUHp4tF2+7 AGyzsYdCpeaxhd8WYtib7md34IHSAyeNQ5ZTr61QS3IZEcCC5F/6GHs5FYRLuBzF8NSM ptu1LpltXmoLyERL/e8ESB2JkNWwyMOdbT0VHS5Q+I/BFQaVSvhOTVeKMm6g1V1eZ4Jx PmBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iJ4+NjnD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si3658603pgg.188.2019.01.07.08.10.01; Mon, 07 Jan 2019 08:10:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iJ4+NjnD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729838AbfAGMyV (ORCPT + 99 others); Mon, 7 Jan 2019 07:54:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:43246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729174AbfAGMyS (ORCPT ); Mon, 7 Jan 2019 07:54:18 -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 C2BE520651; Mon, 7 Jan 2019 12:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865657; bh=hAyee3Fn9uwIpI+h0sxfj8Mlkr9hGrQAU+ORf3kZx+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJ4+NjnDXXG1rQxxBG2zRBpEYloZ2kJXvqy/HD/rOC2xrkiJ7vE6IRmgcgei92qrI PKr1kv+1iyPKkiX4kLCQFr+RtEb5j82zQK0AGv26POzejhKMq0e6mJ7PLKwApbd4b7 3jRoRWuam/KkIJ62TP8X1ERXsf7IvNClQb82RYoM= 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.19 111/170] ext4: include terminating u32 in size of xattr entries when expanding inodes Date: Mon, 7 Jan 2019 13:32:18 +0100 Message-Id: <20190107104506.074543514@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-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 @@ -2725,7 +2725,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)