summaryrefslogtreecommitdiff
path: root/fs/ceph/messenger.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-06-13 10:30:19 -0700
committerSage Weil <sage@newdream.net>2010-06-13 10:34:36 -0700
commitae32be31341a5fecfa16c5b3eb78095207182cce (patch)
tree1fb056abaab9a6ca5f593dba6237f6ebc0f6135c /fs/ceph/messenger.c
parent4a32f93d29b05cdab63c0e2979bc1524c8ea6bf5 (diff)
downloadlinux-3.10-ae32be31341a5fecfa16c5b3eb78095207182cce.tar.gz
linux-3.10-ae32be31341a5fecfa16c5b3eb78095207182cce.tar.bz2
linux-3.10-ae32be31341a5fecfa16c5b3eb78095207182cce.zip
ceph: fix message memory leak, uninitialized variable
We need to properly initialize skip, as not all alloc_msg op instances set it. Also, BUG if someone says skip but also allocates a message. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/messenger.c')
-rw-r--r--fs/ceph/messenger.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c
index cf1c7845d87..9ad43a310a4 100644
--- a/fs/ceph/messenger.c
+++ b/fs/ceph/messenger.c
@@ -1396,10 +1396,12 @@ static int read_partial_message(struct ceph_connection *con)
if (!con->in_msg) {
dout("got hdr type %d front %d data %d\n", con->in_hdr.type,
con->in_hdr.front_len, con->in_hdr.data_len);
+ skip = 0;
con->in_msg = ceph_alloc_msg(con, &con->in_hdr, &skip);
if (skip) {
/* skip this message */
dout("alloc_msg said skip message\n");
+ BUG_ON(con->in_msg);
con->in_base_pos = -front_len - middle_len - data_len -
sizeof(m->footer);
con->in_tag = CEPH_MSGR_TAG_READY;