Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4369026pxj; Tue, 8 Jun 2021 12:35:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+XbaDTcQQTxMKfYKn26ID8bhS+cT9DWPe3mt5pBLHlLHSO/soBpB46vleCS3mwoeSteq6 X-Received: by 2002:a17:906:1d0a:: with SMTP id n10mr25095990ejh.341.1623180959314; Tue, 08 Jun 2021 12:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623180959; cv=none; d=google.com; s=arc-20160816; b=C4vbk4VnMwuZ49VlduGXk50WoUMw2mZFhI7neJPRG3m1Ywl0pFErpSmVI8YDDTDdta CZb24o0uEbfH9ZpONdUJuR3JBYQmu6p4MSPlSTfW65m4N7j75Pl5Y6q/WQVwzY3zdDTx ygQI8PwsoYYMkgXmDZpFDT/qLRhUnvdKYNK03A/5xKRTE05rtXL6500yBm9KEigNgbzM KU7xtcczEEmv/udQud9ad3OEBK84LF9dVWN6TKihcfPvjeX5trHKJXV878ZD9hyQZCVY H39gYGFYGZGxsw0unxzXoAvpqVC7oRx8MElPfoNJIU7cr0LvKNVmq7p7Y91KyEHpbsCr kCgg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k6XtASWTUEPVl4uQ52xluQRFyKUExzuY24YdQw/pYCo=; b=Ff7WehnrZgVIUEBkR45o9OFUEkQ5hHw1fiSknFwFI1U1Pa5V3nqvl8LHMUqp89q9/G tPh1mFZu0cO+F7xOAMLiIPxR92iq/K8h1jByPo76kYMHpsHDMt1tipgQty69lilmwn2y r9k8xj/dfkPL4NfQYIKAgaYRhxwgeph+o0hS0KqVbHDNI0Ffi6LNHio0QJ6i9MdOldmC 5ekoyANvLQbMN9+L0uggRE7H8HOvGcud0bNrMKg94ydO+tc7XrvXgVWj/U2VBMLF9Tpq 9Aj7Y/Eq64xlJz23C4cMzDwfKDGQj1XLLNR60sT4DSaT3+xgn9x2Fmmh5/xTDLqv/tNK gJ3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=If8FYPG7; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si464569ejf.188.2021.06.08.12.35.35; Tue, 08 Jun 2021 12:35:59 -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=@linuxfoundation.org header.s=korg header.b=If8FYPG7; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239089AbhFHTem (ORCPT + 99 others); Tue, 8 Jun 2021 15:34:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236707AbhFHTS5 (ORCPT ); Tue, 8 Jun 2021 15:18:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DB426197B; Tue, 8 Jun 2021 18:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623178329; bh=mHKXomWRnMW3agROBotJ0I7obFnlXdq6Cl3swQQVP7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=If8FYPG7itFBuwUnrHOUrNJLV/VzT8T5KDhvVBRez7OOAnVwz64G7bjtgeQVKHUKo 7fdYL7Bgjeja6qAN8CjJTC0GwYpVKkTOL2JRj8XF4WUnpP5uvBAMcXz1ck/di5ztVT IxiV7fQisg3Ia5TVNLr2t/IXWKmCZRyELTaZ1sdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+aa12d6106ea4ca1b6aae@syzkaller.appspotmail.com, Phillip Potter , stable@kernel.org, Theodore Tso Subject: [PATCH 5.12 119/161] ext4: fix memory leak in ext4_mb_init_backend on error path. Date: Tue, 8 Jun 2021 20:27:29 +0200 Message-Id: <20210608175949.472421199@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175945.476074951@linuxfoundation.org> References: <20210608175945.476074951@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phillip Potter commit a8867f4e3809050571c98de7a2d465aff5e4daf5 upstream. Fix a memory leak discovered by syzbot when a file system is corrupted with an illegally large s_log_groups_per_flex. Reported-by: syzbot+aa12d6106ea4ca1b6aae@syzkaller.appspotmail.com Signed-off-by: Phillip Potter Cc: stable@kernel.org Link: https://lore.kernel.org/r/20210412073837.1686-1-phil@philpotter.co.uk Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2715,7 +2715,7 @@ static int ext4_mb_init_backend(struct s */ if (sbi->s_es->s_log_groups_per_flex >= 32) { ext4_msg(sb, KERN_ERR, "too many log groups per flexible block group"); - goto err_freesgi; + goto err_freebuddy; } sbi->s_mb_prefetch = min_t(uint, 1 << sbi->s_es->s_log_groups_per_flex, BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9));