Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3317298imu; Sun, 11 Nov 2018 12:14:00 -0800 (PST) X-Google-Smtp-Source: AJdET5ezBbflw+8Rm4ntLcvuMO0Q3JjjIUj5MPLuDCpf1FtZs6ihM5jPIPoBDmk4drziQxL5WNcC X-Received: by 2002:a63:5a08:: with SMTP id o8mr14843672pgb.185.1541967240063; Sun, 11 Nov 2018 12:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967240; cv=none; d=google.com; s=arc-20160816; b=FbiYvWUYfDyFla/hka4xhfSbkLnhABx4OT/x3mFfhxg0IwcLiBpd69rsl450Vp0W9r VqJWEfzgjJv+uMIqHvkBEHYJKYJvBBjSKkjbLsNFrYNNozfehh+6A9/u8RmhdzDUyHFX mH6jAJr8RVHcbvQTyqQekVIBz4D7sEK8zjYTw4l4PKJSkLPokP2+BajXdZUM+t6SNINq eZ9f2ogXIHNf5uLdGgNC81AhSxEaxsh/uzROJyWHqeVRVDSqH1KxfE/V4vlXSJ9meOSD tYrsv8Mk4szovJTupfhASEFmQjPOtrT4H03qOtloRSQhsr6jlfUW8ZxLMeTcMcQJ8eTW 0OwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=6GMw0aOq832Y8MYPamblwHnH/WQEFmEKohs9muj5Pe4=; b=bJEv4MpJCVVALMh4LicYnkVlf/AULsXv2PkhAm9Wv33is5KYHr8qqcpLbNVe1LmQM/ uSlbgH3LgNrDBetvt9rSu6QBVIugm7y+gc6rImG8WKR7BTjEUo5RhD5yG1txfKWeqJo0 vBLWEJpyTHvh5JKxOMvMNVpz5ZqRjcYHSr08/+OjMxG+S8NvXke8ZYNs11EXgrXvO2S+ 2e9zHlbT9WhPHQvhIdxiuNTQdXFPBd9pGLpZpW8xKYq+TDUQb7EpPz7GqHQTa02Bfnrm jgPauIE3uncYo4vGIZu7CiIKTjSOl5rHxMnD0+h1IrltdxwJ2ugO5oYp24Ct+I3Jh5QY 9sCA== ARC-Authentication-Results: i=1; mx.google.com; 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 l8si13377138pgr.345.2018.11.11.12.13.45; Sun, 11 Nov 2018 12:14:00 -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; 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 S1731667AbeKLGCo (ORCPT + 99 others); Mon, 12 Nov 2018 01:02:44 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52704 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbeKLGCn (ORCPT ); Mon, 12 Nov 2018 01:02:43 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt6-0000tu-OS; Sun, 11 Nov 2018 19:59:16 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsQ-0001Tp-CX; Sun, 11 Nov 2018 19:58:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jaco Kroon" , "Andreas Dilger" , "Theodore Ts'o" , "Jan Kara" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 088/366] ext4: fix fencepost error in check for inode count overflow during resize In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jan Kara commit 4f2f76f751433908364ccff82f437a57d0e6e9b7 upstream. ext4_resize_fs() has an off-by-one bug when checking whether growing of a filesystem will not overflow inode count. As a result it allows a filesystem with 8192 inodes per group to grow to 64TB which overflows inode count to 0 and makes filesystem unusable. Fix it. Fixes: 3f8a6411fbada1fa482276591e037f3b1adcf55b Reported-by: Jaco Kroon Signed-off-by: Jan Kara Signed-off-by: Theodore Ts'o Reviewed-by: Andreas Dilger Signed-off-by: Ben Hutchings --- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1906,7 +1906,7 @@ retry: return 0; n_group = ext4_get_group_number(sb, n_blocks_count - 1); - if (n_group > (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) { + if (n_group >= (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) { ext4_warning(sb, "resize would cause inodes_count overflow"); return -EINVAL; }