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 59BE9C25B4E for ; Sun, 22 Jan 2023 15:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbjAVPIB (ORCPT ); Sun, 22 Jan 2023 10:08:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbjAVPIA (ORCPT ); Sun, 22 Jan 2023 10:08:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DC15126FE for ; Sun, 22 Jan 2023 07:07:59 -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 193F2B80B12 for ; Sun, 22 Jan 2023 15:07:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A680C433D2; Sun, 22 Jan 2023 15:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1674400076; bh=chzBENqgieb9Qj4TaMoOkUkuMlfujWT0VeSzHm95+QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fq8NRXEjRS2gV58vVLdmBzQAXC89T19z9Jp72bKBtf9EIfRcUUbaLblFYrfL6NmIy ZnvlEjYyt9hK+kvDwrdixtVvOwwEfgz9hrTUob506aMXU1nMkTACA24apddJl6CXsC zP55ShAqzhz69nFdW7t2cGutjf8ZYzWQnDGxFSg4= 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 4.19 30/37] serial: pch_uart: Pass correct sg to dma_unmap_sg() Date: Sun, 22 Jan 2023 16:04:27 +0100 Message-Id: <20230122150220.806300125@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122150219.557984692@linuxfoundation.org> References: <20230122150219.557984692@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 @@ -792,7 +792,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;