mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bo YU <tsu.yubo@gmail.com>
To: clm@fb.com, josef@toxicpanda.com, sterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	tsu.yubo@gmail.com
Subject: [PATCH -next] fs/btrfs: Fix unlocking in btrfs_ref_tree_mod
Date: Fri, 15 May 2020 10:17:40 +0800	[thread overview]
Message-ID: <20200515021731.cb5y557wsxf66fo3@debian.debian-2> (raw)

It adds spin_lock() in add_block_entry() but out path does not unlock
it.

Detected by CoversityScan, CID# 1463343:(Missing unlock)

Fixes: fd708b81d972a (Btrfs: add a extent ref verify tool)
Signed-off-by: Bo YU <tsu.yubo@gmail.com>
---
 fs/btrfs/ref-verify.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c
index 7887317033c9..8f644511006d 100644
--- a/fs/btrfs/ref-verify.c
+++ b/fs/btrfs/ref-verify.c
@@ -894,8 +894,10 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
 out_unlock:
 	spin_unlock(&fs_info->ref_verify_lock);
 out:
-	if (ret)
+	if (ret) {
+		spin_unlock(&fs_info->ref_verify_lock);
 		btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY);
+	}
 	return ret;
 }

--
2.11.0


             reply	other threads:[~2020-05-15  2:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  2:17 Bo YU [this message]
2020-05-15  9:03 ` Johannes Thumshirn
2020-05-15  9:23   ` Bo YU
2020-05-15  9:36     ` Johannes Thumshirn
2020-05-15 10:44       ` Bo YU

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=20200515021731.cb5y557wsxf66fo3@debian.debian-2 \
    --to=tsu.yubo@gmail.com \
    --cc=clm@fb.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sterba@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®