Re: [PATCH 4/4] cpg: Ensure ipc client don't exceeds msg limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK


On 14/01/15 17:04, Jan Friesse wrote:
Totem/cpg service/... adds headers to message, so even message which
fits limit becomes larger. To prevent this to happen, smaller limit is
checked.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
  lib/cpg.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lib/cpg.c b/lib/cpg.c
index 4b92f44..1cc021b 100644
--- a/lib/cpg.c
+++ b/lib/cpg.c
@@ -979,6 +979,14 @@ cs_error_t cpg_mcast_joined (
  		msg_len += iovec[i].iov_len;
  	}

+	/*
+	 * 512 is engineering aproximation of structure headers added by cpg/totem/...
+	 * It's impossible to send larger messages
+	 */
+	if (msg_len > IPC_REQUEST_SIZE - 512) {
+		return (CS_ERR_TOO_BIG);
+	}
+
  	req_lib_cpg_mcast.header.size = sizeof (struct req_lib_cpg_mcast) +
  		msg_len;



_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss



[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux