summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Bo <wubo40@huawei.com>2020-04-30 09:12:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 17:41:48 +0300
commit1de356b13c9960cfe5dc180cf9774af92b6a9b91 (patch)
tree9308ab22d42ed6d76470326a42b764a13a296955
parent2e7f7b28c449de743d365a5a3d063b9cdda64c0b (diff)
downloadlinux-1de356b13c9960cfe5dc180cf9774af92b6a9b91.tar.xz
ceph: fix double unlock in handle_cap_export()
[ Upstream commit 4d8e28ff3106b093d98bfd2eceb9b430c70a8758 ] If the ceph_mdsc_open_export_target_session() return fails, it will do a "goto retry", but the session mutex has already been unlocked. Re-lock the mutex in that case to ensure that we don't unlock it twice. Signed-off-by: Wu Bo <wubo40@huawei.com> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/ceph/caps.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 617e9ae67f50..e11aacb35d6b 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3394,6 +3394,7 @@ retry:
WARN_ON(1);
tsession = NULL;
target = -1;
+ mutex_lock(&session->s_mutex);
}
goto retry;