summaryrefslogtreecommitdiff
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <aring@mojatatu.com>2018-07-02 16:32:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-09 20:04:32 +0200
commitaeca800e562ddca7449f8d39732f4cd2b5a41dce (patch)
tree275482d260c5d2ee8027fd9e44c4cbb88ed44686 /net/mac802154
parent4e55d28084cc1c94c62b63ece1eeeeb29dc4941e (diff)
net: mac802154: tx: expand tailroom if necessary
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@ntnu.no> Reported-by: Rabi Narayan Sahoo <rabinarayans0828@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring <aring@mojatatu.com> Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/tx.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 3827f359b336..9e1ff9d4cf2d 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -72,8 +72,21 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
int ret;
if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) {
- u16 crc = crc_ccitt(0, skb->data, skb->len);
+ struct sk_buff *nskb;
+ u16 crc;
+
+ if (unlikely(skb_tailroom(skb) < IEEE802154_FCS_LEN)) {
+ nskb = skb_copy_expand(skb, 0, IEEE802154_FCS_LEN,
+ 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));
}