linux/Documentation/networking
Eric Dumazet 83a945a529 tcp: do not let tcp_rmem be set below 4096
We can hit a division by zero crash in tcp_rcvbuf_grow()
and tcp_rcv_space_adjust():

divide error: 0000 [#1] PREEMPT SMP
RIP: 0010:tcp_rcvbuf_grow+0x187/0x450 net/ipv4/tcp_input.c:939
...
grow = div_u64(((u64)rcvwin << 1) * (newval - oldval), oldval);

The division uses oldval = tp->rcvq_space.space as divisor.
When tp->rcvq_space.space is zero, this leads to a divide-by-zero
exception.

tp->rcvq_space.space is initialized in tcp_init_buffer_space():
    tp->rcvq_space.space = min3(tp->rcv_ssthresh, tp->rcv_wnd,
                                (u32)TCP_INIT_CWND * tp->advmss);

If tcp_rmem[1] is configured to very small values (such as 1),
sk->sk_rcvbuf is initialized to 1. Then tcp_full_space(sk), which
computes (sk->sk_rcvbuf * scaling_ratio) >> 8, truncates to 0.
This sets tp->window_clamp = 0, tp->rcv_ssthresh = 0, and
tp->rcvq_space.space = 0. Later, when data arrives and DRS is invoked,
tcp_rcvbuf_grow() divides by oldval == 0.

Back in 2015, commit b1cb59cf2e ("net: sysctl_net_core: check SNDBUF
and RCVBUF for min length") ensured that net.core.rmem_default and
net.core.rmem_max cannot be set below SOCK_MIN_RCVBUF. Similarly,
SO_RCVBUF setsockopt enforces max_t(int, val * 2, SOCK_MIN_RCVBUF).

However, net.ipv4.tcp_rmem still had .extra1 = SYSCTL_ONE, allowing
arbitrarily small values.

Because SOCK_MIN_RCVBUF depends on sizeof(struct sk_buff) and cacheline
alignment, its value varies across architectures and configuration options.
Using a fixed constant of 4096 ensures a predictable, architecture-
independent lower bound that is safely above SOCK_MIN_RCVBUF everywhere
and matches the documented 4K default.

Fix this by setting tcp_rmem.extra1 to 4096 and updating the documentation.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260912144848.3448026-1-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-09-15 15:21:17 +02:00
..
device_drivers linux-can-next-for-7.3-20260818 2026-08-18 10:30:21 -07:00
devlink ixd: add devlink support 2026-08-12 13:56:51 -07:00
diagnostic Documentation: use a source-read extension for the index link boilerplate 2026-01-23 11:59:34 -07:00
dsa dt-bindings: net: dsa: Convert lan9303.txt to yaml format 2026-06-13 15:00:07 -07:00
mac80211_hwsim
net_cachelines ipv4: fib: Define fib_table_hash_lock under CONFIG_IP_MULTIPLE_TABLES. 2026-07-07 10:51:06 +02:00
pse-pd net: pse-pd: Add support for PSE PIs 2024-04-18 18:27:33 -07:00
xfrm xfrm: add documentation for XFRM_MSG_MIGRATE_STATE 2026-06-04 12:22:50 +02:00
6lowpan.rst
af_xdp.rst xsk: reclaim invalid Tx descriptors in ZC batch path 2026-07-24 15:12:14 -07:00
alias.rst
arcnet-hardware.rst docs: net: arcnet: remove outdated/irrelevant information; improve style 2026-05-22 17:20:57 -07:00
arcnet.rst docs: net: arcnet: remove outdated/irrelevant information; improve style 2026-05-22 17:20:57 -07:00
atm.rst
bareudp.rst docs: net: bareudp: fix spelling and grammar mistakes 2024-11-30 13:54:28 -08:00
batman-adv.rst batman-adv: Use consistent name for mesh interface 2025-02-22 11:36:22 +01:00
bonding.rst bonding: 3ad: add lacp_strict configuration knob 2026-06-10 07:53:26 -07:00
bridge.rst docs: net: bridge: document stp_mode attribute 2026-04-10 15:52:25 -07:00
can_ucan_protocol.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
can.rst linux-can-fixes-for-6.18-20251014 2025-10-15 17:56:20 -07:00
cdc_mbim.rst Fix spelling mistake 2024-11-28 12:08:32 +01:00
checksum-offloads.rst docs: net: render the checksum comment in checksum-offloads.rst 2026-05-28 14:37:47 -07:00
dctcp.rst
devmem.rst docs: net: update devmem code examples 2026-05-28 14:37:46 -07:00
dns_resolver.rst net: dns_resolver: Fix request-key cross-reference 2025-09-26 15:21:38 -07:00
driver.rst docs: networking: add guidance on what to push via extack 2026-06-12 17:55:48 -07:00
eql.rst
ethtool-netlink.rst net: ethtool: add ethtool COALESCE_RX_CQE_FRAMES/NSECS 2026-03-18 20:01:10 -07:00
failover.rst
fib_trie.rst
filter.rst ARC: Add eBPF JIT support 2024-05-12 16:51:36 -07:00
gen_stats.rst
generic_netlink.rst Documentation: networking: Update generic_netlink_howto URL 2022-11-23 17:25:02 -08:00
generic-hdlc.rst
gtp.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
ieee802154.rst Documentation: ieee802154: fix grammar 2024-10-28 21:14:27 +01:00
ila.rst
index.rst net: remove ax25 and amateur radio (hamradio) subsystem 2026-04-23 10:24:02 -07:00
ioam6-sysctl.rst ipv6: ioam: Documentation for new IOAM sysctls 2021-07-21 08:14:33 -07:00
iou-zcrx.rst io_uring/zcrx: document area chunking parameter 2026-01-14 02:13:37 +00:00
ip_dynaddr.rst
ip-sysctl.rst tcp: do not let tcp_rmem be set below 4096 2026-09-15 15:21:17 +02:00
ipsec.rst
ipv6.rst
ipvlan.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
ipvs-sysctl.rst ipvs: fix doc syntax for conn_max sysctl 2026-06-14 12:51:55 +02:00
iso15765-2.rst Documentation/networking: fix basic node example document ISO 15765-2 2025-02-08 11:28:11 +01:00
j1939.rst can: j1939: Extend stack documentation with buffer size behavior 2025-02-19 11:10:53 +01:00
kapi.rst net-shapers: implement NL get operation 2024-10-10 08:30:22 -07:00
kcm.rst docs/kcm: Fix typo "BFP" 2025-03-24 12:20:42 -07:00
l2tp.rst documentation/networking: update l2tp docs 2024-08-11 04:38:49 +01:00
lapb-module.rst
mac80211-auth-assoc-deauth.txt
mac80211-injection.rst doc: networking: wireless: fix wiki website url 2020-06-08 10:05:53 +02:00
mctp.rst mctp: Add SIOCMCTP{ALLOC,DROP}TAG ioctls for tag control 2022-02-09 12:00:11 +00:00
mpls-sysctl.rst
mptcp-sysctl.rst mptcp: introduce add_addr_v6_port_drop_ts sysctl knob 2026-06-11 15:33:37 -07:00
mptcp.rst Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-09-11 17:40:13 -07:00
msg_zerocopy.rst docs: net: description of MSG_ZEROCOPY for AF_VSOCK 2023-10-15 13:19:42 +01:00
multi-pf-netdev.rst tools: ynl: move python code to separate sub-directory 2025-01-09 12:53:27 -08:00
multiqueue.rst
napi.rst docs: net: fix minor issues with the NAPI guide 2026-05-28 14:37:46 -07:00
net_dim.rst dim: pass dim_sample to net_dim() by reference 2024-11-03 12:36:54 -08:00
net_failover.rst Documentation: net: net_failover: Separate cloud-ifupdown-helper and reattach-vf.sh code blocks marker 2025-10-17 16:28:29 -07:00
netconsole.rst Documentation: netconsole: Separate literal code blocks for full and short netcat command name versions 2025-10-31 16:54:22 -07:00
netdev-features.rst docs: net: ethtool: document ops-locked drivers and op_needs_rtnl 2026-06-09 10:13:06 -07:00
netdevices.rst net: document NETDEV_UNREGISTER unlocked rationale 2026-07-07 15:31:37 +02:00
netfilter-sysctl.rst
netif-msg.rst
netmem.rst net: netkit: declare NETMEM_TX_NO_DMA mode 2026-05-18 18:49:06 -07:00
nexthop-group-resilient.rst Documentation: net: Document resilient next-hop groups 2021-03-29 13:51:38 -07:00
nf_conntrack-sysctl.rst netfilter: conntrack: remove DCCP protocol support 2025-07-03 13:51:39 +02:00
nf_flowtable.rst docs: nf_flowtable: fix compilation and warnings 2021-03-25 17:42:02 -07:00
nfc.rst net: nfc: Format userspace interface subsection headings 2025-10-21 10:57:45 +02:00
oa-tc6-framework.rst docs: oa-tc6-framework: Fix link to specification 2026-08-20 13:31:54 -07:00
openvswitch.rst
operstates.rst docs: operstates: document IF_OPER_TESTING 2021-08-02 15:16:04 +01:00
packet_mmap.rst docs: networking: packet_mmap: replace dead links with archive.org links 2024-10-28 15:47:10 -07:00
page_pool.rst docs: page_pool: drop the mention of the legacy stats API 2026-05-28 18:10:03 -07:00
phonet.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
phy-link-topology.rst Documentation: networking: document phy_link_topology 2024-08-23 13:04:35 +01:00
phy-port.rst Documentation: networking: Document the phy_port infrastructure 2026-01-13 18:52:36 -08:00
phy.rst net: phy: remove unused fixup unregistering functions 2026-01-15 19:48:26 -08:00
pktgen.rst pktgen: Introducing 'SHARED' flag for testing with non-shared skb 2023-09-28 16:25:14 +02:00
plip.rst
ppp_generic.rst docs: update ppp_generic.rst to document new ioctls 2020-12-10 13:57:36 -08:00
proc_net_tcp.rst
psp.rst psp: add documentation 2025-09-18 12:32:06 +02:00
radiotap-headers.rst
rds.rst Documentation: Fix networking typos 2025-08-18 10:31:20 -06:00
regulatory.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
representors.rst Documentation: Add documentation for eswitch attribute 2024-03-28 18:20:08 -07:00
rxrpc.rst Documentation: rxrpc: Demote three sections 2025-09-24 18:12:10 -07:00
scaling.rst net-sysfs: use rps_tag_ptr and remove metadata from rps_sock_flow_table 2026-03-04 16:54:09 -08:00
sctp.rst
secid.rst
seg6-sysctl.rst doc: fix seg6_flowlabel path 2025-10-12 22:51:37 +01:00
segmentation-offloads.rst docs: net: fix minor issues with segmentation offloads 2026-05-28 14:37:47 -07:00
sfp-phylink.rst doc: sfp-phylink: update the porting guide with PCS handling 2024-03-07 15:27:05 +01:00
skbuff.rst docs: net: render the checksum comment in checksum-offloads.rst 2026-05-28 14:37:47 -07:00
smc-sysctl.rst Documentation: net/smc: correct old value of smcr_max_recv_wr 2026-04-27 16:49:39 -07:00
snmp_counter.rst docs: automarkup: linkify git revs 2023-11-17 13:13:24 -07:00
sriov.rst docs: net: document guidance of implementing the SR-IOV NDOs 2024-06-21 10:18:45 +01:00
statistics.rst docs: net: statistics: fix kernel-internal stats list 2026-05-28 14:37:46 -07:00
strparser.rst docs: net: fix minor issues with strparser docs 2026-06-15 15:42:53 -07:00
switchdev.rst net: rename netns_local to netns_immutable 2025-03-04 12:44:48 +01:00
sysfs-tagging.rst Documentation: networking: correct spelling 2023-01-31 13:00:47 +01:00
tc-actions-env-rules.rst docs: networking: convert tc-actions-env-rules.txt to ReST 2020-04-30 12:56:38 -07:00
tc-queue-filters.rst Documentation: networking: TC queue based filtering 2022-10-25 10:32:40 +02:00
tcp_ao.rst Documentation/tcp_ao: Document the supported MAC algorithms and lengths 2026-05-02 10:18:09 -07:00
tcp-thin.rst docs: networking: convert tcp-thin.txt to ReST 2020-04-30 12:56:38 -07:00
team.rst docs: networking: convert team.txt to ReST 2020-04-30 12:56:38 -07:00
timestamping.rst net: remove legacy way to get/set HW timestamp config 2026-01-20 18:21:27 -08:00
tipc.rst Documentation: tipc: fix formatting issue in tipc.rst 2024-11-19 11:17:13 +01:00
tls-handshake.rst net/handshake: Fixed grammar mistake 2026-02-27 19:24:08 -08:00
tls-offload-layers.svg
tls-offload-reorder-bad.svg
tls-offload-reorder-good.svg
tls-offload.rst docs: net: tls-offload: document tls_dev_del, tls_dev_resync, and rekey 2026-06-15 15:42:52 -07:00
tls.rst net/tls: support setting the maximum payload size 2025-10-27 16:13:42 -07:00
tproxy.rst docs: tproxy: fix formatting for nft code block 2025-04-29 00:00:26 +02:00
tuntap.rst tun/tap & vhost-net: stop tail-drop when IFF_BACKPRESSURE is set 2026-08-07 17:29:16 -07:00
udplite.rst docs: networking: convert udplite.txt to ReST 2020-05-01 12:24:40 -07:00
vrf.rst doc: Document unexpected tcp_l3mdev_accept=1 behavior 2021-08-23 11:53:24 +01:00
vxlan.rst docs: vxlan: add info about device features 2020-09-28 12:50:12 -07:00
x25-iface.rst docs: networking: fix x25-iface.rst heading & index order 2023-05-10 10:31:46 +01:00
x25.rst net: x25: Remove unimplemented X.25-over-LLC code stubs 2020-12-12 17:15:33 -08:00
xdp-rx-metadata.rst docs: net: fix minor issues with XDP metadata docs 2026-06-12 15:58:02 -07:00
xsk-tx-metadata.rst docs: net: fix minor issues with XDP metadata docs 2026-06-12 15:58:02 -07:00