Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp797328pxb; Fri, 22 Apr 2022 11:20:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAtpSxrbSUI0QXJBANGtkW17EEwxeJIh+Buq5nlP8YFtFA1j6upFXKYgIRPzUvVmof6Qt1 X-Received: by 2002:a05:6a00:2311:b0:4e1:52bf:e466 with SMTP id h17-20020a056a00231100b004e152bfe466mr6221672pfh.77.1650651649691; Fri, 22 Apr 2022 11:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650651649; cv=none; d=google.com; s=arc-20160816; b=EfXmIGyNPwVRc2cIya3H/c1kMcrGX+pLNMzsjHn7vHkmgrizkrFaAsufguzU/5BV5j zOe2ZUy0N6TRN8b1ctO3IBO7BWIcXKh2b4bbxm68mCOjW9IPmsfikJ8u59ShIEhefyTO r86imSIiZw7H6vTJPVs7Y2lGyLfLXpUjQVJ5+O3+pAad/+8MO3nsKOYbe0h8V0JIznO1 Ez9E6kkSNC0lfgrDiqTzMxQ2jGXWbBeJzsKWz+rVOLLJC1iF/Pd6100VZcb5W2RV7zXx Jqp0k1HGOALIuYJh5udXxupLfO5LWa4rEDOaqJQ96G4SW/eyRnMh67+vTU88N2syRAL2 hjtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=61JmIed9dbN+ewvLjS5+zOkdHTHfaGJTr3HoalNUUnU=; b=uBnbvaK7o5lZQhHS6yePwlaa6KPm67UZchVPmfYxFV2d4UbzL5aOxYj0TrJi2wR1rz Stf1DY6jQx8/jrXu6IXUcFtKIgvjGaCg9L7R+4xi+LhPEw0nPJo3rRcrOS/Z9B7LaBcm OJbRZtJ8gTHPsN5rdzHOQQcviqcgtUb8AcZnCqwMmmaMf6jZvhkNceHdbBJvLwI689bP B1KQbsS0eo8UkHjhatk8TFe0e7XU+zKMWyh7lsBXq7qAAc4uFrhBMb224T1OgD4iJW/x +2O/SvJD0SCAvVJTtHubC2sOgvCzd6lfYZyYojRUsvvPOgA/69Ksj60xGgLwhV/yD2/x l0yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bUdwbHoj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k4-20020a056a00134400b004fa8a817638si8822789pfu.283.2022.04.22.11.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bUdwbHoj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C052DD4C5C; Fri, 22 Apr 2022 10:51:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388529AbiDUKua (ORCPT + 99 others); Thu, 21 Apr 2022 06:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240995AbiDUKu1 (ORCPT ); Thu, 21 Apr 2022 06:50:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 204285FE1; Thu, 21 Apr 2022 03:47:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6EF461A7C; Thu, 21 Apr 2022 10:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF673C385A5; Thu, 21 Apr 2022 10:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650538057; bh=UB/wj7Q5GrgKrtaTY9oAg++NK8E5bgXvVO35tjMchH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bUdwbHoj/T4pxwvFzDFT9UDg+MNNMxcQchGoaIti9d6F23eznnuruZ9yJqn72Je09 iap9idw8HdZF2t3rzsclNEvtv/qcx9IPOjNIkjTHw8Sf/A9O+vvwJjusSq8FrpNeNR Xrz5pema0o6p8gATJuMK587da1Lp0K1dAxHix7w+QN9WMWPhgEsVCYnrTF20H+3Jc6 NAKPCY38mblBzSyR5kywBBgi/f85no4oUsZ8LI8QUPEv5ccouvTTRo1JmgsBx6zwfN Yn0XZ2g5uDYa1E2xr0Zh5bmNrvEgRSSa5nTbRSiPSSeAkHGkqX/SRDRW/HYm30h4M/ Vc2jj5MEMfoQg== Date: Thu, 21 Apr 2022 11:47:33 +0100 From: Filipe Manana To: Haowen Bai Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] btrfs: Fix a memory leak in btrfs_ioctl_balance() Message-ID: References: <1650534677-31554-1-git-send-email-baihaowen@meizu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1650534677-31554-1-git-send-email-baihaowen@meizu.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 21, 2022 at 05:51:17PM +0800, Haowen Bai wrote: > Free "bargs" before return. > > Signed-off-by: Haowen Bai > --- > fs/btrfs/ioctl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c > index f08233c2b0b2..d4c8bea914b7 100644 > --- a/fs/btrfs/ioctl.c > +++ b/fs/btrfs/ioctl.c > @@ -4389,13 +4389,13 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) > /* this is (2) */ > mutex_unlock(&fs_info->balance_mutex); > ret = -EINPROGRESS; > - goto out; > + goto out_bargs; > } > } else { > /* this is (1) */ > mutex_unlock(&fs_info->balance_mutex); > ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS; > - goto out; > + goto out_bargs; In addition to Qu's comment about the double unlock, this is also a fix for a recent patch that is not yet on Linus' tree: btrfs: simplify codeflow in btrfs_ioctl_balance (https://lore.kernel.org/linux-btrfs/20220330091407.1319454-4-nborisov@suse.com/) Something usually worth mentioning, as we can't add a Fixes tag in this case. Thanks. > } > > locked: > -- > 2.7.4 >