]> git.baikalelectronics.ru Git - kernel.git/commit
serial: pch_uart: Pass correct sg to dma_unmap_sg()
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 3 Jan 2023 09:34:35 +0000 (11:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:18:01 +0000 (07:18 +0100)
commit5560b9aa02d12442fd19ed38ed1a46cd77c3e0cf
tree1e360c43dbc807ebc468ddb50d41a2b3ef79cef3
parent29064f51250ad5e35b6244649cf659c7d44814cd
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: e5f44f3fe68c ("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>
drivers/tty/serial/pch_uart.c