From 16c4c4f1f0f86d5c4e52080a7994e328c4747855 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Wed, 15 Feb 2012 07:43:54 -0600 Subject: [PATCH] --- yaml --- r: 296519 b: refs/heads/master c: fe3ad593e2c34457ffa6233014ab19f4d36f85f2 h: refs/heads/master i: 296517: ec15020d95fffcdf5beefc3e32d518466e524a77 296515: a5767b51e227fa9336adf63c0bfd69c93e5e543a 296511: 1cc88f7d05f1aaf8b71d8ad040d3f0d6a89c2a73 v: v3 --- [refs] | 2 +- trunk/net/ceph/messenger.c | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index cc0032d95572..75402a8248a4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a9a0c51af4e7c825c014b40694571456a75ebbc4 +refs/heads/master: fe3ad593e2c34457ffa6233014ab19f4d36f85f2 diff --git a/trunk/net/ceph/messenger.c b/trunk/net/ceph/messenger.c index 7ec6a228b667..575511a29eb7 100644 --- a/trunk/net/ceph/messenger.c +++ b/trunk/net/ceph/messenger.c @@ -1544,10 +1544,9 @@ static int read_partial_message_section(struct ceph_connection *con, if (ret <= 0) return ret; section->iov_len += ret; - if (section->iov_len == sec_len) - *crc = crc32c(0, section->iov_base, - section->iov_len); } + if (section->iov_len == sec_len) + *crc = crc32c(0, section->iov_base, section->iov_len); return 1; } @@ -1638,6 +1637,7 @@ static int read_partial_message(struct ceph_connection *con) bool do_datacrc = con->msgr->nocrc; int skip; u64 seq; + u32 crc; dout("read_partial_message con %p msg %p\n", con, m); @@ -1650,18 +1650,16 @@ static int read_partial_message(struct ceph_connection *con) if (ret <= 0) return ret; con->in_base_pos += ret; - if (con->in_base_pos == sizeof(con->in_hdr)) { - u32 crc = crc32c(0, &con->in_hdr, - offsetof(struct ceph_msg_header, crc)); - - if (cpu_to_le32(crc) != con->in_hdr.crc) { - pr_err("read_partial_message bad hdr " - " crc %u != expected %u\n", - crc, con->in_hdr.crc); - return -EBADMSG; - } - } } + + crc = crc32c(0, &con->in_hdr, offsetof(struct ceph_msg_header, crc)); + if (cpu_to_le32(crc) != con->in_hdr.crc) { + pr_err("read_partial_message bad hdr " + " crc %u != expected %u\n", + crc, con->in_hdr.crc); + return -EBADMSG; + } + front_len = le32_to_cpu(con->in_hdr.front_len); if (front_len > CEPH_MSG_MAX_FRONT_LEN) return -EIO;