diff options
author | Kevin Hao <haokexin@gmail.com> | 2015-08-07 05:52:37 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-10 20:28:14 (GMT) |
commit | c4bc44c65b6b24722506ad5d1bbf557a71d3df90 (patch) | |
tree | 9d47b65b0bc008c280c51074e9a2adebcade3459 /drivers/net/loopback.c | |
parent | 2cf1b5ce16b61259e3633fb61e6fedaad6e25fc5 (diff) | |
download | linux-c4bc44c65b6b24722506ad5d1bbf557a71d3df90.tar.xz |
net: fec: fix the race between xmit and bdp reclaiming path
When we transmit a fragmented skb, we may run into a race like the
following scenario (assume txq->cur_tx is next to txq->dirty_tx):
cpu 0 cpu 1
fec_enet_txq_submit_skb
reserve a bdp for the first fragment
fec_enet_txq_submit_frag_skb
update the bdp for the other fragment
update txq->cur_tx
fec_enet_tx_queue
bdp = fec_enet_get_nextdesc(txq->dirty_tx, fep, queue_id);
This bdp is the bdp reserved for the first segment. Given
that this bdp BD_ENET_TX_READY bit is not set and txq->cur_tx
is already pointed to a bdp beyond this one. We think this is a
completed bdp and try to reclaim it.
update the bdp for the first segment
update txq->cur_tx
So we shouldn't update the txq->cur_tx until all the update to the
bdps used for fragments are performed. Also add the corresponding
memory barrier to guarantee that the update to the bdps, dirty_tx and
cur_tx performed in the proper order.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/loopback.c')
0 files changed, 0 insertions, 0 deletions