ceph: fix memory leak on decode error in ceph_handle_caps
PATCH 1/1 ceph: fix memory leak on decode error in ceph_handle_caps
If we hit a decoding error late in the frame, then we might exit the function without putting the pool_ns string. Ensure that we always put that reference on the way out of the function.
Signed-off-by Jeff Layton <[email protected]>
--- fs/ceph/caps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ceph/caps.c +3 -3
@@ -4129,8 +4129,9 @@ void ceph_handle_caps(struct ceph_mds_session *session, done:mutex_unlock (&session->s_mutex); done_unlocked: -ceph_put_string (extra_info.pool_ns);iput (inode); +out: +ceph_put_string (extra_info.pool_ns);return ; flush_cap_releases:
@@ -4141,11 +4142,10 @@ void ceph_handle_caps(struct ceph_mds_session *session,*/ ceph_flush_cap_releases (mdsc, session); goto done; - bad:pr_err ("ceph_handle_caps: corrupt message\n" );ceph_msg_dump (msg); -return ; + goto out; }/*
Signature · 1 line
2.31.1