diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-04-13 20:14:37 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-04-13 20:14:37 +0200 |
commit | 473b2922c7e54260268c9bb037d2ff9f327422ab (patch) | |
tree | 40cee01f50cb0f285399c406ceba7b5acb58e486 /include/net/sock.h | |
parent | perf vendor events amd: Add Zen3 events (diff) | |
parent | Merge tag 'm68knommu-for-v5.12-rc7' of git://git.kernel.org/pub/scm/linux/ker... (diff) | |
download | linux-473b2922c7e54260268c9bb037d2ff9f327422ab.tar.xz linux-473b2922c7e54260268c9bb037d2ff9f327422ab.zip |
Merge remote-tracking branch 'torvalds/master' into perf/core
To pick up fixes from perf/urgent that got into upstream.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 0b6266fd6bf6..8487f58da36d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -934,9 +934,13 @@ static inline void sk_acceptq_added(struct sock *sk) WRITE_ONCE(sk->sk_ack_backlog, sk->sk_ack_backlog + 1); } +/* Note: If you think the test should be: + * return READ_ONCE(sk->sk_ack_backlog) >= READ_ONCE(sk->sk_max_ack_backlog); + * Then please take a look at commit 64a146513f8f ("[NET]: Revert incorrect accept queue backlog changes.") + */ static inline bool sk_acceptq_is_full(const struct sock *sk) { - return READ_ONCE(sk->sk_ack_backlog) >= READ_ONCE(sk->sk_max_ack_backlog); + return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog); } /* @@ -2221,6 +2225,15 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) sk_mem_charge(sk, skb->truesize); } +static inline void skb_set_owner_sk_safe(struct sk_buff *skb, struct sock *sk) +{ + if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) { + skb_orphan(skb); + skb->destructor = sock_efree; + skb->sk = sk; + } +} + void sk_reset_timer(struct sock *sk, struct timer_list *timer, unsigned long expires); |