summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/6lowpan.c
diff options
context:
space:
mode:
authorMartin Townsend <mtownsend1973@gmail.com>2014-10-13 12:00:56 +0200
committerMarcel Holtmann <marcel@holtmann.org>2014-10-25 07:56:25 +0200
commit11e3ff7072789ad4585870cbdde1be10c45f1cc4 (patch)
tree0a8e62cbf7eaeb33ac5931f9cea2321abf730ce5 /net/bluetooth/6lowpan.c
parentBluetooth: 6lowpan: remove unnecessary codes in give_skb_to_upper (diff)
downloadlinux-11e3ff7072789ad4585870cbdde1be10c45f1cc4.tar.xz
linux-11e3ff7072789ad4585870cbdde1be10c45f1cc4.zip
6lowpan: Use skb_cow in IPHC decompression.
Currently there are potentially 2 skb_copy_expand calls in IPHC decompression. This patch replaces this with one call to skb_cow which will check to see if there is enough headroom first to ensure it's only done if necessary and will handle alignment issues for cache. As skb_cow uses pskb_expand_head we ensure the skb isn't shared from bluetooth and ieee802.15.4 code that use the IPHC decompression. Signed-off-by: Martin Townsend <martin.townsend@xsilon.com> Acked-by: Alexander Aring <alex.aring@gmail.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/6lowpan.c')
-rw-r--r--net/bluetooth/6lowpan.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 9b5c89b18718..6c5c2eff45bd 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -309,6 +309,10 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
if (dev->type != ARPHRD_6LOWPAN)
goto drop;
+ skb = skb_share_check(skb, GFP_ATOMIC);
+ if (!skb)
+ goto drop;
+
/* check that it's our buffer */
if (skb->data[0] == LOWPAN_DISPATCH_IPV6) {
/* Copy the packet so that the IPv6 header is