]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ceph: fix double unlock in handle_cap_export()
authorWu Bo <wubo40@huawei.com>
Thu, 30 Apr 2020 06:12:49 +0000 (14:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 May 2020 14:43:01 +0000 (16:43 +0200)
[ 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>
fs/ceph/caps.c

index 1b5a50848b5be486ce9ad76b6508b1feb3e8d267..589cfe3ed873b9cade939f4c2d31b055de6f3acd 100644 (file)
@@ -3502,6 +3502,7 @@ retry:
                WARN_ON(1);
                tsession = NULL;
                target = -1;
+               mutex_lock(&session->s_mutex);
        }
        goto retry;