Message ID | d2f825f15c288141a1812959a40d23f9a9681520.1740368110.git.tanggeliang@kylinos.cn (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | dd8797c750fe851f953242b2ddf0e538a761854a |
Delegated to: | Matthieu Baerts |
Headers | show |
Series | Squash to "Add mptcp_subflow bpf_iter support" | expand |
Context | Check | Description |
---|---|---|
matttbe/KVM_Validation__normal | success | Success! ✅ |
matttbe/KVM_Validation__debug | success | Success! ✅ |
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ | success | Success! ✅ |
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ | success | Success! ✅ |
matttbe/build | success | Build and static analysis OK |
matttbe/checkpatch | warning | total: 0 errors, 1 warnings, 0 checks, 30 lines checked |
matttbe/shellcheck | success | MPTCP selftests files have not been modified |
diff --git a/net/mptcp/bpf.c b/net/mptcp/bpf.c index 7e9d9c9a04cf..a6b07aaddcb2 100644 --- a/net/mptcp/bpf.c +++ b/net/mptcp/bpf.c @@ -235,24 +235,24 @@ bpf_mptcp_subflow_ctx(const struct sock *sk) __bpf_kfunc static int bpf_iter_mptcp_subflow_new(struct bpf_iter_mptcp_subflow *it, - struct mptcp_sock *msk) + struct sock *sk) { struct bpf_iter_mptcp_subflow_kern *kit = (void *)it; - struct sock *sk = (struct sock *)msk; + struct mptcp_sock *msk; BUILD_BUG_ON(sizeof(struct bpf_iter_mptcp_subflow_kern) > sizeof(struct bpf_iter_mptcp_subflow)); BUILD_BUG_ON(__alignof__(struct bpf_iter_mptcp_subflow_kern) != __alignof__(struct bpf_iter_mptcp_subflow)); - kit->msk = msk; - if (!msk) + if (unlikely(!sk || !sk_fullsock(sk))) return -EINVAL; - if (!sock_owned_by_user_nocheck(sk) && - !spin_is_locked(&sk->sk_lock.slock)) + if (sk->sk_protocol != IPPROTO_MPTCP) return -EINVAL; + msk = mptcp_sk(sk); + kit->msk = msk; kit->pos = &msk->conn_list; return 0; }