This patch moves the NULL pointer check into mptcp_push_release(). Also
add a new parameter 'push' for it to set whether to invoke tcp_push in
it.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/protocol.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 5505c1439b3e..0c4403c2aace 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1471,9 +1471,17 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
return ssk;
}
-static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info)
+static void mptcp_push_release(struct sock *ssk,
+ struct mptcp_sendmsg_info *info,
+ bool push)
{
- tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal);
+ if (!ssk)
+ return;
+
+ if (push) {
+ tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle,
+ info->size_goal);
+ }
release_sock(ssk);
}
@@ -1579,8 +1587,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
/* First check. If the ssk has changed since
* the last round, release prev_ssk
*/
- if (prev_ssk)
- mptcp_push_release(prev_ssk, &info);
+ mptcp_push_release(prev_ssk, &info, do_check_data_fin);
/* Need to lock the new subflow only if different
* from the previous one, otherwise we are still
@@ -1606,8 +1613,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
}
/* at this point we held the socket lock for the last subflow we used */
- if (ssk)
- mptcp_push_release(ssk, &info);
+ mptcp_push_release(ssk, &info, do_check_data_fin);
/* ensure the rtx timer is running */
if (!mptcp_timer_pending(sk))
--
2.35.3