Skip to contentSkip to conversation

mptcp: put reference in mptcp timeout timer

PATCH Applied Florian Westphal 3 participants 3 messages Nov 24, 2020 – Nov 25, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptcp: put reference in mptcp timeout timer

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.

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(a)redhat.com>
Cc Davide Caratti <dcaratti(a)redhat.com>
Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/protocol.c | 1 +
 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
index 4b7794835fea..dc979571f561 100644
@@ -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
Signature · 1 line
2.26.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Florian Westphal

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!

Quoted 24 lines

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(a)redhat.com>
Cc Davide Caratti <dcaratti(a)redhat.com>
Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/protocol.c | 1 +
 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +0 -0
index 4b7794835fea..dc979571f561 100644

net/mptcp/protocol.c static void mptcp_timeout_timer(struct timer_list *t) · line 1716

Quoted 7 lines
net/mptcp/protocol.c +1 -0
@@ -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(a)redhat.com>

maintainer Applied
#2 lore raw
Quoted 35 lines · On Tue, 24 Nov 2020 17:42:21 +0100 Paolo Abeni wrote:
Quoted 5 lines · Florian Westphal

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!

Quoted 26 lines

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(a)redhat.com>
Cc Davide Caratti <dcaratti(a)redhat.com>
Signed-off-by Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/protocol.c | 1 +
 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +0 -0
index 4b7794835fea..dc979571f561 100644
@@ -1710,6 +1710,7 @@ static void mptcp_timeout_timer(struct timer_list *t)
 	struct sock *sk = from_timer(sk, t, sk_timer);
 
Quoted 8 lines

net/mptcp/protocol.c static void mptcp_timeout_timer(struct timer_list *t) · line 1716

Quoted 5 lines
net/mptcp/protocol.c +1 -0
 	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(a)redhat.com>

Applied, thanks!