Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2905027pxb; Tue, 24 Aug 2021 10:16:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrylNx7zzNCT04rzS69EtXYMkTtbFCKFsr2WIghtDMvchPZ44gUVV4FCQT3hv3wHvho1x5 X-Received: by 2002:a6b:e90c:: with SMTP id u12mr30213934iof.95.1629825409119; Tue, 24 Aug 2021 10:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825409; cv=none; d=google.com; s=arc-20160816; b=ykF6fdVI1sJ7y8a4DN41Bs7h6AIPX3MHIUk3AnMMeEnunwPwYyQQsfsM7YlodkQ4Mv kCm3E8gq9yvCYtOgG6C+ISxXMT+Xl369MnDlbuM8kqfELuIMBdmzGg+eAHxKkH5jArR9 E6i/+i3gJIaFmfM6hFJwslYsdPoNRiy4WfVTLbrn7tFfuXVQrROe9mtRQLOGDvSgbfkA cgKqNUQmKPOn8w9OggBdnDHzGSByqGTQGq41h9lZqa+NQL8vxf/y81Qq2pgzKor5UdTe +Q4qsGvQy5gFvvJ+I4QLmUE00tEIRjYsJnopzHegP4TLQN0JYW1Qtea/IKzxlB2BQ2X1 r+/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3v1KxU2vaOSMoUSJwjHIeDUf0PVi+KUn/H8ELReHPEM=; b=PTb9YtWOFLhACJeTzJS9uBUeKmmqVOBC1CxFxEW2I9xtsB7xQndlxVzRO861YE4ZQg wuRE8ypjPHkHBGdmXLk1Zw6Tyc/7kL0gtAwivxYiZYCS0pXQNm0zcwJRm2h3mjj+avFG QGf7PC4fogg/NxouL//6uTPn/98M8WbtV2hZalq5yU4CF1Oq+tnt+HwZzsYkWhWLHGe7 ro4qnRCnGp525QRDJUI9CLnBOfjNvs/ZYFecuf7eb/n5p96TdPHkOPyp7CdCVuOEwldF kGLWbDn/TBmZ1L8VgwhGs0oTS+wDANpp2FiCEcxcr8tobCgyirtsZDWY7AoAkYbSjBTt 7A1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LP7MYZYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si12618502ilu.150.2021.08.24.10.16.35; Tue, 24 Aug 2021 10:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LP7MYZYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbhHXRP4 (ORCPT + 99 others); Tue, 24 Aug 2021 13:15:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:51788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhHXRLW (ORCPT ); Tue, 24 Aug 2021 13:11:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9DDD61360; Tue, 24 Aug 2021 17:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824469; bh=bQLrVWFBj5744gzUSuxVy1UXEzsP8gwLK3raqZHB130=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LP7MYZYnEPdxorb770mZVbUvgYbrqnukjcD8sPSHQDDMT8KmJREiDRbi1YMcjtN44 OCY22O30PhvTuqaJL9fK25BP6cZnfnbxjSOmk+l+BUmXNklJBt+WLVfwhW8ZbI60/v A1L0XnSsJpP0qekPwXZli8BktjnIys9FmNJLFylqasflDEdDp6lE9I/XG6QzAPpW4O uwN7G/wz6qiTd4ejKGxKFjFEmuakmyLCQ7UBnzCx8YrXSFTRx9Qps9HXLLqwxTYs/g wIiDpClUKmCrNgHDA1ITzBYIqFTOv1MD0pZUVhvpFnDM+iDX8qd4Pdacych7jlecLm iZMLtNiAafcQQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ritesh Harjani , syzbot+77fa5bdb65cc39711820@syzkaller.appspotmail.com, Jan Kara , Christoph Hellwig , Theodore Ts'o , George Kennedy , Greg Kroah-Hartman Subject: [PATCH 5.4 01/61] ext4: fix EXT4_MAX_LOGICAL_BLOCK macro Date: Tue, 24 Aug 2021 13:00:06 -0400 Message-Id: <20210824170106.710221-2-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170106.710221-1-sashal@kernel.org> References: <20210824170106.710221-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.143-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.143-rc1 X-KernelTest-Deadline: 2021-08-26T17:01+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ritesh Harjani commit 175efa81feb8405676e0136d97b10380179c92e0 upstream. ext4 supports max number of logical blocks in a file to be 0xffffffff. (This is since ext4_extent's ee_block is __le32). This means that EXT4_MAX_LOGICAL_BLOCK should be 0xfffffffe (starting from 0 logical offset). This patch fixes this. The issue was seen when ext4 moved to iomap_fiemap API and when overlayfs was mounted on top of ext4. Since overlayfs was missing filemap_check_ranges(), so it could pass a arbitrary huge length which lead to overflow of map.m_len logic. This patch fixes that. Fixes: d3b6f23f7167 ("ext4: move ext4_fiemap to use iomap framework") Reported-by: syzbot+77fa5bdb65cc39711820@syzkaller.appspotmail.com Signed-off-by: Ritesh Harjani Reviewed-by: Jan Kara Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20200505154324.3226743-2-hch@lst.de Signed-off-by: Theodore Ts'o Signed-off-by: George Kennedy Signed-off-by: Greg Kroah-Hartman --- fs/ext4/ext4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index bf3eaa903033..ae2cb15d9540 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -718,7 +718,7 @@ enum { #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF /* Max logical block we can support */ -#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF +#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFE /* * Structure of an inode on the disk -- 2.30.2