[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1544392233.519503291@decadent.org.uk>
Date: Sun, 09 Dec 2018 21:50:33 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Alexander Aring" <aring@...atatu.com>,
"Rabi Narayan Sahoo" <rabinarayans0828@...il.com>,
"Stefan Schmidt" <stefan@...enfreihafen.org>,
"David Palma" <david.palma@...u.no>
Subject: [PATCH 3.16 103/328] net: 6lowpan: fix reserved space for single
frames
3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <aring@...atatu.com>
commit ac74f87c789af40936a80131c4759f3e72579c3a 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=195059
Reported-by: David Palma <david.palma@...u.no>
Reported-by: Rabi Narayan Sahoo <rabinarayans0828@...il.com>
Signed-off-by: Alexander Aring <aring@...atatu.com>
Signed-off-by: Stefan Schmidt <stefan@...enfreihafen.org>
[bwh: Backported to 3.16:
- s/ldev/dev/
- Adjust filename]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
net/ieee802154/6lowpan_rtnl.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -388,9 +388,24 @@ static netdev_tx_t lowpan_xmit(struct sk
/* 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);
- if (!skb)
- return NET_XMIT_DROP;
+ if (unlikely(skb_headroom(skb) < dev->needed_headroom ||
+ skb_tailroom(skb) < dev->needed_tailroom)) {
+ struct sk_buff *nskb;
+
+ nskb = skb_copy_expand(skb, dev->needed_headroom,
+ dev->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);
+ if (!skb)
+ return NET_XMIT_DROP;
+ }
ret = lowpan_header(skb, dev);
if (ret < 0) {
Powered by blists - more mailing lists