Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3732758imu; Mon, 7 Jan 2019 08:29:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/W/raScId4FnQfp11KSSSRFXxw3c7Uzt2eABAWrMPkVeTlggKF3zFUamMh4bY+od48FRfb7 X-Received: by 2002:a62:d701:: with SMTP id b1mr62423620pfh.34.1546878543409; Mon, 07 Jan 2019 08:29:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546878543; cv=none; d=google.com; s=arc-20160816; b=w/hwEYihweijLwqXvJaD+cyCiiUMqI3iJ7CRrow+yq/Bf35si9I4US0DfdlDVyEZyd lYRNFDtd8zyoaHD7TwTkfK1Pmdo6Eu54oG7gkFYhdESuT0QQtoEbjXzPG6OML8ZeBOn/ prP6kdf/w6WtDM0VNAR7iNT4wQwxYn9WRi4qgPmjbCwtKYqUwCjCL9Hx4IGmMMKPshu5 3QCxdVgaFAfUH4OAMZUo+fWsdKiVjAtxueyB1eH9EiqfM5USGTFr1jSVgI885EhWDqlP aGtd/jsXJhM2WYmaBdi1XakOkkjTMDMWoffifJawGA4pdfo3OrkzgcEqv6SynMO84UkY ZKcQ== 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=xg7u6APVJSzSYfDlttVCIMkJ5oLB78xlKAovSujva90=; b=QyK6Xp20UM01ZrN5+DB8w8sImIL8yhOkzs5jToGnuUOTdLiVPZmUSep4w/bulN3vYI ARZPx4CYVNvuS/Yqw+q909vcgJN7Zq60fjJBOARJfN5D6Ye9IfUwlDa0nmcWIy8cl4G6 gtp2xixbh4elnWsT9KRleem7j4O4XaBiJ3TAQ+jcBOkiMPJG6eL+K0C++hf943UbcHNW PlcHf6ryyg11vGCY22ikdCGC5XgM/uE0lkypMxgJUtBlUUVIFywQavxSzAzGIt2HP844 QEPyO5WGAEDn416HiKPtUZoxf5quTZZKyMUcDZwaNYMDVvX/fuuhTosWVGZjBhqTXoJg h0eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c0V3Njlf; 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 m7si10036243pgi.547.2019.01.07.08.28.48; Mon, 07 Jan 2019 08:29:03 -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=c0V3Njlf; 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 S1731145AbfAGNOm (ORCPT + 99 others); Mon, 7 Jan 2019 08:14:42 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)