summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2023-01-03 11:34:35 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-24 07:11:50 +0100
commitfe85083b284b4653d7beb2065e3f601375a527ed (patch)
tree2aae5eed0aea9831c947a8919ac1c0c9431ff5ed /drivers
parenta24cbfc16746abd9c1ced0e8cf05f28010b5abce (diff)
downloadlinux-stable-fe85083b284b4653d7beb2065e3f601375a527ed.tar.gz
linux-stable-fe85083b284b4653d7beb2065e3f601375a527ed.tar.bz2
linux-stable-fe85083b284b4653d7beb2065e3f601375a527ed.zip
serial: pch_uart: Pass correct sg to dma_unmap_sg()
commit e8914b52e5b024e4af3d810a935fe0805eee8a36 upstream. A local variable sg is used to store scatterlist pointer in pch_dma_tx_complete(). The for loop doing Tx byte accounting before dma_unmap_sg() alters sg in its increment statement. Therefore, the pointer passed into dma_unmap_sg() won't match to the one given to dma_map_sg(). To fix the problem, use priv->sg_tx_p directly in dma_unmap_sg() instead of the local variable. Fixes: da3564ee027e ("pch_uart: add multi-scatter processing") Cc: stable@vger.kernel.org Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230103093435.4396-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/pch_uart.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 447990006d68..4b035d61b280 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -792,7 +792,7 @@ static void pch_dma_tx_complete(void *arg)
}
xmit->tail &= UART_XMIT_SIZE - 1;
async_tx_ack(priv->desc_tx);
- dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE);
+ dma_unmap_sg(port->dev, priv->sg_tx_p, priv->orig_nent, DMA_TO_DEVICE);
priv->tx_dma_use = 0;
priv->nent = 0;
priv->orig_nent = 0;