milos-linux/net/xfrm
Wyatt Feng c381039ade xfrm: espintcp: do not reuse an in-progress partial send
espintcp keeps a single in-flight transmit in ctx->partial.
Before building a new sk_msg, espintcp_sendmsg() first tries to flush
that state through espintcp_push_msgs().

For blocking callers, espintcp_push_msgs() may return success even when
the previous partial send is still pending. espintcp_sendmsg() would
then reinitialize emsg->skmsg and reuse ctx->partial while the old
transfer still owns that state.

Do not rebuild the send message when ctx->partial is still in progress.
If espintcp_push_msgs() returns with emsg->len still set, fail the new
send instead of overwriting the live partial state.

This is a memory-safety fix: reusing the live partial-send state can
leave a stale offset attached to a new sk_msg and lead to an out-of-
bounds read in the send path.

tcp_sendmsg_locked() already handles waiting for send buffer memory, so
the fix here is just to preserve espintcp's one-message-at-a-time
transmit state.

Fixes: e27cca96cd ("xfrm: add espintcp (RFC 8229)")
Cc: stable@kernel.org
Reported-by: Yuan Tan <yuantan098@gmail.com>
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Zhengchuan Liang <zcliangcn@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Assisted-by: Codex:GPT-5.4
Signed-off-by: Wyatt Feng <bronzed_45_vested@icloud.com>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
2026-06-05 13:20:03 +02:00
..
espintcp.c xfrm: espintcp: do not reuse an in-progress partial send 2026-06-05 13:20:03 +02:00
Kconfig pfkey: Deprecate pfkey 2025-10-30 09:03:12 +01:00
Makefile xfrm: iptfs: add new iptfs xfrm mode impl 2024-12-05 10:01:35 +01:00
trace_iptfs.h xfrm: iptfs: add tracepoint functionality 2024-12-05 10:02:36 +01:00
xfrm_algo.c xfrm: Drop support for HMAC-RIPEMD-160 2026-04-07 10:47:58 +02:00
xfrm_compat.c xfrm: netlink: add config (netlink) options 2024-12-05 10:01:15 +01:00
xfrm_device.c xfrm: always flush state and policy upon NETDEV_UNREGISTER event 2026-02-09 10:28:05 +01:00
xfrm_hash.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
xfrm_hash.h xfrm: add state hashtable keyed by seq 2021-05-14 13:52:01 +02:00
xfrm_inout.h xfrm: move xfrm4_extract_header to common helper 2020-05-06 09:40:08 +02:00
xfrm_input.c xfrm: input: hold netns during deferred transport reinjection 2026-05-26 10:35:30 +02:00
xfrm_interface_bpf.c bpf: treewide: Annotate BPF kfuncs in BTF 2024-01-31 20:40:56 -08:00
xfrm_interface_core.c xfrm: interface: fix use-after-free after changing collect_md xfrm interface 2025-07-04 09:25:25 +02:00
xfrm_ipcomp.c xfrm: ipcomp: Free destination pages on acomp errors 2026-05-11 10:34:35 +02:00
xfrm_iptfs.c xfrm: iptfs: fix ABBA deadlock in iptfs_destroy_state() 2026-06-05 13:06:08 +02:00
xfrm_nat_keepalive.c net: convert remaining ipv6_stub users to direct function calls 2026-03-29 11:21:23 -07:00
xfrm_output.c xfrm: Don't clobber inner headers when already set 2026-04-28 06:47:20 +02:00
xfrm_policy.c xfrm: policy: fix use-after-free on inexact bin in xfrm_policy_bysel_ctx() 2026-06-04 11:55:22 +02:00
xfrm_proc.c xfrm: snmp: do not use SNMP_MIB_SENTINEL anymore 2025-09-08 18:06:21 -07:00
xfrm_replay.c ipsec-2025-01-27 2025-01-27 15:15:12 -08:00
xfrm_state.c xfrm: Check for underflow in xfrm_state_mtu 2026-05-14 10:17:43 +02:00
xfrm_state_bpf.c bpf: xfrm: drop dead NULL check in bpf_xdp_get_xfrm_state() 2026-01-02 12:04:29 -08:00
xfrm_sysctl.c net: Remove ctl_table sentinel elements from several networking subsystems 2024-05-03 13:29:42 +01:00
xfrm_user.c xfrm: route MIGRATE notifications to caller's netns 2026-05-07 09:31:10 +02:00