aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/skbuff.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2012-03-23 19:59:33 -0400
committerDavid S. Miller <davem@davemloft.net>2012-03-25 13:29:58 -0400
commit50269e19ad990e79eeda101fc6df80cffd5d4831 (patch)
tree903d80ba1b1fc0eb15e122a8c12a72f72e7ed2de /net/core/skbuff.c
parent0015e551edb1d28191567d8a7d1ce5edda404ced (diff)
net: add a truesize parameter to skb_add_rx_frag()
skb_add_rx_frag() API is misleading. Network skbs built with this helper can use uncharged kernel memory and eventually stress/crash machine in OOM. Add a 'truesize' parameter and then fix drivers in followup patches. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r--net/core/skbuff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6eb656acdfe5..a690cae91cdd 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -321,12 +321,12 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
321EXPORT_SYMBOL(__netdev_alloc_skb); 321EXPORT_SYMBOL(__netdev_alloc_skb);
322 322
323void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, 323void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
324 int size) 324 int size, unsigned int truesize)
325{ 325{
326 skb_fill_page_desc(skb, i, page, off, size); 326 skb_fill_page_desc(skb, i, page, off, size);
327 skb->len += size; 327 skb->len += size;
328 skb->data_len += size; 328 skb->data_len += size;
329 skb->truesize += size; 329 skb->truesize += truesize;
330} 330}
331EXPORT_SYMBOL(skb_add_rx_frag); 331EXPORT_SYMBOL(skb_add_rx_frag);
332 332