Skip to contentSkip to conversation

UDP memory usage accounting (take 2): fix send buffer check

PATCH In review Satoshi OSHIMA 2 participants 2 messages Sep 28, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 UDP memory usage accounting (take 2): fix send buffer check

This patch introduces sndbuf size check before

memory allcation for send buffer.

Index: 2.6.23-rc7-udp_limit/net/ipv4/ip_output.c

===================================================================

--- 2.6.23-rc7-udp_limit.orig/net/ipv4/ip_output.c

+++ 2.6.23-rc7-udp_limit/net/ipv4/ip_output.c

@@ -1004,6 +1004,11 @@ alloc_new_skb:

                     frag = &skb_shinfo(skb)->frags[i];

                 }

             } else if (i < MAX_SKB_FRAGS) {

+ if (atomic_read(&sk->sk_wmem_alloc) + PAGE_SIZE

+ > 2 * sk->sk_sndbuf) {

+ err = -ENOBUFS;

+ goto error;

+ }

                 if (copy > PAGE_SIZE)

                     copy = PAGE_SIZE;

                 page = alloc_pages(sk->sk_allocation, 0);
maintainer
#1 lore raw

From: Satoshi OSHIMA <[email protected]>
Date: Fri, 28 Sep 2007 22:37:54 +0900

Review

Quoted 11 lines
             } else if (i < MAX_SKB_FRAGS) {
(quoted diff) +5 -0
+                if (atomic_read(&sk->sk_wmem_alloc) + PAGE_SIZE
 
+                    > 2 * sk->sk_sndbuf) {
 
+                    err = -ENOBUFS;
 
+                    goto error;
 
+                }

Your email client, or something, is adding newlines every other line of real content, making your patches unusable.

Please go and perform some testing to make sure that the patches you email out are untouched by the email client and can be applied by the recipient.