Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4853393pxj; Wed, 9 Jun 2021 03:35:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYzwluLe4+tm0uVgrndoDl1nynOkBl1n+B1RrGcK/6nXbpHD1I6f7DZqY9DId7leDLBY+5 X-Received: by 2002:a17:907:948c:: with SMTP id dm12mr28181358ejc.484.1623234948890; Wed, 09 Jun 2021 03:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623234948; cv=none; d=google.com; s=arc-20160816; b=ykjTvbMgVmdHVx8Oids1SJlitzuYegAxlmRqJUQlrFbO9tL6kyMKbCCOT4IwRWG7wf oiPqCsgoAxnd7HDnB+3cs1zORrRmj1zbV7B35R/W/hfFmjD56fS4pwkecaY3uD6MXDHi Fbq5FbEir7drbKWKVagR0cXDXdzBCyPoQfDH2h+E91QpXeqxiyiC/AhDsVvArJFP4keA xk0Ssb52alAGokkajXQCfWw39suinNN5CHxUpCPN1HS2ZDXMs+zH92yYaQkTnOPLwJZC I4/VXqWPTxAePASYruWSLZBIuH4gEuri0qtTx5LhC2fmulvjwDO+J2dOWptMJ7jQL/tp eNUw== 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=1Q/J5nPVeV9YBfz4CPut+hKiHGddzOGZXZh/lbrZNdI=; b=cK/cwVsj7U3sgbnDzA1As1xf9grk2+Yv2bMz2XJbd1SiYchotin38M3w0Z3RBSm2RR YXYXVUvpC1hkRVN8o8i87tRm+OHsIjTyOrcqo/A4BSGC1xSGOmMRPi6/ey3ML+ePFXZv 5Y7AvV6pCEcBQU5P2P2G5hppJ1Ge0IWGkd+FhBGysc0D4lG+GNZP0y6bUvYOn0QGXkxt ayG5rnxdjqCBdYkMXp7JMuxveM5SoYLbIfxY3gKaGGfMtGpMMTA9uLTGZkbrBlIbN9AQ YnOszS5eAcAZEaS6v5nFBYR8/lKb4Ua8YmONVfyVsHdH+6gxP3z6NhgGlHwxARDCD/iZ Io3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aiN4L0FV; 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 t26si2081643edq.83.2021.06.09.03.35.25; Wed, 09 Jun 2021 03:35:48 -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=aiN4L0FV; 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 S236283AbhFHTI4 (ORCPT + 99 others); Tue, 8 Jun 2021 15:08:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237303AbhFHTAP (ORCPT ); Tue, 8 Jun 2021 15:00:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A9148613CE; Tue, 8 Jun 2021 18:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177806; bh=6Gabgy4UiKFla4967rw6B0OVHHOOlpCUIr2yB9sfypU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aiN4L0FVQbi/5hbhmaeDz6szC/BXQW1GV4+85psYaJxikIrdUkH+QGpIeoeDOGVV7 u9VytSWPQ0Q4KtO/Mwrmon4S7Wjvd7YTOZv5ZuUbxX1t2qQVOX89y03Fe192g2Z5y3 mfHW5vg7AwVWp84j+jp9UYS59eaD3roLNIiexNc8= 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.10 105/137] ext4: fix memory leak in ext4_mb_init_backend on error path. Date: Tue, 8 Jun 2021 20:27:25 +0200 Message-Id: <20210608175945.941826056@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175942.377073879@linuxfoundation.org> References: <20210608175942.377073879@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 @@ -2738,7 +2738,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));