Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2263105ybg; Sun, 27 Oct 2019 14:41:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjHP3VGKMAm+SzjO+qxVuXdc6xJbf+Ve1YgqE2gm0CSRB29M6+GGTl6DAVV2YmTR1zzPz7 X-Received: by 2002:a17:906:4488:: with SMTP id y8mr13623049ejo.322.1572212506693; Sun, 27 Oct 2019 14:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572212506; cv=none; d=google.com; s=arc-20160816; b=GoYd5frNfQN7Jo0KlH+M6SHPBFn7aB3tPfwqkUOJb3Fe9eNUAlyWub/cnVGk7ba5cX lWTMNyeUK5/NR6xsMq3txTY0odVv8gU+g1ryMcSgHj85bLibjlZoDKQSW2T4YhpsJTUw O+23d3DSfGVIAN3HYfJ5razUaB3PfiLR6t15WzLBfMZKdkoqKMo1ReLTEguX/PW3wa+E uqUIf/79ZPKe/T3hni0nh6Uxe62HA97ZuIq/T9qtRzQWorHJ659uUhSbtiSj9yOhnCbb 6VdRtWQ5WvUnB3gpM/R+H6GVyXcXcSd84uDtAPhxGFO9R7yghK2dxyGLPe9TwEO4x9Gi +DvQ== 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=aTVrlU/qjoUF4PtlgOeuVAtwHWI4+JgfvcFAjOIC6vs=; b=kdMXDy7NfcKOnGq/0V20ENps5v5y0mQI+kHe4wVIITVLn+f/VDX/iEdOVH/23L1wgW vcEgw43D9/DSgMm/rrqHhBhQMgVlDTP2pP47292TJTK8H2sQizuWDAz6zn4O81w8c3oQ kwTmG5K2yefSyfxqMl5h2FV9e2yAXoew69v9nUQiEqYVX4WTagkYnTC1WazWUcuiR3yD Wn4Vsw3pg0ylSkL0XCfrFwfjEBsJs7INd+RrHFAY2yvcSA0E52qNRJD1x631XZ/al9Ot /hTx6/m90wHM3r+6+UYN9H4g/Bjnb9G2eb7EEOuiebrONFfBGX3mBT38FjLsIkDpLJJU lNqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f8bmJs4B; 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 w17si6765756edc.152.2019.10.27.14.41.23; Sun, 27 Oct 2019 14:41:46 -0700 (PDT) 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=f8bmJs4B; 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 S1728641AbfJ0VEb (ORCPT + 99 others); Sun, 27 Oct 2019 17:04:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:50182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727051AbfJ0VE3 (ORCPT ); Sun, 27 Oct 2019 17:04:29 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 ADFE520873; Sun, 27 Oct 2019 21:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210269; bh=hCdWys4nfkW9HX9hA2t1QwKOg1sqsG2DB1dn1GyTNak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8bmJs4BESFWvjg58QXrSvZpe76kTwXzXSNpJgmJMlWbxotFd2S8UA6aJlseWEIdO ewvjMfc4qyDfkzdY7vkrEaBEO52lJL5s2NGQ8YVpUHJNm7L0HoxlemUqbxsjGTCJ1c oDATTNdBCboLlddgyR5AZJPfL6htnrBRem+YVOxs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Johannes Thumshirn , Qu Wenruo , David Sterba Subject: [PATCH 4.4 35/41] btrfs: block-group: Fix a memory leak due to missing btrfs_put_block_group() Date: Sun, 27 Oct 2019 22:01:13 +0100 Message-Id: <20191027203129.173850606@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203056.220821342@linuxfoundation.org> References: <20191027203056.220821342@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Qu Wenruo commit 4b654acdae850f48b8250b9a578a4eaa518c7a6f upstream. In btrfs_read_block_groups(), if we have an invalid block group which has mixed type (DATA|METADATA) while the fs doesn't have MIXED_GROUPS feature, we error out without freeing the block group cache. This patch will add the missing btrfs_put_block_group() to prevent memory leak. Note for stable backports: the file to patch in versions <= 5.3 is fs/btrfs/extent-tree.c Fixes: 49303381f19a ("Btrfs: bail out if block group has different mixed flag") CC: stable@vger.kernel.org # 4.9+ Reviewed-by: Anand Jain Reviewed-by: Johannes Thumshirn Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -9905,6 +9905,7 @@ int btrfs_read_block_groups(struct btrfs btrfs_err(info, "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups", cache->key.objectid); + btrfs_put_block_group(cache); ret = -EINVAL; goto error; }