diff options
author | Florian Westphal <fw@strlen.de> | 2021-09-23 17:04:11 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-09-24 10:51:36 +0100 |
commit | ea1300b9df7c8e8b65695a08b8f6aaf4b25fec9c (patch) | |
tree | f43dbc42ad77111069190f44356c68ca7260f4ff /net/mptcp/mptcp_diag.c | |
parent | f7e745f8e94492a8ac0b0a26e25f2b19d342918f (diff) | |
download | linux-ea1300b9df7c8e8b65695a08b8f6aaf4b25fec9c.tar.bz2 |
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: 2c5ebd001d4f0 ("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>
Diffstat (limited to 'net/mptcp/mptcp_diag.c')
-rw-r--r-- | net/mptcp/mptcp_diag.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mptcp/mptcp_diag.c b/net/mptcp/mptcp_diag.c index f48eb6315bbb..292374fb0779 100644 --- a/net/mptcp/mptcp_diag.c +++ b/net/mptcp/mptcp_diag.c @@ -36,7 +36,7 @@ static int mptcp_diag_dump_one(struct netlink_callback *cb, struct sock *sk; net = sock_net(in_skb->sk); - msk = mptcp_token_get_sock(req->id.idiag_cookie[0]); + msk = mptcp_token_get_sock(net, req->id.idiag_cookie[0]); if (!msk) goto out_nosk; |