Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mac802154: tx: expand tailroom if necessary

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>

authored by

Alexander Aring and committed by
Stefan Schmidt
f9c52831 ac74f87c

+14 -1
+14 -1
net/mac802154/tx.c
··· 63 63 int ret; 64 64 65 65 if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) { 66 - u16 crc = crc_ccitt(0, skb->data, skb->len); 66 + struct sk_buff *nskb; 67 + u16 crc; 67 68 69 + if (unlikely(skb_tailroom(skb) < IEEE802154_FCS_LEN)) { 70 + nskb = skb_copy_expand(skb, 0, IEEE802154_FCS_LEN, 71 + GFP_ATOMIC); 72 + if (likely(nskb)) { 73 + consume_skb(skb); 74 + skb = nskb; 75 + } else { 76 + goto err_tx; 77 + } 78 + } 79 + 80 + crc = crc_ccitt(0, skb->data, skb->len); 68 81 put_unaligned_le16(crc, skb_put(skb, 2)); 69 82 } 70 83