summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2014-11-19 14:05:01 +0100
committerDavid S. Miller <davem@davemloft.net>2014-11-21 14:20:17 -0500
commite21951212f03b8d805795d8f71206853b2ab344d (patch)
tree2ecd2d59b8ca78f40e8a695ba5599e60dc652a48 /net/core
parent15255a43e6c917813800702e100267046e240cc0 (diff)
downloadop-kernel-dev-e21951212f03b8d805795d8f71206853b2ab344d.zip
op-kernel-dev-e21951212f03b8d805795d8f71206853b2ab344d.tar.gz
net: move make_writable helper into common code
note that skb_make_writable already exists in net/netfilter/core.c but does something slightly different. Suggested-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/skbuff.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 7001896..d11bbe0 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4151,6 +4151,18 @@ err_free:
}
EXPORT_SYMBOL(skb_vlan_untag);
+int skb_ensure_writable(struct sk_buff *skb, int write_len)
+{
+ if (!pskb_may_pull(skb, write_len))
+ return -ENOMEM;
+
+ if (!skb_cloned(skb) || skb_clone_writable(skb, write_len))
+ return 0;
+
+ return pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
+}
+EXPORT_SYMBOL(skb_ensure_writable);
+
/**
* alloc_skb_with_frags - allocate skb with page frags
*
OpenPOWER on IntegriCloud