mptcp: init sk->sk_prot in build_msk()
authorMenglong Dong <imagedong@tencent.com>
Fri, 6 Jan 2023 18:57:21 +0000 (10:57 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Jan 2023 07:30:50 +0000 (07:30 +0000)
The 'sk_prot' field in token KUNIT self-tests will be dereferenced in
mptcp_token_new_connect(). Therefore, init it with tcp_prot.

Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/token_test.c

index 5d984be..0758865 100644 (file)
@@ -57,6 +57,9 @@ static struct mptcp_sock *build_msk(struct kunit *test)
        KUNIT_EXPECT_NOT_ERR_OR_NULL(test, msk);
        refcount_set(&((struct sock *)msk)->sk_refcnt, 1);
        sock_net_set((struct sock *)msk, &init_net);
+
+       /* be sure the token helpers can dereference sk->sk_prot */
+       ((struct sock *)msk)->sk_prot = &tcp_prot;
        return msk;
 }