Commit 34b92e8d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: limit GSO_MAX_SIZE to 524280 bytes

Make sure we will not overflow shinfo->gso_segs

Minimal TCP MSS size is 8 bytes, and shinfo->gso_segs
is a 16bit field.

TCP_MIN_GSO_SIZE is currently defined in include/net/tcp.h,
it seems cleaner to not bring tcp details into include/linux/netdevice.h
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7c4e983c
...@@ -2272,14 +2272,17 @@ struct net_device { ...@@ -2272,14 +2272,17 @@ struct net_device {
const struct rtnl_link_ops *rtnl_link_ops; const struct rtnl_link_ops *rtnl_link_ops;
/* for setting kernel sock attribute on TCP connection setup */ /* for setting kernel sock attribute on TCP connection setup */
#define GSO_MAX_SEGS 65535u
#define GSO_LEGACY_MAX_SIZE 65536u #define GSO_LEGACY_MAX_SIZE 65536u
#define GSO_MAX_SIZE UINT_MAX /* TCP minimal MSS is 8 (TCP_MIN_GSO_SIZE),
* and shinfo->gso_segs is a 16bit field.
*/
#define GSO_MAX_SIZE (8 * GSO_MAX_SEGS)
unsigned int gso_max_size; unsigned int gso_max_size;
#define TSO_LEGACY_MAX_SIZE 65536 #define TSO_LEGACY_MAX_SIZE 65536
#define TSO_MAX_SIZE UINT_MAX #define TSO_MAX_SIZE UINT_MAX
unsigned int tso_max_size; unsigned int tso_max_size;
#define GSO_MAX_SEGS 65535
u16 gso_max_segs; u16 gso_max_segs;
#define TSO_MAX_SEGS U16_MAX #define TSO_MAX_SEGS U16_MAX
u16 tso_max_segs; u16 tso_max_segs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment