From: Paolo Abeni <pabeni@redhat.com>
To: Mat Martineau <mathew.j.martineau@linux.intel.com>,
mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net 3/3] mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags
Date: Wed, 29 Jun 2022 21:59:13 +0200 [thread overview]
Message-ID: <0a3f73ff8a19509737147af305cc521abb1bca9b.camel@redhat.com> (raw)
In-Reply-To: <20220628190356.326233-4-mathew.j.martineau@linux.intel.com>
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;
> }
next prev parent reply other threads:[~2022-06-29 19:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 19:03 [PATCH mptcp-net 0/3] Locking fixes for subflow flag changes Mat Martineau
2022-06-28 19:03 ` [PATCH mptcp-net 1/3] mptcp: Avoid acquiring PM lock for subflow priority changes Mat Martineau
2022-06-29 19:57 ` Paolo Abeni
2022-06-28 19:03 ` [PATCH mptcp-net 2/3] mptcp: Add a variant of mptcp_subflow_send_ack() for locked subflows Mat Martineau
2022-06-28 19:03 ` [PATCH mptcp-net 3/3] mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags Mat Martineau
2022-06-28 20:50 ` mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags: Tests Results MPTCP CI
2022-06-29 19:59 ` Paolo Abeni [this message]
2022-06-29 20:51 ` [PATCH mptcp-net 3/3] mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags Mat Martineau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a3f73ff8a19509737147af305cc521abb1bca9b.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=mathew.j.martineau@linux.intel.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).