lkml.org 
[lkml]   [2018]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    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@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));
    }

    \
     
     \ /
      Last update: 2018-12-09 23:12    [W:2.121 / U:0.188 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site