Skip to content

tcp: clamp route advmss to TCP_MIN_MSS

Ren Wei netdev 1 version Applied

Status from this message: This patch was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest1 patch 0 repliesApplied 1/1

Changes in v2 from the cover letter

- drop the RTAX_ADVMSS input validation from previous version
- clamp route-derived advmss in TCP instead
- switch the relevant TCP IPv4/IPv6 call sites to the new helper
- drop the long reproducer script and crash log from the cover letter
v1 link: https://lore.kernel.org/all/2c3901162c65a1d85cc1756a83a458db834d70c1.1786610865.git.edragain@163.com/

Patches in v2 All 1 applied

#Subject and filesSizeRepliesApplied
1/1tcp: clamp route advmss to TCP_MIN_MSSinclude/net/tcp.h net/ipv4/tcp_ipv4.c net/ipv4/tcp_minisocks.c +2 more+11 -60 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net v2 0/1] tcp: clamp route advmss to TCP_MIN_MSS

From: Yong Wang <[email protected]>

Hi Linux kernel maintainers,

This is v2 of the fix for the divide-by-zero reachable from tcp_select_initial_window() via undersized route-derived advmss.

The previous version only rejected undersized non-zero RTAX_ADVMSS values at the route metric input point. As pointed out in review, that does not fully fix the bug because the panic is still reachable through the "default advmss" path when RTAX_ADVMSS is 0 and the effective advmss is later driven down by route MTU and min_adv_mss.

This version fixes the bug in TCP by introducing a helper that clamps route-derived advmss to TCP_MIN_MSS before it is consumed by the TCP paths that derive advmss from dst metrics.

I tested this version in QEMU and confirmed that the previously reproducible divide-by-zero no longer occurs on the advmss=0 + small-MTU/min_adv_mss path.

Thanks,
Yong Wang

---
Changes in v2:
- drop the RTAX_ADVMSS input validation from previous version
- clamp route-derived advmss in TCP instead
- switch the relevant TCP IPv4/IPv6 call sites to the new helper
- drop the long reproducer script and crash log from the cover letter
v1 link: https://lore.kernel.org/all/2c3901162c65a1d85cc1756a83a458db834d70c1.1786610865.git.edragain@163.com/

Yong Wang (1):
tcp: clamp route advmss to TCP_MIN_MSS

 include/net/tcp.h        | 5 +++++
 net/ipv4/tcp_ipv4.c      | 2 +-
 net/ipv4/tcp_minisocks.c | 2 +-
 net/ipv4/tcp_output.c    | 6 +++---
 net/ipv6/tcp_ipv6.c      | 2 +-
 5 files changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.53.0