Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1809291imm; Mon, 3 Sep 2018 10:00:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaZvxEyQQoWCCDTgdwjIrjN5ZGQ0KaDjbkKXFutYodutHWe18Pi+vFlY69QuDUGdSeUfX1R X-Received: by 2002:a62:848e:: with SMTP id k136-v6mr8910134pfd.231.1535994056221; Mon, 03 Sep 2018 10:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535994055; cv=none; d=google.com; s=arc-20160816; b=oruqfO081sbiHD4l90NsaydZmg8YrKtlH9VeH7gCvBCRXhi4OGO5I3QmEGFBvQBafX 2hLYik443xpZW/bi1TMU0nJf1cyUMHcc5Iqa6/tE6B9iVxPZJfWGjrny4axQ6bvplxzo eyheFP4L4bjnouVrvfBtK4Xnl4Yjtngf54my+TInkawFnfODISMl9LOUBQD9+ixy0ZDI wC2cYIYCDwb/LVr5tDvssclgu+OM7IM8BcP5z45XE8F4ZnhO/oN98cmfKS5N4LkPARK0 7hu/wCfoE9exWF2RZ/r4/xef6Drnz8H0SbgrXcn25qLj3OjGCNRLwWaSeHGd4/VsfNC3 iN7Q== 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=2sPNuLxbodF6Mm6ZkT/Qb8fHz6EtUV0rWLSewC42w5M=; b=ZOWObKeyihb5Bd1W9PT7wFYFpnmms+/aUJqRJr4HxgHWU4rUOlnG1vbVsZIZwV+lBL N3G/MP9Vz5Xyc6urE0QbYnDaAg+tstpo9yWNduifk8eHIMQ6dM/DWlesIaijOV9g+nwI mFgucuuPWl2fmPxwI52zAVwMkFsIudsFnSq5kKSLc+sucGA7wxgUCk1RQAoC95us73E9 sl6Tot/Jxk1er57c2aZgn7agt497tRxkZ2tePUAzMK9ZQSuaHkeQFWDIOfvq5IiqAiG4 2G1jhY7rIpc4JcsGrc4Ajlshp4vNHSIe8deb6aifF3ZrAsQjIV8rkO9bDw9gBoykO8aR ppsw== 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 bj7-v6si16585875plb.320.2018.09.03.10.00.40; Mon, 03 Sep 2018 10:00:55 -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 S1728724AbeICVUR (ORCPT + 99 others); Mon, 3 Sep 2018 17:20:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38516 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728443AbeICVUQ (ORCPT ); Mon, 3 Sep 2018 17:20:16 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C231CCF5; Mon, 3 Sep 2018 16:59:17 +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.4 45/80] btrfs: dont leak ret from do_chunk_alloc Date: Mon, 3 Sep 2018 18:49:23 +0200 Message-Id: <20180903164935.952705202@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903164934.171677301@linuxfoundation.org> References: <20180903164934.171677301@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.4-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 @@ -4128,7 +4128,7 @@ commit_trans: data_sinfo->flags, bytes, 1); spin_unlock(&data_sinfo->lock); - return ret; + return 0; } /*