]> git.baikalelectronics.ru Git - kernel.git/commit
mptcp: fix NULL ptr dereference on bad MPJ
authorPaolo Abeni <pabeni@redhat.com>
Thu, 26 Nov 2020 14:17:53 +0000 (15:17 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Nov 2020 19:05:31 +0000 (11:05 -0800)
commit51e7ee03f6f43eb2388f9d74ce972645c5c578b0
tree7c248f3c5fd8372dab6afa8a5f7c888a64dfd91e
parent4af693f8a909a65e70388798d0942b1bf5ce9f88
mptcp: fix NULL ptr dereference on bad MPJ

If an msk listener receives an MPJ carrying an invalid token, it
will zero the request socket msk entry. That should later
cause fallback and subflow reset - as per RFC - at
subflow_syn_recv_sock() time due to failing hmac validation.

Since commit b2c41b32b773 ("subflow: introduce and use
mptcp_can_accept_new_subflow()"), we unconditionally dereference
- in mptcp_can_accept_new_subflow - the subflow request msk
before performing hmac validation. In the above scenario we
hit a NULL ptr dereference.

Address the issue doing the hmac validation earlier.

Fixes: b2c41b32b773 ("subflow: introduce and use mptcp_can_accept_new_subflow()")
Tested-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/r/03b2cfa3ac80d8fc18272edc6442a9ddf0b1e34e.1606400227.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/subflow.c