aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2020-03-24 13:23:38 +0000
committerDavid S. Miller <davem@davemloft.net>2020-03-24 16:33:04 -0700
commite7fea0b9d09e2f7d32776f5198192dfc2572a5b9 (patch)
treeeac737f44e00e6c169ef95795517213aa8fede1c
parentnet: axienet: Fix DMA descriptor cleanup path (diff)
downloadwireguard-linux-e7fea0b9d09e2f7d32776f5198192dfc2572a5b9.tar.xz
wireguard-linux-e7fea0b9d09e2f7d32776f5198192dfc2572a5b9.zip
net: axienet: Improve DMA error handling
Since 0 is a valid DMA address, we cannot use the physical address to check whether a TX descriptor is valid and is holding a DMA mapping. Use the "cntrl" member of the descriptor to make this decision, as it contains at least the length of the buffer, so 0 points to an uninitialised buffer. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 415179cbdc51..82ec7deacdfe 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -571,7 +571,7 @@ static void axienet_start_xmit_done(struct net_device *ndev)
DMA_TO_DEVICE);
if (cur_p->skb)
dev_consume_skb_irq(cur_p->skb);
- /*cur_p->phys = 0;*/
+ cur_p->cntrl = 0;
cur_p->app0 = 0;
cur_p->app1 = 0;
cur_p->app2 = 0;
@@ -1539,7 +1539,7 @@ static void axienet_dma_err_handler(struct work_struct *work)
for (i = 0; i < lp->tx_bd_num; i++) {
cur_p = &lp->tx_bd_v[i];
- if (cur_p->phys)
+ if (cur_p->cntrl)
dma_unmap_single(ndev->dev.parent, cur_p->phys,
(cur_p->cntrl &
XAXIDMA_BD_CTRL_LENGTH_MASK),