This is a note to let you know that I've just added the patch titled ceph: fix memory leak on decode error in ceph_handle_caps to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ceph-fix-memory-leak-on-decode-error-in-ceph_handle_.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 8436443095d1d8e0500bd6a54461d37329237021 Author: Jeff Layton <jlayton@xxxxxxxxxx> Date: Thu Jul 1 10:41:46 2021 -0400 ceph: fix memory leak on decode error in ceph_handle_caps [ Upstream commit 2ad32cf09bd28a21e6ad1595355a023ed631b529 ] 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@xxxxxxxxxx> Reviewed-by: Ilya Dryomov <idryomov@xxxxxxxxx> Signed-off-by: Ilya Dryomov <idryomov@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index ba562efdf07b..1f3d67133958 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -4137,8 +4137,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: @@ -4153,7 +4154,7 @@ flush_cap_releases: bad: pr_err("ceph_handle_caps: corrupt message\n"); ceph_msg_dump(msg); - return; + goto out; } /*