linux-stable/net/mptcp
Paolo Abeni a8a3e95c74 mptcp: fix race on unaccepted mptcp sockets
commit 6aeed90450 upstream.

When the listener socket owning the relevant request is closed,
it frees the unaccepted subflows and that causes later deletion
of the paired MPTCP sockets.

The mptcp socket's worker can run in the time interval between such delete
operations. When that happens, any access to msk->first will cause an UaF
access, as the subflow cleanup did not cleared such field in the mptcp
socket.

Address the issue explicitly traversing the listener socket accept
queue at close time and performing the needed cleanup on the pending
msk.

Note that the locking is a bit tricky, as we need to acquire the msk
socket lock, while still owning the subflow socket one.

Fixes: 86e39e0448 ("mptcp: keep track of local endpoint still available for each msk")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:54:50 +02:00
..
crypto.c
crypto_test.c
ctrl.c
diag.c
Kconfig
Makefile
mib.c mptcp: add the mibs for MP_RST 2022-03-04 21:54:30 -08:00
mib.h mptcp: add the mibs for MP_RST 2022-03-04 21:54:30 -08:00
mptcp_diag.c
options.c mptcp: fix checksum byte order 2022-05-18 13:05:42 +01:00
pm.c mptcp: reset the packet scheduler on incoming MP_PRIO 2022-06-09 10:29:57 +02:00
pm_netlink.c mptcp: reset the packet scheduler on PRIO change 2022-06-09 10:29:57 +02:00
protocol.c mptcp: fix race on unaccepted mptcp sockets 2022-07-07 17:54:50 +02:00
protocol.h mptcp: fix race on unaccepted mptcp sockets 2022-07-07 17:54:50 +02:00
sockopt.c mptcp: add SNDTIMEO setsockopt support 2022-02-16 20:52:03 -08:00
subflow.c mptcp: fix race on unaccepted mptcp sockets 2022-07-07 17:54:50 +02:00
syncookies.c
token.c
token_test.c