Commit 026763ec authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

ipv6: raw: check sk->sk_rcvbuf earlier

There is no point cloning an skb and having to free the clone
if the receive queue of the raw socket is full.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240307162943.2523817-1-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5d9b7cb3
......@@ -160,6 +160,13 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
if (!raw_v6_match(net, sk, nexthdr, daddr, saddr,
inet6_iif(skb), inet6_sdif(skb)))
continue;
if (atomic_read(&sk->sk_rmem_alloc) >=
READ_ONCE(sk->sk_rcvbuf)) {
atomic_inc(&sk->sk_drops);
continue;
}
delivered = true;
switch (nexthdr) {
case IPPROTO_ICMPV6:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment