mptcp: don't overwrite sock_ops in mptcp_is_tcpsk()
authorDavide Caratti <dcaratti@redhat.com>
Tue, 19 Dec 2023 21:31:04 +0000 (22:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Dec 2023 22:33:21 +0000 (22:33 +0000)
commit8e2b8a9fa512709e6fee744dcd4e2a20ee7f5c56
tree5702de99a55a556642539c8cf76790d1db63462c
parent7961ef1fa10ec35ad6923fb5751877116e4b035b
mptcp: don't overwrite sock_ops in mptcp_is_tcpsk()

Eric Dumazet suggests:

 > The fact that mptcp_is_tcpsk() was able to write over sock->ops was a
 > bit strange to me.
 > mptcp_is_tcpsk() should answer a question, with a read-only argument.

re-factor code to avoid overwriting sock_ops inside that function. Also,
change the helper name to reflect the semantics and to disambiguate from
its dual, sk_is_mptcp(). While at it, collapse mptcp_stream_accept() and
mptcp_accept() into a single function, where fallback / non-fallback are
separated into a single sk_is_mptcp() conditional.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/432
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c