netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Florian Westphal <fw@strlen.de>, netdev@vger.kernel.org
Cc: mptcp@lists.01.org, Davide Caratti <dcaratti@redhat.com>
Subject: Re: [PATCH net-next] mptcp: put reference in mptcp timeout timer
Date: Tue, 24 Nov 2020 17:42:21 +0100	[thread overview]
Message-ID: <e44300a0567cdec8241c06d1c6b78083cdd4254a.camel@redhat.com> (raw)
In-Reply-To: <20201124162446.11448-1-fw@strlen.de>

On Tue, 2020-11-24 at 17:24 +0100, Florian Westphal wrote:
> On close this timer might be scheduled. mptcp uses sk_reset_timer for
> this, so the a reference on the mptcp socket is taken.
> 
> This causes a refcount leak which can for example be reproduced
> with 'mp_join_server_v4.pkt' from the mptcp-packetdrill repo.

Whoops, my fault!

> The leak has nothing to do with join requests, v1_mp_capable_bind_no_cs.pkt
> works too when replacing the last ack mpcapable to v1 instead of v0.
> 
> unreferenced object 0xffff888109bba040 (size 2744):
>   comm "packetdrill", [..]
>   backtrace:
>     [..] sk_prot_alloc.isra.0+0x2b/0xc0
>     [..] sk_clone_lock+0x2f/0x740
>     [..] mptcp_sk_clone+0x33/0x1a0
>     [..] subflow_syn_recv_sock+0x2b1/0x690 [..]
> 
> Fixes: e16163b6e2b7 ("mptcp: refactor shutdown and close")
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Davide Caratti <dcaratti@redhat.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  net/mptcp/protocol.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 4b7794835fea..dc979571f561 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1710,6 +1710,7 @@ static void mptcp_timeout_timer(struct timer_list *t)
>  	struct sock *sk = from_timer(sk, t, sk_timer);
>  
>  	mptcp_schedule_work(sk);
> +	sock_put(sk);
>  }
>  
>  /* Find an idle subflow.  Return NULL if there is unacked data at tcp

LGTM, thanks!
Acked-by: Paolo Abeni <pabeni@redhat.com>


  reply	other threads:[~2020-11-24 16:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 16:24 [PATCH net-next] mptcp: put reference in mptcp timeout timer Florian Westphal
2020-11-24 16:42 ` Paolo Abeni [this message]
2020-11-25 20:33   ` Jakub Kicinski

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=e44300a0567cdec8241c06d1c6b78083cdd4254a.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=dcaratti@redhat.com \
    --cc=fw@strlen.de \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    /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).