Skip to content

Commit

Permalink
mptcp: init sk->sk_prot in build_msk()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Menglong Dong authored and David S. Miller committed Jan 9, 2023
1 parent cfdcfee commit ade4d75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/mptcp/token_test.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit ade4d75

Please sign in to comment.