Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: Don't allow SOCK_ZEROCOPY
Browse files Browse the repository at this point in the history
It's not tested and syzkaller found a leak. Let's just disable it for
now. If somebody wants to support this feature, please go ahead :)

Support for TCP ZEROCOPY was added in v4.14, so the faulting commit is
the merge.

Fixes: 42a0700 ("Merge tag 'v4.14-rc7' into mptcp_trunk")
Signed-off-by: Christoph Paasch <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
(cherry picked from commit 838e4c4)
Signed-off-by: Matthieu Baerts <[email protected]>
(cherry picked from commit aaaf577)
Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
cpaasch authored and matttbe committed Apr 1, 2022
1 parent 1f40fde commit 611ae2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,8 @@ int sock_setsockopt(struct socket *sock, int level, int optname,

case SO_ZEROCOPY:
if (sk->sk_family == PF_INET || sk->sk_family == PF_INET6) {
if (sk->sk_protocol != IPPROTO_TCP)
if (sk->sk_protocol != IPPROTO_TCP ||
sock_flag(sk, SOCK_MPTCP))
ret = -ENOTSUPP;
} else if (sk->sk_family != PF_RDS) {
ret = -ENOTSUPP;
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3251,7 +3251,8 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
#ifdef CONFIG_MPTCP
case MPTCP_ENABLED:
if (mptcp_init_failed || !sysctl_mptcp_enabled ||
sk->sk_state != TCP_CLOSE
sk->sk_state != TCP_CLOSE ||
sock_flag(sk, SOCK_ZEROCOPY)
#ifdef CONFIG_TCP_MD5SIG
|| tp->md5sig_info
#endif
Expand Down

0 comments on commit 611ae2e

Please sign in to comment.