Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825582imm; Mon, 3 Sep 2018 10:24:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaTtYMOKgeIK2ZBUZMmitEhRaCSLtESyLT5ntDGujVar0wnJLPQm23KG5YzgXNw9dweJ0s2 X-Received: by 2002:a62:a6cc:: with SMTP id r73-v6mr30442173pfl.60.1535995499387; Mon, 03 Sep 2018 10:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995499; cv=none; d=google.com; s=arc-20160816; b=IfbfEG8ERr4m2yVUCmTdYmFNFxRVvNfyWe3RH8/eQ6xSO1ShaHuWEvirUCt3s8VE0G K9b7CGDTNMCPPQRO5MKN1Kw/edglEeRD/PMe2Ta3sFa6glwCnXosoBXi+spWFrPLat+3 cqvX3BkP8CxdQOEWXDixvJQlOJxJfaCE+H4b0LlrytKaLuMjdlQeln3B2nLwmZbbHvdw AGCH6feGhBhAo0suJH6ndZPl8Q/6Sm1RuRypeUqR+FSSnsB1atMLdvWZbQDi9uKq1X7B QmFwu44/Hm6pA5Cv7hn94TxGC9W2VMjgq7/64nXeGzmbMi831FrAr/y4KDxxRXTy9G5C hVww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=HRBUg5YGOrLNgX/C4v8N2y/jvcfQoRUEQClhzb0d5fI=; b=XIWY10sdHC95bSR0OAN1sJi48DFR0DnxVIUk8ZSKPAxEk2PNKoSrYCiSXWKsG2AQix ZdWX4c7M05CbxYUgRBLwX63dkXgDClrkt+c3wHmHa9uxWjuQaFCSORcMqpKa1IjPy/3p nkFeeTfV6RCEtlrtUfbul1Gjql/zKmNQLXnF4jyCQeSDv1qW+CNlDPRjlJEigMe2Alli REEyllteBK7ccDaRwafVi50DwoqKt4CV0xOzeKIHR+PkqoZ1mHsL1jPL7HXnKI53lo0o ZGOszGCfCURq8NJdbzA6ADUC9S0ljrb6mtP6tb1E5T3ig7uSBv1qhiXWr6HCRaN2Ngir /MWA== 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 c202-v6si21232892pfc.74.2018.09.03.10.24.44; Mon, 03 Sep 2018 10:24:59 -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; 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 S1730472AbeICVoI (ORCPT + 99 others); Mon, 3 Sep 2018 17:44:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45384 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728357AbeICVoI (ORCPT ); Mon, 3 Sep 2018 17:44:08 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 658ACD24; Mon, 3 Sep 2018 17:23:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , Nikolay Borisov , David Sterba Subject: [PATCH 4.14 091/165] btrfs: dont leak ret from do_chunk_alloc Date: Mon, 3 Sep 2018 18:56:17 +0200 Message-Id: <20180903165700.058030999@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik commit 4559b0a71749c442d34f7cfb9e72c9e58db83948 upstream. If we're trying to make a data reservation and we have to allocate a data chunk we could leak ret == 1, as do_chunk_alloc() will return 1 if it allocated a chunk. Since the end of the function is the success path just return 0. CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Josef Bacik Reviewed-by: Nikolay Borisov Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4407,7 +4407,7 @@ commit_trans: data_sinfo->flags, bytes, 1); spin_unlock(&data_sinfo->lock); - return ret; + return 0; } int btrfs_check_data_free_space(struct inode *inode,