Skip to content

Commit 34b92e8

Browse files
edumazetdavem330
authored andcommitted
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: Eric Dumazet <[email protected]> Acked-by: Alexander Duyck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c4e983 commit 34b92e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/linux/netdevice.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,14 +2272,17 @@ struct net_device {
22722272
const struct rtnl_link_ops *rtnl_link_ops;
22732273

22742274
/* for setting kernel sock attribute on TCP connection setup */
2275+
#define GSO_MAX_SEGS 65535u
22752276
#define GSO_LEGACY_MAX_SIZE 65536u
2276-
#define GSO_MAX_SIZE UINT_MAX
2277+
/* TCP minimal MSS is 8 (TCP_MIN_GSO_SIZE),
2278+
* and shinfo->gso_segs is a 16bit field.
2279+
*/
2280+
#define GSO_MAX_SIZE (8 * GSO_MAX_SEGS)
22772281

22782282
unsigned int gso_max_size;
22792283
#define TSO_LEGACY_MAX_SIZE 65536
22802284
#define TSO_MAX_SIZE UINT_MAX
22812285
unsigned int tso_max_size;
2282-
#define GSO_MAX_SEGS 65535
22832286
u16 gso_max_segs;
22842287
#define TSO_MAX_SEGS U16_MAX
22852288
u16 tso_max_segs;

0 commit comments

Comments
 (0)