netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH 1/3] UDP memory usage accounting (take 2): fix send buffer check
@ 2007-09-28 13:37 Satoshi OSHIMA
  2007-09-28 20:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Satoshi OSHIMA @ 2007-09-28 13:37 UTC (permalink / raw)
  To: Andi Kleen, Evgeniy Polyakov, netdev
  Cc: Yumiko SUGITA, "青木@RedHat",
	吉藤 英明

This patch introduces sndbuf size check before

memory allcation for send buffer.

signed-off-by: Satoshi Oshima <satoshi.oshima.fk@hitachi.com>

signed-off-by: Hideo Aoki <haoki@redhat.com>

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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-28 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-28 13:37 [RFC/PATCH 1/3] UDP memory usage accounting (take 2): fix send buffer check Satoshi OSHIMA
2007-09-28 20:09 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).