ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com
Subject: [PATCH] ceph: fix memory leak on decode error in ceph_handle_caps
Date: Fri,  2 Jul 2021 11:14:40 -0400	[thread overview]
Message-ID: <20210702151440.93978-1-jlayton@kernel.org> (raw)

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,
-	ceph_put_string(extra_info.pool_ns);
+	ceph_put_string(extra_info.pool_ns);
@@ -4141,11 +4142,10 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 	ceph_flush_cap_releases(mdsc, session);
 	goto done;
 	pr_err("ceph_handle_caps: corrupt message\n");
-	return;
+	goto out;

                 reply	other threads:[~2021-07-02 15:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210702151440.93978-1-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).