[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1544392233.966357251@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,
"Rabi Narayan Sahoo" <rabinarayans0828@...il.com>,
"Stefan Schmidt" <stefan@...enfreihafen.org>,
"Alexander Aring" <aring@...atatu.com>,
"David Palma" <david.palma@...u.no>
Subject: [PATCH 3.16 107/328] net: mac802154: tx: expand tailroom if necessary
3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <aring@...atatu.com>
commit f9c52831133050c6b82aa8b6831c92da2bbf2a0b upstream.
This patch is necessary if case of AF_PACKET or other socket interface
which I am aware of it and didn't allocated the necessary room.
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:
- Substitute literal number for IEEE802154_FCS_LEN
- Adjust context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -96,8 +96,20 @@ netdev_tx_t mac802154_tx(struct mac80215
mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
- u16 crc = crc_ccitt(0, skb->data, skb->len);
+ struct sk_buff *nskb;
+ u16 crc;
+ if (unlikely(skb_tailroom(skb) < 2)) {
+ nskb = skb_copy_expand(skb, 0, 2, GFP_ATOMIC);
+ if (likely(nskb)) {
+ consume_skb(skb);
+ skb = nskb;
+ } else {
+ goto err_tx;
+ }
+ }
+
+ crc = crc_ccitt(0, skb->data, skb->len);
put_unaligned_le16(crc, skb_put(skb, 2));
}
Powered by blists - more mailing lists