From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67AFBC25B4E for ; Sun, 22 Jan 2023 15:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbjAVPKr (ORCPT ); Sun, 22 Jan 2023 10:10:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjAVPKq (ORCPT ); Sun, 22 Jan 2023 10:10:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05691F5DE for ; Sun, 22 Jan 2023 07:10:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 694F2B80B11 for ; Sun, 22 Jan 2023 15:10:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B87C1C433D2; Sun, 22 Jan 2023 15:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1674400243; bh=djyEpB17z2Bd8VDS/PeUapSdaOPlhuVBZqfJsshr+nQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ILpx0QhjQV6/8dytqlGuul95eau6v8W0x6wNKKxuFnHOnZdDYJrTNdJBZLZvTVmKH LInUWkKxjIeMd1VECa0xie74T3rdCdbw9jYcyfl5KMP/AWSR/AkanPStlBbKpcRWS/ eN4fdqibZPpyQKRi1S+DX3ydZ/ny888kGQh6fx/E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.4 43/55] serial: pch_uart: Pass correct sg to dma_unmap_sg() Date: Sun, 22 Jan 2023 16:04:30 +0100 Message-Id: <20230122150223.944352192@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122150222.210885219@linuxfoundation.org> References: <20230122150222.210885219@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ilpo Järvinen 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 Link: https://lore.kernel.org/r/20230103093435.4396-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -776,7 +776,7 @@ static void pch_dma_tx_complete(void *ar } 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;