Skip to content

mptcp: fix ADD_ADDR retransmission socket leaks

Karl Mehltretter lkml mptcp netdev stable 1 version Applied

Status from this message: Queued the series for 5.10, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2mptcp: pm: ADD_ADDR rtx: always decrease sk refcountnet/mptcp/pm_netlink.c+4 -60 replies
2/2mptcp: pm: ADD_ADDR rtx: free sk if lastnet/mptcp/pm_netlink.c+17 -90 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchMat Martineau
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 5.10.y 0/2] mptcp: fix ADD_ADDR retransmission socket leaks

Backport the two ordered ADD_ADDR retransmission timer fixes missing from 5.10.y. Patch 1 makes every terminal path release the socket reference held by the timer. Patch 2 uses sock_put() so the last reference frees the socket, while avoiding a timer self-deadlock during destruction.

Both fixes carry Cc: stable and are present in 5.15.y and every newer supported LTS. The original 11-patch cover groups patches 3-5 as the v5.10 ADD_ADDR timer data-race and leak fixes. Patch 3 is already present as d9b272a85fe6 ("mptcp: pm: ADD_ADDR rtx: fix potential data-race"); this series supplies the missing ordered patches 4 and 5:
https://patch.msgid.link/[email protected]

In v5.10 the timer code is in pm_netlink.c and uses fixed retransmission delays; the adaptations retain those details. Patch 1 also routes v5.10's unreachable ID 0 guard through the reference drop.

Tested on v5.10.269 with KASAN under QEMU. A targeted A/B forced the tracked MPTCP socket to TCP_CLOSE at timer entry: the vulnerable kernel ran the callback without destroying the socket, while the fixed kernel destroyed it. Both completed an identical MPTCP transfer without a KASAN report, Oops, or warning.

The fixed kernel also passed all 15 tests in pm_netlink.sh, a 16 MiB bidirectional transfer with a real ADD_ADDR/MP_JOIN second subflow, and an 8 MiB curl --mptcp transfer. All payload comparisons were byte-exact.

Matthieu Baerts (NGI0) (2):
mptcp: pm: ADD_ADDR rtx: always decrease sk refcount
mptcp: pm: ADD_ADDR rtx: free sk if last

 net/mptcp/pm_netlink.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
Signature · 1 line
2.53.0