From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chris Mason <clm@fb.com>, Filipe Manana <fdmanana@suse.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] btrfs: fix double unlock bugs in btrfs_compare_trees()
Date: Fri, 7 Jan 2022 10:24:30 +0300 [thread overview]
Message-ID: <20220107072430.GE22086@kili> (raw)
These error paths unlock before the goto, but the goto also unlocks
so it's a double unlock.
Fixes: 5646ffa863d0 ("btrfs: make send work with concurrent block group relocation")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
fs/btrfs/send.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 3fc144b8c0d8..1aa8a0998673 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -7152,7 +7152,6 @@ static int btrfs_compare_trees(struct btrfs_root *left_root,
left_path->nodes[left_level] =
btrfs_clone_extent_buffer(left_root->commit_root);
if (!left_path->nodes[left_level]) {
- up_read(&fs_info->commit_root_sem);
ret = -ENOMEM;
goto out;
}
@@ -7162,7 +7161,6 @@ static int btrfs_compare_trees(struct btrfs_root *left_root,
right_path->nodes[right_level] =
btrfs_clone_extent_buffer(right_root->commit_root);
if (!right_path->nodes[right_level]) {
- up_read(&fs_info->commit_root_sem);
ret = -ENOMEM;
goto out;
}
--
2.20.1
next reply other threads:[~2022-01-07 7:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 7:24 Dan Carpenter [this message]
2022-01-07 10:26 ` [PATCH] btrfs: fix double unlock bugs in btrfs_compare_trees() Filipe Manana
2022-01-07 10:38 ` Dan Carpenter
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=20220107072430.GE22086@kili \
--to=dan.carpenter@oracle.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=josef@toxicpanda.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-btrfs@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.