Commit 4ff842ec authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by sanglipeng
Browse files

serial: pch_uart: Pass correct sg to dma_unmap_sg()

stable inclusion
from stable-v5.10.165
commit c9da2cb968ea9604ab0e742b523b997fb05b4994
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7T7G4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c9da2cb968ea9604ab0e742b523b997fb05b4994



--------------------------------

commit e8914b52 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: da3564ee ("pch_uart: add multi-scatter processing")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230103093435.4396-1-ilpo.jarvinen@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent dd84503e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment