Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae32be31 authored by Sage Weil's avatar Sage Weil
Browse files

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: default avatarSage Weil <sage@newdream.net>
parent 4a32f93d
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -1396,10 +1396,12 @@ static int read_partial_message(struct ceph_connection *con)
	if (!con->in_msg) {
	if (!con->in_msg) {
		dout("got hdr type %d front %d data %d\n", con->in_hdr.type,
		dout("got hdr type %d front %d data %d\n", con->in_hdr.type,
		     con->in_hdr.front_len, con->in_hdr.data_len);
		     con->in_hdr.front_len, con->in_hdr.data_len);
		skip = 0;
		con->in_msg = ceph_alloc_msg(con, &con->in_hdr, &skip);
		con->in_msg = ceph_alloc_msg(con, &con->in_hdr, &skip);
		if (skip) {
		if (skip) {
			/* skip this message */
			/* skip this message */
			dout("alloc_msg said skip message\n");
			dout("alloc_msg said skip message\n");
			BUG_ON(con->in_msg);
			con->in_base_pos = -front_len - middle_len - data_len -
			con->in_base_pos = -front_len - middle_len - data_len -
				sizeof(m->footer);
				sizeof(m->footer);
			con->in_tag = CEPH_MSGR_TAG_READY;
			con->in_tag = CEPH_MSGR_TAG_READY;