mptcp: reset last_snd on subflow close
Subsystems (2)
Florian Westphal
PATCH 1/2 mptcp: reset last_snd on subflow close
Send logic caches last active subflow in the msk, so it needs to be cleared when the cached subflow is closed.
--- net/mptcp/protocol.c | 3 +++ 1 file changed, 3 insertions(+)
net/mptcp/protocol.c +3 -0
@@ -2145,6 +2145,9 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,release_sock (ssk);sock_put (ssk); + +if (ssk == msk->last_snd) + msk->last_snd =NULL ; } void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
Signature · 1 line
2.26.2
Florian Westphal
PATCH v2 2/2 mptcp: dispose initial struct socket when its subflow is closed
Christoph Paasch reported following crash:dst_release underflow
WARNING: CPU: 0 PID: 1319 at net/core/dst.c:175 dst_release+0xc1/0xd0 net/core/dst.c:175 CPU: 0 PID: 1319 Comm: syz-executor217 Not tainted 5.11.0-rc6af8e85128b4d0d24083c5cac646e891227052e0c #70 Call Trace: rt_cache_route+0x12e/0x140 net/ipv4/route.c:1503 rt_set_nexthop.constprop.0+0x1fc/0x590 net/ipv4/route.c:1612 __mkroute_output net/ipv4/route.c:2484 [inline]
...
The worker leaves msk->subflow alone even when it happened to close the subflow ssk associated with it.
v2: fix helper function name
--- net/mptcp/protocol.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
net/mptcp/protocol.c +14 -6
@@ -2106,6 +2106,14 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk)return backup; } +static void mptcp_dispose_initial_subflow (struct mptcp_sock *msk) +{ +if (msk->subflow) { +iput (SOCK_INODE (msk->subflow)); + msk->subflow =NULL ; + } +} +/* subflow sockets can be either outgoing (connect) or incoming * (accept). *
@@ -2117,6 +2125,8 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk)static void __mptcp_close_ssk (struct sock *sk,struct sock *ssk,struct mptcp_subflow_context *subflow) { +struct mptcp_sock *msk =mptcp_sk (sk); +list_del (&subflow->node);lock_sock_nested (ssk,SINGLE_DEPTH_NESTING );
@@ -2148,6 +2158,9 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,if (ssk == msk->last_snd) msk->last_snd =NULL ; + +if (msk->subflow && ssk == msk->subflow->sk) +mptcp_dispose_initial_subflow (msk); } void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
@@ -2529,12 +2542,6 @@ static void __mptcp_destroy_sock(struct sock *sk)might_sleep (); -/* dispose the ancillatory tcp socket, if any */ -if (msk->subflow) { -iput (SOCK_INODE (msk->subflow)); - msk->subflow =NULL ; - } -/* be sure to always acquire the join list lock, to sync vs * mptcp_finish_join(). */
@@ -2559,6 +2566,7 @@ static void __mptcp_destroy_sock(struct sock *sk)sk_stream_kill_queues (sk);xfrm_sk_free_policy (sk);sk_refcnt_debug_release (sk); +mptcp_dispose_initial_subflow (msk);sock_put (sk); }
Signature · 1 line
2.26.2
Paolo Abeni
[MPTCP] Re: [PATCH v2 2/2] mptcp: dispose initial struct socket when its subflow is closed
Quoted 13 lines · Florian Westphal
Christoph Paasch reported following crash:
dst_releaseunderflowWARNING: CPU: 0 PID: 1319 at net/core/dst.c:175 dst_release+0xc1/0xd0 net/core/dst.c:175 CPU: 0 PID: 1319 Comm: syz-executor217 Not tainted 5.11.0-rc6af8e85128b4d0d24083c5cac646e891227052e0c #70 Call Trace: rt_cache_route+0x12e/0x140 net/ipv4/route.c:1503 rt_set_nexthop.constprop.0+0x1fc/0x590 net/ipv4/route.c:1612 __mkroute_output net/ipv4/route.c:2484 [inline]...
The worker leaves
msk->subflowalone even when it happened to close the subflow ssk associated with it.
Quoted 7 lines
v2: fix helper function name
Fixes 866f26f2a9c33b ("mptcp: always graft subflow socket to parent")Reported-by Christoph Paasch <cpaasch(a)apple.com>Suggested-by Paolo Abeni <pabeni(a)redhat.com>Signed-off-by Florian Westphal <fw(a)strlen.de>
Both patches LGTM, thanks!
perhaps we can drop the changelog info for upstream submission? (in any case no need for a v3, I guess commit messages can shaped at submission time)
Cheers,
Paolo
Matthieu Baerts
[MPTCP] Re: [PATCH v2 2/2] mptcp: dispose initial struct socket when its subflow is closed
Hi Florian, Paolo,
Quoted 14 lines · Paolo Abeni
Quoted 13 lines · Florian Westphal
Christoph Paasch reported following crash:
dst_releaseunderflowWARNING: CPU: 0 PID: 1319 at net/core/dst.c:175 dst_release+0xc1/0xd0 net/core/dst.c:175 CPU: 0 PID: 1319 Comm: syz-executor217 Not tainted 5.11.0-rc6af8e85128b4d0d24083c5cac646e891227052e0c #70 Call Trace: rt_cache_route+0x12e/0x140 net/ipv4/route.c:1503 rt_set_nexthop.constprop.0+0x1fc/0x590 net/ipv4/route.c:1612 __mkroute_output net/ipv4/route.c:2484 [inline]...
The worker leaves
msk->subflowalone even when it happened to close the subflow ssk associated with it.
Quoted 7 lines
Quoted 7 lines
v2: fix helper function name
Fixes 866f26f2a9c33b ("mptcp: always graft subflow socket to parent")Reported-by Christoph Paasch <cpaasch(a)apple.com>Suggested-by Paolo Abeni <pabeni(a)redhat.com>Signed-off-by Florian Westphal <fw(a)strlen.de>
Thank you for the patches and the reviews!
Quoted 5 lines
Both patches LGTM, thanks!
perhaps we can drop the changelog info for upstream submission? (in any case no need for a v3, I guess commit messages can shaped at submission time)
I can sure do that!
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net
Matthieu Baerts
[MPTCP] Re: [PATCH v2 2/2] mptcp: dispose initial struct socket when its subflow is closed
Hi Florian, Paolo,
Quoted 29 lines · Matthieu Baerts
Hi Florian, Paolo,
Quoted 16 lines · Paolo Abeni
Quoted 15 lines · Florian Westphal
Christoph Paasch reported following crash:
dst_releaseunderflowWARNING: CPU: 0 PID: 1319 at net/core/dst.c:175 dst_release+0xc1/0xd0 net/core/dst.c:175 CPU: 0 PID: 1319 Comm: syz-executor217 Not tainted 5.11.0-rc6af8e85128b4d0d24083c5cac646e891227052e0c #70 Call Trace: rt_cache_route+0x12e/0x140 net/ipv4/route.c:1503 rt_set_nexthop.constprop.0+0x1fc/0x590 net/ipv4/route.c:1612 __mkroute_output net/ipv4/route.c:2484 [inline]...
The worker leaves
msk->subflowalone even when it happened to close the subflow ssk associated with it.Quoted 7 lines
Quoted 7 lines
v2: fix helper function name
Fixes 866f26f2a9c33b ("mptcp: always graft subflow socket to parent")Reported-by Christoph Paasch <cpaasch(a)apple.com>Suggested-by Paolo Abeni <pabeni(a)redhat.com>Signed-off-by Florian Westphal <fw(a)strlen.de>Thank you for the patches and the reviews!
Quoted 7 lines
Quoted 5 lines
Both patches LGTM, thanks!
perhaps we can drop the changelog info for upstream submission? (in any case no need for a v3, I guess commit messages can shaped at submission time)
I can sure do that!
Patch 1 was placed at the bottom with Paolo's Ack, my RvB tag and a declared 'msk':
- 114aa23af898: mptcp: reset last_snd on subflow close
- Results: 7bd6ce758374..c09ee43e88b6
Patch 2 was placed just before your netlink series with Paolo's Ack:
- 24c84fc55050: mptcp: dispose initial struct socket when its subflow is closed
- Results: c09ee43e88b6..8ea9c48639fd
Tests + export are in progress!
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net
Matthieu Baerts
Hi Florian,
Quoted 2 lines · Florian Westphal
Send logic caches last active subflow in the msk, so it needs to be cleared when the cached subflow is closed.
Thank you for the patch!
Quoted 13 lines
Fixes d5f49190def61c ("mptcp: allow picking different xmit subflows")Reported-by Christoph Paasch <cpaasch(a)apple.com>Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 3 +++ 1 file changed, 3 insertions(+)net/mptcp/protocol.c +0
-0
net/mptcp/protocol.c static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, · line 2150
Quoted 6 lines
net/mptcp/protocol.c +3
-0@@ -2145,6 +2145,9 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,release_sock (ssk);sock_put (ssk); + +if (ssk == msk->last_snd) + msk->last_snd =NULL ;
I see that this patch is for -net but it looks like "msk" is not defined in this function. Same in net-next in fact.
I also see that you declare "msk" in patch 2/2. I can move the declaration in patch 1/2 when applying it. (Not sure when we want to send it to netdev, I guess "soon", no?)
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net