Forráskód Böngészése

totempg: Allow space for incoming overflow

totempg needs to store the current message + any
overflow for the next message which can be up to (nearly) the MTU size.
in knet that's large, but for UDP it's just 1500.

The reason we've never seen it before is because the actual max message
size is 1024 less than 1MB and after all the headers are stripped out the overflow is
usually 1024 bytes or less.
The 1024*1024 size of the assembly buffer is large enough to hold a max message (1047552) +
1024 bytes of a new UDP message. So we never saw any problems.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 8 éve
szülő
commit
9898fc8760
1 módosított fájl, 2 hozzáadás és 1 törlés
  1. 2 1
      exec/totempg.c

+ 2 - 1
exec/totempg.c

@@ -199,7 +199,7 @@ enum throw_away_mode {
 
 
 struct assembly {
 struct assembly {
 	unsigned int nodeid;
 	unsigned int nodeid;
-	unsigned char data[MESSAGE_SIZE_MAX];
+	unsigned char data[MESSAGE_SIZE_MAX+KNET_MAX_PACKET_SIZE];
 	int index;
 	int index;
 	unsigned char last_frag_num;
 	unsigned char last_frag_num;
 	enum throw_away_mode throw_away_mode;
 	enum throw_away_mode throw_away_mode;
@@ -632,6 +632,7 @@ static void totempg_deliver_fn (
 		}
 		}
 	}
 	}
 
 
+	assert((assembly->index+msg_len) < sizeof(assembly->data));
 	memcpy (&assembly->data[assembly->index], &data[datasize],
 	memcpy (&assembly->data[assembly->index], &data[datasize],
 		msg_len - datasize);
 		msg_len - datasize);