* [PATCH] ceph: fix memory leak on decode error in ceph_handle_caps
@ 2021-07-02 15:14 Jeff Layton
0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2021-07-02 15:14 UTC (permalink / raw)
To: ceph-devel; +Cc: idryomov
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 <jlayton@kernel.org>
---
fs/ceph/caps.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 7bdefd0c789a..a7120fe23055 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -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;
}
/*
--
2.31.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-02 15:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 15:14 [PATCH] ceph: fix memory leak on decode error in ceph_handle_caps Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).