mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ceph: Fix mds session leak in __open_export_target_session()
__open_export_target_session() holds a reference on the target session,
either from __ceph_lookup_mds_session() or from register_session(),
which the caller is expected to drop. When __open_session() fails, the
helper returns ERR_PTR(ret) without dropping that reference, leaking
one session reference on every open failure.
Drop the session reference before returning the error.
Cc: stable@vger.kernel.org
Fixes: b682c6d41b ("ceph: switch to WARN_ON_ONCE in encode_supported_features()")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
e51cf76e72
commit
6c80207392
|
|
@ -1828,8 +1828,10 @@ __open_export_target_session(struct ceph_mds_client *mdsc, int target)
|
|||
if (session->s_state == CEPH_MDS_SESSION_NEW ||
|
||||
session->s_state == CEPH_MDS_SESSION_CLOSING) {
|
||||
ret = __open_session(mdsc, session);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
ceph_put_mds_session(session);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
}
|
||||
|
||||
return session;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user