tcp: initialise newsk->sk_pagepool for passive sockets

tcp_init_sock() is not called for children (at accept() time)

Only for freshly allocated sockets, inet[6]_create() call tcp_init_sock() via

if (sk->sk_prot->init) {
    err = sk->sk_prot->init(sk);
    if (err) {
        sk_common_release(sk);
        goto out;
    }
}

But passive connections do not have such a call.

tcp_create_openreq_child() is clearing/resetting
all fields that must be cleared/reset
after the cloning from parent (listener) happened.

It is not clear why at accept() time we find the listener sk_pagepool
locked because this stuff matters only for established flows.

We must not assume user space would not do strange things.

Therefore the fix will be either in inet_csk_clone_lock()
if we want to extend sk_pagepool to other protocols,
or tcp_create_openreq_child() since only TCP calls xa_destroy() so far.

Fixes: 987df26c30c6 ("tcp: implement RX path for devmem sockets")
Change-Id: I3cc3770af224f790154ee56094ddfc4f7797428b
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/64590
Reviewed-by: Mina Almasry <almasrymina@google.com>
Tested-by: Mina Almasry <almasrymina@google.com>
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/66550
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
1 file changed