]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ceph: fix message memory leak, uninitialized variable
authorSage Weil <sage@newdream.net>
Sun, 13 Jun 2010 17:30:19 +0000 (10:30 -0700)
committerSage Weil <sage@newdream.net>
Sun, 13 Jun 2010 17:34:36 +0000 (10:34 -0700)
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>
fs/ceph/messenger.c

index cf1c7845d8778305c2782b3920373691919835c1..9ad43a310a415595e338b3a45187131d31fca8cd 100644 (file)
@@ -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;