• Doug Berger's avatar
    net: bcmgenet: Free skb after last Tx frag · f48bed16
    Doug Berger authored
    Since the skb is attached to the first control block of a fragmented
    skb it is possible that the skb could be freed when reclaiming that
    control block before all fragments of the skb have been consumed by
    the hardware and unmapped.
    
    This commit introduces first_cb and last_cb pointers to the skb
    control block used by the driver to keep track of which transmit
    control blocks within a transmit ring are the first and last ones
    associated with the skb.
    
    It then splits the bcmgenet_free_cb() function into transmit
    (bcmgenet_free_tx_cb) and receive (bcmgenet_free_rx_cb) versions
    that can handle the unmapping of dma mapped memory and cleaning up
    the corresponding control block structure so that the skb is only
    freed after the last associated transmit control block is reclaimed.
    
    Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
    Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f48bed16
bcmgenet.h 20.6 KB