Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2960341imu; Mon, 19 Nov 2018 08:39:14 -0800 (PST) X-Google-Smtp-Source: AJdET5e+ZutGIeKaLEeqAQKDffKXOZ5ODwepAQKCrc9+XDfFMQkfAInZB+GzHjr+lJCwpdo/uULh X-Received: by 2002:a17:902:b584:: with SMTP id a4mr22953017pls.246.1542645554498; Mon, 19 Nov 2018 08:39:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645554; cv=none; d=google.com; s=arc-20160816; b=Cm2J03pkxtBdBs6FVVHStbZsViY4jfM1FF/1zuKWMzhRPsqbgZaA9GWq3lGsgp74vM AxeDcgDKBVb6Yypuxo1EZmw+R1/3V2tzBn+dH/4tDT1WPjIs4lj96ABXHjO6RyqfSNfI qCYZ81yuMPXwmuDoFLFOI8t4b24ykAc6MQtD6yc0wYIQEfZ67n1Mji8SGqdtICRlbu53 TNkxOiqPLuLxfEUOvq/PvxkJwfiaxvwVTqKwyoNaGj4nP80QhwPmgCBdzlH9V0qWkS0d 87QkFTapMdzIGvxWG49kBbUBVsKvc1CMLfE7yjYndgwXzHJUGVBhcsphEt3TvRFogvwm aziQ== 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=Gc1LQCsRm6CXVI1dk1Zu2uQwdvpe7SC9VorPQQLz/NA=; b=mRmy3GyEjo+HShcM8WwyNfXtZ1Vx05LN1gw+qXkCRXMxMtVFD3IWVmpHilbCHwzrzr SVMhPfbD3b91GnvG1bd92qQpHXu/GbA2SlE0bfJriTjrZ5Bst4Sq2kq6Fk+ZBYHEAAq9 1qMZcQ5gZvK7ugKwexguBy7tJ7qRQ8IPWQgLMlJy1/yj8Da7G7xRbgAL6nwfEo12Gtp9 IX8h0zR7//76Hd9GIDZf4r8Ze7y5rvvDgt5COQWJVIMUAfUKT/RSR4sUk1ssnJ6d7UF+ NEWOWsbFOebRazKKn8qHVY1X3qcK7ohBAlSifNTykKMAvB70cKHG5IEkZ8VyJcO6nrGX ZyzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CsR/4E2n"; 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 p23si37098931pgk.312.2018.11.19.08.38.59; Mon, 19 Nov 2018 08:39:14 -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="CsR/4E2n"; 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 S1731903AbeKTDAb (ORCPT + 99 others); Mon, 19 Nov 2018 22:00:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:60402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730366AbeKTDAb (ORCPT ); Mon, 19 Nov 2018 22:00:31 -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 0EC6D2086A; Mon, 19 Nov 2018 16:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645382; bh=r4XNEuZ+3WEn37LqAOtN6Rsw9b5CFU30KwygQ01ZYxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CsR/4E2nMPMySXpID2zESl8oqtLYVhXKX12wganB1ROiFgPlN9GfeVIHXu23sTNk+ lUBx+DzySGUv5pABdDvVJ+3HtyL8Muos09a4fSR4I/hBvbGp90gijDKz0lf/SqTvkD D+2Q11LCyX2ZJl6lKaNXNtdnil2iW2yudOlTw86M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , Theodore Tso , stable@kernel.org Subject: [PATCH 4.19 140/205] ext4: fix possible leak of sbi->s_group_desc_leak in error path Date: Mon, 19 Nov 2018 17:27:27 +0100 Message-Id: <20181119162637.788850994@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 9e463084cdb22e0b56b2dfbc50461020409a5fd3 upstream. Fixes: bfe0a5f47ada ("ext4: add more mount time checks of the superblock") Reported-by: Vasily Averin Signed-off-by: Theodore Ts'o Cc: stable@kernel.org # 4.18 Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4074,6 +4074,14 @@ static int ext4_fill_super(struct super_ sbi->s_groups_count = blocks_count; sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count, (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); + if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != + le32_to_cpu(es->s_inodes_count)) { + ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", + le32_to_cpu(es->s_inodes_count), + ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); + ret = -EINVAL; + goto failed_mount; + } db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / EXT4_DESC_PER_BLOCK(sb); if (ext4_has_feature_meta_bg(sb)) { @@ -4093,14 +4101,6 @@ static int ext4_fill_super(struct super_ ret = -ENOMEM; goto failed_mount; } - if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != - le32_to_cpu(es->s_inodes_count)) { - ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", - le32_to_cpu(es->s_inodes_count), - ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); - ret = -EINVAL; - goto failed_mount; - } bgl_lock_init(sbi->s_blockgroup_lock);