lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Apr 2020 14:12:49 +0800
From:   Wu Bo <wubo40@...wei.com>
To:     <jlayton@...nel.org>, <ukernel@...il.com>, <sage@...hat.com>,
        <idryomov@...il.com>
CC:     <ceph-devel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <liuzhiqiang26@...wei.com>, <linfeilong@...wei.com>,
        <wubo40@...wei.com>
Subject: [PATCH V3] fs/ceph:fix double unlock in handle_cap_export()

If the ceph_mdsc_open_export_target_session() return fails,
we should add mutex_lock(&session->s_mutex) on IS_ERR(tsession) block 
to avoid twice unlocking. because the session->s_mutex will be unlock
at the out_unlock lable.

--
v2 -> v3:
  - Rewrite solution, adding a mutex_lock(&session->s_mutex) 
    to the IS_ERR(tsession) block.
  - Modify the comment more clearly.
v1 -> v2:
  - add spin_lock(&ci->i_ceph_lock) before goto out_unlock lable
     

Signed-off-by: Wu Bo <wubo40@...wei.com>
---
 fs/ceph/caps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 185db76..d27d778 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3746,6 +3746,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 		WARN_ON(1);
 		tsession = NULL;
 		target = -1;
+		mutex_lock(&session->s_mutex);
 	}
 	goto retry;
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ