.. | .. |
---|
6 | 6 | #include <linux/bpf.h> |
---|
7 | 7 | #include <linux/init.h> |
---|
8 | 8 | #include <linux/wait.h> |
---|
| 9 | +#include <linux/util_macros.h> |
---|
9 | 10 | |
---|
10 | 11 | #include <net/inet_common.h> |
---|
11 | 12 | #include <net/tls.h> |
---|
.. | .. |
---|
125 | 126 | tmp->sg.end = i; |
---|
126 | 127 | if (apply) { |
---|
127 | 128 | apply_bytes -= size; |
---|
128 | | - if (!apply_bytes) |
---|
| 129 | + if (!apply_bytes) { |
---|
| 130 | + if (sge->length) |
---|
| 131 | + sk_msg_iter_var_prev(i); |
---|
129 | 132 | break; |
---|
| 133 | + } |
---|
130 | 134 | } |
---|
131 | 135 | } while (i != msg->sg.end); |
---|
132 | 136 | |
---|
.. | .. |
---|
258 | 262 | sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
---|
259 | 263 | ret = sk_wait_event(sk, &timeo, |
---|
260 | 264 | !list_empty(&psock->ingress_msg) || |
---|
261 | | - !skb_queue_empty(&sk->sk_receive_queue), &wait); |
---|
| 265 | + !skb_queue_empty_lockless(&sk->sk_receive_queue), &wait); |
---|
262 | 266 | sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
---|
263 | 267 | remove_wait_queue(sk_sleep(sk), &wait); |
---|
264 | 268 | return ret; |
---|
.. | .. |
---|
316 | 320 | bool cork = false, enospc = sk_msg_full(msg); |
---|
317 | 321 | struct sock *sk_redir; |
---|
318 | 322 | u32 tosend, origsize, sent, delta = 0; |
---|
319 | | - u32 eval = __SK_NONE; |
---|
| 323 | + u32 eval; |
---|
320 | 324 | int ret; |
---|
321 | 325 | |
---|
322 | 326 | more_data: |
---|
.. | .. |
---|
347 | 351 | tosend = msg->sg.size; |
---|
348 | 352 | if (psock->apply_bytes && psock->apply_bytes < tosend) |
---|
349 | 353 | tosend = psock->apply_bytes; |
---|
| 354 | + eval = __SK_NONE; |
---|
350 | 355 | |
---|
351 | 356 | switch (psock->eval) { |
---|
352 | 357 | case __SK_PASS: |
---|
.. | .. |
---|
638 | 643 | */ |
---|
639 | 644 | void tcp_bpf_clone(const struct sock *sk, struct sock *newsk) |
---|
640 | 645 | { |
---|
641 | | - int family = sk->sk_family == AF_INET6 ? TCP_BPF_IPV6 : TCP_BPF_IPV4; |
---|
642 | 646 | struct proto *prot = newsk->sk_prot; |
---|
643 | 647 | |
---|
644 | | - if (prot == &tcp_bpf_prots[family][TCP_BPF_BASE]) |
---|
| 648 | + if (is_insidevar(prot, tcp_bpf_prots)) |
---|
645 | 649 | newsk->sk_prot = sk->sk_prot_creator; |
---|
646 | 650 | } |
---|
647 | 651 | #endif /* CONFIG_BPF_STREAM_PARSER */ |
---|