]> git.baikalelectronics.ru Git - kernel.git/commit
net: thunderbolt: Clear finished Tx frame bus address in tbnet_tx_callback()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 9 Nov 2017 10:46:28 +0000 (13:46 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 11 Nov 2017 10:20:45 +0000 (19:20 +0900)
commita13f32cdc1d2b83b06ae73b4b91c2dc6ee79eac7
treea6817b43e719f5a98ba7dde137df8d0a89e903f8
parent2cd0e49f92847cb9445067d75063fad968a2a652
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>
drivers/net/thunderbolt.c