]> git.baikalelectronics.ru Git - kernel.git/commit
net: bcmgenet: Free skb after last Tx frag
authorDoug Berger <opendmb@gmail.com>
Fri, 14 Jul 2017 23:12:10 +0000 (16:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Jul 2017 04:29:08 +0000 (21:29 -0700)
commit1a4a85ebd3c50b0ac3948e37158c73c16926408d
tree5f8729e923872327c2a12f47a9f3693b7874aa88
parentd667f0bb7bdef7c7d21d6fbc6f4cbeb44b280283
net: bcmgenet: Free skb after last Tx frag

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: 83c070ed8c89 ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmgenet.h