diff mbox

libceph: skip message if too big to receive

Message ID 515F4DAB.8090805@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder April 5, 2013, 10:18 p.m. UTC
We know the length of our message buffers.  If we get a message
that's too long, just dump it and ignore it.

This resolves:
    http://tracker.ceph.com/issues/4664

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/messenger.c |    6 ++++++
 1 file changed, 6 insertions(+)

 			dout("alloc_msg said skip message\n");
diff mbox

Patch

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 994192b..ae825e44 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2207,6 +2207,12 @@  static int read_partial_message(struct
ceph_connection *con)
 		ret = ceph_con_in_msg_alloc(con, &skip);
 		if (ret < 0)
 			return ret;
+
+		if (data_len > con->in_msg->data_length) {
+			pr_warning("%s skipping long message (%u > %zd)\n",
+				__func__, data_len, con->in_msg->data_length);
+			skip = 1;
+		}
 		if (skip) {
 			/* skip this message */