lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YmE2RV6yqDeghFJn@debian9.Home>
Date:   Thu, 21 Apr 2022 11:47:33 +0100
From:   Filipe Manana <fdmanana@...nel.org>
To:     Haowen Bai <baihaowen@...zu.com>
Cc:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: Fix a memory leak in btrfs_ioctl_balance()

On Thu, Apr 21, 2022 at 05:51:17PM +0800, Haowen Bai wrote:
> Free "bargs" before return.
> 
> Signed-off-by: Haowen Bai <baihaowen@...zu.com>
> ---
>  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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ