diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2017-11-09 13:46:28 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-11 13:20:45 +0300 |
commit | 86dabda426ac33f4782854ef71f0c9adafd24134 (patch) | |
tree | a6817b43e719f5a98ba7dde137df8d0a89e903f8 /drivers/net/thunderbolt.c | |
parent | 5290ada4a2e6a9dec00e849a49af8f7bf7462449 (diff) | |
download | linux-86dabda426ac33f4782854ef71f0c9adafd24134.tar.xz |
net: thunderbolt: Clear finished Tx frame bus address in tbnet_tx_callback()
When Thunderbolt network interface is disabled or when the cable is
unplugged the driver releases all allocated buffers by calling
tbnet_free_buffers() for each ring. This function then calls
dma_unmap_page() for each buffer it finds where bus address is non-zero.
Now, we only clear this bus address when the Tx buffer is sent to the
hardware so it is possible that the function finds an entry that has
already been unmapped.
Enabling DMA-API debugging catches this as well:
thunderbolt 0000:06:00.0: DMA-API: device driver tries to free DMA
memory it has not allocated [device address=0x0000000068321000] [size=4096 bytes]
Fix this by clearing the bus address of a Tx frame right after we have
unmapped the buffer.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/thunderbolt.c')
-rw-r--r-- | drivers/net/thunderbolt.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/thunderbolt.c b/drivers/net/thunderbolt.c index 435854688a7a..228d4aa6d9ae 100644 --- a/drivers/net/thunderbolt.c +++ b/drivers/net/thunderbolt.c @@ -536,6 +536,7 @@ static void tbnet_tx_callback(struct tb_ring *ring, struct ring_frame *frame, dma_unmap_page(dma_dev, tf->frame.buffer_phy, tbnet_frame_size(tf), DMA_TO_DEVICE); + tf->frame.buffer_phy = 0; /* Return buffer to the ring */ net->tx_ring.prod++; |