]> git.baikalelectronics.ru Git - kernel.git/commit
mptcp: don't return sockets in foreign netns
authorFlorian Westphal <fw@strlen.de>
Fri, 24 Sep 2021 00:04:11 +0000 (17:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Sep 2021 09:51:36 +0000 (10:51 +0100)
commit84cad7d9a1361bdeea56976b206f4c9aaba1aa5f
treef43dbc42ad77111069190f44356c68ca7260f4ff
parente9085d70d878b8a3482e3df91b99c3f6455a2b22
mptcp: don't return sockets in foreign netns

mptcp_token_get_sock() may return a mptcp socket that is in
a different net namespace than the socket that received the token value.

The mptcp syncookie code path had an explicit check for this,
this moves the test into mptcp_token_get_sock() function.

Eventually token.c should be converted to pernet storage, but
such change is not suitable for net tree.

Fixes: 43daacf018af7 ("mptcp: refactor token container")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/mptcp_diag.c
net/mptcp/protocol.h
net/mptcp/subflow.c
net/mptcp/syncookies.c
net/mptcp/token.c
net/mptcp/token_test.c