From: Mat Martineau <mathew.j.martineau at linux.intel.com>
To: mptcp at lists.01.org
Subject: [MPTCP] Re: [PATCH mptcp] mptcp: put subflow sock on connect error
Date: Wed, 17 Feb 2021 16:17:35 -0800 [thread overview]
Message-ID: <8461659f-aea8-e48b-43a5-3da73862b4e6@linux.intel.com> (raw)
In-Reply-To: 20210217154205.7379-1-fw@strlen.de
[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]
On Wed, 17 Feb 2021, Florian Westphal wrote:
> mptcp_add_pending_subflow() performs a sock_hold() on the subflow,
> then adds the subflow to the join list.
>
> Without a sock_put the subflow sk won't be freed in case connect() fails.
>
> unreferenced object 0xffff88810c03b100 (size 3000):
> [..]
> sk_prot_alloc.isra.0+0x2f/0x110
> sk_alloc+0x5d/0xc20
> inet6_create+0x2b7/0xd30
> __sock_create+0x17f/0x410
> mptcp_subflow_create_socket+0xff/0x9c0
> __mptcp_subflow_connect+0x1da/0xaf0
> mptcp_pm_nl_work+0x6e0/0x1120
> mptcp_worker+0x508/0x9a0
>
> Fixes: 5b950ff4331ddda ("mptcp: link MPC subflow into msk only after accept")
> Signed-off-by: Florian Westphal <fw(a)strlen.de>
> ---
> net/mptcp/subflow.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 06e233410e0e..e411be079c44 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -1291,6 +1291,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
> spin_lock_bh(&msk->join_list_lock);
> list_del(&subflow->node);
> spin_unlock_bh(&msk->join_list_lock);
> + sock_put(mptcp_subflow_tcp_sock(subflow));
>
> failed:
> subflow->disposable = 1;
> --
> 2.26.2
Thanks for the fix, Florian.
Reviewed-by: Mat Martineau <mathew.j.martineau(a)linux.intel.com>
--
Mat Martineau
Intel
next reply other threads:[~2021-02-18 0:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 0:17 Mat Martineau [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-02-22 17:15 [MPTCP] Re: [PATCH mptcp] mptcp: put subflow sock on connect error Matthieu Baerts
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=8461659f-aea8-e48b-43a5-3da73862b4e6@linux.intel.com \
--to=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