mptcp: don't return sockets in foreign netns
[ Upstream commit ea1300b9df7c8e8b65695a08b8f6aaf4b25fec9c ]
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: 2c5ebd001d
("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
9c6591ae8e
commit
560271d09f
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user