When setting up a subflow's flags for sending MP_PRIO MPTCP options, the
subflow socket lock was not held while reading and modifying several
struct members that are also read and modified in mptcp_write_options().
Acquire the subflow socket lock earlier and send the MP_PRIO ACK with
that lock already acquired.
Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support")
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
net/mptcp/pm_netlink.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index d04b34fc9a8e..05c6a95e9c28 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -729,11 +729,13 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
struct sock *sk = (struct sock *)msk;
struct mptcp_addr_info local;
+ bool slow;
local_address((struct sock_common *)ssk, &local);
if (!mptcp_addresses_equal(&local, addr, addr->port))
continue;
+ slow = lock_sock_fast(ssk);
if (subflow->backup != bkup)
msk->last_snd = NULL;
subflow->backup = bkup;
@@ -742,7 +744,8 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
__MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPPRIOTX);
pr_debug("send ack for mp_prio");
- mptcp_subflow_send_ack(ssk);
+ __mptcp_subflow_send_ack(ssk);
+ unlock_sock_fast(ssk, slow);
return 0;
}
--
2.37.0
On Tue, 2022-06-28 at 12:03 -0700, Mat Martineau wrote:
> When setting up a subflow's flags for sending MP_PRIO MPTCP options, the
> subflow socket lock was not held while reading and modifying several
> struct members that are also read and modified in mptcp_write_options().
>
> Acquire the subflow socket lock earlier and send the MP_PRIO ACK with
> that lock already acquired.
>
> Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support")
> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
> ---
> net/mptcp/pm_netlink.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index d04b34fc9a8e..05c6a95e9c28 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -729,11 +729,13 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
> struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> struct sock *sk = (struct sock *)msk;
> struct mptcp_addr_info local;
> + bool slow;
>
> local_address((struct sock_common *)ssk, &local);
> if (!mptcp_addresses_equal(&local, addr, addr->port))
> continue;
>
> + slow = lock_sock_fast(ssk);
> if (subflow->backup != bkup)
> msk->last_snd = NULL;
> subflow->backup = bkup;
> @@ -742,7 +744,8 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
> __MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPPRIOTX);
>
> pr_debug("send ack for mp_prio");
> - mptcp_subflow_send_ack(ssk);
> + __mptcp_subflow_send_ack(ssk);
> + unlock_sock_fast(ssk, slow);
After this chunk, we can remove mptcp_subflow_send_ack() from
protocol.h and make it static. I think it's easier squashing this patch
into the previous one.
Thanks!
Paolo
>
> return 0;
> }
On Wed, 29 Jun 2022, Paolo Abeni wrote:
> On Tue, 2022-06-28 at 12:03 -0700, Mat Martineau wrote:
>> When setting up a subflow's flags for sending MP_PRIO MPTCP options, the
>> subflow socket lock was not held while reading and modifying several
>> struct members that are also read and modified in mptcp_write_options().
>>
>> Acquire the subflow socket lock earlier and send the MP_PRIO ACK with
>> that lock already acquired.
>>
>> Fixes: 067065422fcd ("mptcp: add the outgoing MP_PRIO support")
>> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
>> ---
>> net/mptcp/pm_netlink.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
>> index d04b34fc9a8e..05c6a95e9c28 100644
>> --- a/net/mptcp/pm_netlink.c
>> +++ b/net/mptcp/pm_netlink.c
>> @@ -729,11 +729,13 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
>> struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
>> struct sock *sk = (struct sock *)msk;
>> struct mptcp_addr_info local;
>> + bool slow;
>>
>> local_address((struct sock_common *)ssk, &local);
>> if (!mptcp_addresses_equal(&local, addr, addr->port))
>> continue;
>>
>> + slow = lock_sock_fast(ssk);
>> if (subflow->backup != bkup)
>> msk->last_snd = NULL;
>> subflow->backup = bkup;
>> @@ -742,7 +744,8 @@ static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
>> __MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPPRIOTX);
>>
>> pr_debug("send ack for mp_prio");
>> - mptcp_subflow_send_ack(ssk);
>> + __mptcp_subflow_send_ack(ssk);
>> + unlock_sock_fast(ssk, slow);
>
> After this chunk, we can remove mptcp_subflow_send_ack() from
> protocol.h and make it static. I think it's easier squashing this patch
> into the previous one.
>
There's still a call to mptcp_subflow_send_ack() in pm_netlink.c, so I'll
leave both in protocol.h for now. Will squash patches 2 & 3 though.
--
Mat Martineau
Intel
Hi Mat,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 1 failed test(s): selftest_simult_flows 🔴:
- Task: https://cirrus-ci.com/task/5828656101588992
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5828656101588992/summary/summary.txt
- KVM Validation: debug:
- Unstable: 2 failed test(s): packetdrill_add_addr selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/5265706148167680
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5265706148167680/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/aebc91b918e8
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-debug
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)
© 2016 - 2026 Red Hat, Inc.