From: Filipe Manana <fdmanana@kernel.org>
To: Haowen Bai <baihaowen@meizu.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: Fix a memory leak in btrfs_ioctl_balance()
Date: Thu, 21 Apr 2022 11:47:33 +0100 [thread overview]
Message-ID: <YmE2RV6yqDeghFJn@debian9.Home> (raw)
In-Reply-To: <1650534677-31554-1-git-send-email-baihaowen@meizu.com>
On Thu, Apr 21, 2022 at 05:51:17PM +0800, Haowen Bai wrote:
> Free "bargs" before return.
>
> Signed-off-by: Haowen Bai <baihaowen@meizu.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
>
next prev parent reply other threads:[~2022-04-21 10:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 9:51 [PATCH] btrfs: Fix a memory leak in btrfs_ioctl_balance() Haowen Bai
2022-04-21 10:01 ` Qu Wenruo
2022-04-21 10:47 ` Filipe Manana [this message]
2022-04-21 11:21 ` Nikolay Borisov
2022-04-21 11:25 ` Nikolay Borisov
2022-04-21 11:34 ` Nikolay Borisov
2022-04-21 13:30 ` David Sterba
2022-04-21 11:41 ` Qu Wenruo
2022-04-21 17:35 ` kernel test robot
2022-04-22 20:28 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YmE2RV6yqDeghFJn@debian9.Home \
--to=fdmanana@kernel.org \
--cc=baihaowen@meizu.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.