Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756677AbcCBAV5 (ORCPT ); Tue, 1 Mar 2016 19:21:57 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:43800 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932332AbcCAX5v (ORCPT ); Tue, 1 Mar 2016 18:57:51 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=R4IAQiFJmuf61Y3Ad78ORxiujyrD7bspGN42QvqYKzBAFmZE+y8fqv/THu9CiiPYIa7Ju2j+BT7n yqArk74CKHs0JvXWM+pQULzkPXtHNlYPhehaCm/5m2xm9ZGe7yEhS5Z2TNblDb89vWK2G8rCEuYT 67//l4tHh4oLgJplsuk=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 265/342] libceph: use the right footer size when skipping a message X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Ilya Dryomov , Alex Elder Message-Id: <20160301234536.460085373@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.25b81e607b7d4022946dbab2c6b3111f X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:13 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1674 Lines: 53 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ilya Dryomov commit dbc0d3caff5b7591e0cf8e34ca686ca6f4479ee1 upstream. 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. Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- net/ceph/messenger.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1200,6 +1200,13 @@ static bool ceph_msg_data_advance(struct 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); @@ -2338,7 +2345,7 @@ static int read_partial_message(struct c 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) { @@ -2363,7 +2370,7 @@ static int read_partial_message(struct c /* 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;