3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring aring@mojatatu.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@ntnu.no Reported-by: Rabi Narayan Sahoo rabinarayans0828@gmail.com Signed-off-by: Alexander Aring aring@mojatatu.com Signed-off-by: Stefan Schmidt stefan@datenfreihafen.org [bwh: Backported to 3.16: - Substitute literal number for IEEE802154_FCS_LEN - Adjust context] Signed-off-by: Ben Hutchings ben@decadent.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)); }