Skip to content
Commit 2b4f46f9 authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by Greg Kroah-Hartman
Browse files

mptcp: pm: avoid possible UaF when selecting endp



commit 48e50dcbcbaaf713d82bf2da5c16aeced94ad07d upstream.

select_local_address() and select_signal_address() both select an
endpoint entry from the list inside an RCU protected section, but return
a reference to it, to be read later on. If the entry is dereferenced
after the RCU unlock, reading info could cause a Use-after-Free.

A simple solution is to copy the required info while inside the RCU
protected section to avoid any risk of UaF later. The address ID might
need to be modified later to handle the ID0 case later, so a copy seems
OK to deal with.

Reported-by: default avatarPaolo Abeni <pabeni@redhat.com>
Closes: https://lore.kernel.org/45cd30d3-7710-491c-ae4d-a1368c00beb1@redhat.com
Fixes: 01cacb00

 ("mptcp: add netlink-based PM")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-14-38035d40de5b@kernel.org
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
[ Conflicts in pm_netlink.c, because the context has been modified in
  commit b9d69db8

 ("mptcp: let the in-kernel PM use mixed IPv4 and
  IPv6 addresses"), which is not a candidate for the backports. The same
  modifications have been applied in this version. The conflict in
  mptcp_pm_create_subflow_or_signal_addr() has been resolved by taking
  the newer version, which skip a lock if it is not needed. ]
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 733da337
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment