mptcp: fix race in incoming ADD_ADDR option processing
authorPaolo Abeni <pabeni@redhat.com>
Fri, 18 Feb 2022 21:35:41 +0000 (13:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Feb 2022 12:28:00 +0000 (12:28 +0000)
commit837cf45df163a3780bc04b555700231e95b31dc9
treef059a95f02bfad5cb1929eda0a3e26f0aca1bb94
parent98247bc16a27cf8ead4c47ce9f15888be85841fc
mptcp: fix race in incoming ADD_ADDR option processing

If an MPTCP endpoint received multiple consecutive incoming
ADD_ADDR options, mptcp_pm_add_addr_received() can overwrite
the current remote address value after the PM lock is released
in mptcp_pm_nl_add_addr_received() and before such address
is echoed.

Fix the issue caching the remote address value a little earlier
and always using the cached value after releasing the PM lock.

Fixes: f7efc7771eac ("mptcp: drop argument port from mptcp_pm_announce_addr")
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/pm_netlink.c