Commit 3f02ebb7 authored by Alexander Aring's avatar Alexander Aring Committed by Kleber Sacilotto de Souza

net: 6lowpan: fix reserved space for single frames

BugLink: https://bugs.launchpad.net/bugs/1792419

commit ac74f87c upstream.

This patch fixes patch add handling to take care tail and headroom for
single 6lowpan frames. We need to be sure we have a skb with the right
head and tailroom for single frames. This patch do it by using
skb_copy_expand() if head and tailroom is not enough allocated by upper
layer.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059Reported-by: default avatarDavid Palma <david.palma@ntnu.no>
Reported-by: default avatarRabi Narayan Sahoo <rabinarayans0828@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAlexander Aring <aring@mojatatu.com>
Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent ddd5d3c1
...@@ -265,9 +265,24 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev) ...@@ -265,9 +265,24 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
/* We must take a copy of the skb before we modify/replace the ipv6 /* We must take a copy of the skb before we modify/replace the ipv6
* header as the header could be used elsewhere * header as the header could be used elsewhere
*/ */
if (unlikely(skb_headroom(skb) < ldev->needed_headroom ||
skb_tailroom(skb) < ldev->needed_tailroom)) {
struct sk_buff *nskb;
nskb = skb_copy_expand(skb, ldev->needed_headroom,
ldev->needed_tailroom, GFP_ATOMIC);
if (likely(nskb)) {
consume_skb(skb);
skb = nskb;
} else {
kfree_skb(skb);
return NET_XMIT_DROP;
}
} else {
skb = skb_unshare(skb, GFP_ATOMIC); skb = skb_unshare(skb, GFP_ATOMIC);
if (!skb) if (!skb)
return NET_XMIT_DROP; return NET_XMIT_DROP;
}
ret = lowpan_header(skb, ldev, &dgram_size, &dgram_offset); ret = lowpan_header(skb, ldev, &dgram_size, &dgram_offset);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment