]> Git Repo - J-linux.git/commitdiff
ipv6: raw: check sk->sk_rcvbuf earlier
authorEric Dumazet <[email protected]>
Thu, 7 Mar 2024 16:29:43 +0000 (16:29 +0000)
committerJakub Kicinski <[email protected]>
Fri, 8 Mar 2024 19:39:29 +0000 (11:39 -0800)
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: Eric Dumazet <[email protected]>
Reviewed-by: Willem de Bruijn <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
net/ipv6/raw.c

index 779274055abf99530048ad4738c2263e97c94cce..ca49e6617afaff3fe6c5f3a174bbe6d96f94ac62 100644 (file)
@@ -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:
This page took 0.051294 seconds and 4 git commands to generate.