Subject: patch for udp_sendmsg

From: Zhenwei Pi <[email-masked]>
Date: Sun, 19 Jul 2015 22:38:54 +0800

Dear Sirs,

Commit : the max length of udp msg is (0xFFFF - sizeof(struct udphdr) - 
sizeof(struct iphdr). return -EMSGSIZE in udp_sendmsg.
Patch : as the attached file

____________________________________________________________
| IP header |  UDP header | udp data ........                             |
|___________|______________|_________________________________|
|--> Total Length : 
0xffff                                                       <--|

If length of "data" is between (0xFFFF - sizeof(struct udphdr) - 
sizeof(struct iphdr) and 0xFFFF, sendto will fail because of ip_make_skb.
Should kernel return -EMSGSIZE as soon as possible ?

-- 
Zhenwei Pi
Rather than love ,than money ,than faith,than fame,than fairness,give me truth.

--- udp.c.orig	2015-07-19 09:28:16.732477245 +0800
+++ udp.c	2015-07-19 09:29:46.952441957 +0800
@@ -894,7 +894,7 @@
 	struct sk_buff *skb;
 	struct ip_options_data opt_copy;
 
-	if (len > 0xFFFF)
+	if (len > (0xFFFF - sizeof(struct udphdr) - sizeof(struct iphdr)))
 		return -EMSGSIZE;
 
 	/*