Skip to content

Commit

Permalink
ceph: fix memory leak on decode error in ceph_handle_caps
Browse files Browse the repository at this point in the history
[ 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>
  • Loading branch information
jtlayton authored and gregkh committed Sep 26, 2021
1 parent abae6b3 commit 8e4e080
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/ceph/caps.c
Expand Up @@ -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:
Expand All @@ -4153,7 +4154,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
bad:
pr_err("ceph_handle_caps: corrupt message\n");
ceph_msg_dump(msg);
return;
goto out;
}

/*
Expand Down

0 comments on commit 8e4e080

Please sign in to comment.