From ac2f5294b8b7e67eb65f4eca10f5b71df48b71c3 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sun, 7 Feb 2021 06:28:47 +0000 Subject: [PATCH] mptcp: move subflow close loop after sk close check In case mptcp socket is already dead the entire mptcp socket will be freed. We can avoid the close check in this case. Reviewed-by: Mat Martineau Signed-off-by: Florian Westphal --- net/mptcp/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 3fd8aef979a33..ea8cfefd62394 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2242,9 +2242,6 @@ static void mptcp_worker(struct work_struct *work) mptcp_check_fastclose(msk); - if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - __mptcp_close_subflow(msk); - if (msk->pm.status) mptcp_pm_nl_work(msk); @@ -2266,6 +2263,9 @@ static void mptcp_worker(struct work_struct *work) goto unlock; } + if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + __mptcp_close_subflow(msk); + if (!test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) goto unlock;