Skip to contentSkip to conversation

net: 6lowpan: fix reserved space for single frames

RFC PATCH In review Alexander Aring 1 participant 2 messages Jun 1, 2018 – Jun 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 net: 6lowpan: fix reserved space for single frames

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().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059

---
I hope the refcounting doesn't change here... anyway it also copy skb. Anyway, it fix something... we can think about perfomance later.

Also I thought the upper layer would allocate the right needed_headroom and needed_tailroom for me, so I don't need to realloc in transmit. Maybe this is a bigger issue in the upper layer? I am pretty sure these extra bytes should be allocated when skb is created according the net_device which ndo_xmit() will be called from.

I will ask this question to netdev mailinglist..., if no answer then simple apply this patch @stefan. (If it's looking okay for you).

 net/ieee802154/6lowpan/tx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ieee802154/6lowpan/tx.c +2 -1
index e6ff5128e61a..2d74918431e3 100644
@@ -265,7 +265,8 @@ 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
 	 * header as the header could be used elsewhere
 	 */
-	skb = skb_unshare(skb, GFP_ATOMIC);
+	skb = skb_copy_expand(skb, ldev->needed_headroom,
+			      ldev->needed_tailroom, GFP_ATOMIC);
 	if (!skb)
 		return NET_XMIT_DROP;
 
Signature · 1 line
2.11.0
#1 lore raw

Hi,

Quoted 7 lines · Alexander Aring

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().

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059

drop this, I found the bug in IPv6 (I suppose).

I will do a proper patch with additional Reported-by tag to David.

- Alex