Skip to content

Commit b7b68a8

Browse files
jtlaytonsmb49
authored andcommitted
ceph: fix memory leak on decode error in ceph_handle_caps
BugLink: https://bugs.launchpad.net/bugs/1949397 [ Upstream commit 2ad32cf ] 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> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
1 parent cc37f0e commit b7b68a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/ceph/caps.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4222,9 +4222,10 @@ void ceph_handle_caps(struct ceph_mds_session *session,
42224222
done:
42234223
mutex_unlock(&session->s_mutex);
42244224
done_unlocked:
4225-
ceph_put_string(extra_info.pool_ns);
42264225
/* avoid calling iput_final() in mds dispatch threads */
42274226
ceph_async_iput(inode);
4227+
out:
4228+
ceph_put_string(extra_info.pool_ns);
42284229
return;
42294230

42304231
flush_cap_releases:
@@ -4239,7 +4240,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
42394240
bad:
42404241
pr_err("ceph_handle_caps: corrupt message\n");
42414242
ceph_msg_dump(msg);
4242-
return;
4243+
goto out;
42434244
}
42444245

42454246
/*

0 commit comments

Comments
 (0)