diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2016-02-19 11:38:57 +0100 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-03-07 16:35:33 -0500 |
commit | 66333f910d64623fa9cc886c259d57e6d24863cd (patch) | |
tree | a0c9802aa5271390ef189091c178968fd8c06b0d /net | |
parent | 265570c9977908479db74fd07b710ec5d5c96e12 (diff) | |
download | lwn-66333f910d64623fa9cc886c259d57e6d24863cd.tar.gz lwn-66333f910d64623fa9cc886c259d57e6d24863cd.zip |
libceph: use the right footer size when skipping a message
[ Upstream commit dbc0d3caff5b7591e0cf8e34ca686ca6f4479ee1 ]
ceph_msg_footer is 21 bytes long, while ceph_msg_footer_old is only 13.
Don't skip too much when CEPH_FEATURE_MSG_AUTH isn't negotiated.
Cc: stable@vger.kernel.org # 3.19+
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/messenger.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index ff92dee168ba..84201c21705e 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1203,6 +1203,13 @@ static bool ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, return new_piece; } +static size_t sizeof_footer(struct ceph_connection *con) +{ + return (con->peer_features & CEPH_FEATURE_MSG_AUTH) ? + sizeof(struct ceph_msg_footer) : + sizeof(struct ceph_msg_footer_old); +} + static void prepare_message_data(struct ceph_msg *msg, u32 data_len) { BUG_ON(!msg); @@ -2326,7 +2333,7 @@ static int read_partial_message(struct ceph_connection *con) ceph_pr_addr(&con->peer_addr.in_addr), seq, con->in_seq + 1); con->in_base_pos = -front_len - middle_len - data_len - - sizeof(m->footer); + sizeof_footer(con); con->in_tag = CEPH_MSGR_TAG_READY; return 1; } else if ((s64)seq - (s64)con->in_seq > 1) { @@ -2358,7 +2365,7 @@ static int read_partial_message(struct ceph_connection *con) /* skip this message */ dout("alloc_msg said skip message\n"); con->in_base_pos = -front_len - middle_len - data_len - - sizeof(m->footer); + sizeof_footer(con); con->in_tag = CEPH_MSGR_TAG_READY; con->in_seq++; return 1; |