]> git.baikalelectronics.ru Git - kernel.git/commit
mptcp: remove msk from the token container at destruction time.
authorPaolo Abeni <pabeni@redhat.com>
Fri, 29 May 2020 15:43:31 +0000 (17:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 31 May 2020 04:39:13 +0000 (21:39 -0700)
commit3fd6a138305d6478f4767d7822c0ff53e478db7b
tree3f1e30f2e51e151045ad9ca2e90f9af1c6c1bd7c
parent2da3247e484c3c45fadb68fb85d9cc6bdb7826e6
mptcp: remove msk from the token container at destruction time.

Currently we remote the msk from the token container only
via mptcp_close(). The MPTCP master socket can be destroyed
also via other paths (e.g. if not yet accepted, when shutting
down the listener socket). When we hit the latter scenario,
dangling msk references are left into the token container,
leading to memory corruption and/or UaF.

This change addresses the issue by moving the token removal
into the msk destructor.

Fixes: 2fd8e466cf06 ("mptcp: Add key generation and token tree")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c