From patchwork Tue Mar 7 16:44:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13164171 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 D7D9EC742A7 for ; Tue, 7 Mar 2023 16:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbjCGQq7 (ORCPT ); Tue, 7 Mar 2023 11:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjCGQqh (ORCPT ); Tue, 7 Mar 2023 11:46:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A621096C3C; Tue, 7 Mar 2023 08:43:39 -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 58EE9B81986; Tue, 7 Mar 2023 16:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19355C433A0; Tue, 7 Mar 2023 16:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678207417; bh=Wq+5k8oC8/u0yNH/aD78uhUqCmSvOQM4I4ENgYqsEkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhYOkPxMndsBoqpJdPajozRgjCCsjGLj0y+V/ZVU/9aDc86ZemRCxx7mXr6pJeSJn ll9lZraCSfgs4jCVxyJ3CRZc5fDlbqo9yzMJqq3/Ys4wY7YFo+2PuZ7wasndQGUKPe FKk2LVMbG+sxgGjPq07K58XcVTDPqdh8Kc4PuSkZvtoEwmMJKrh9tXdkjalA6e70OZ Bqu1F+Jn/+t/lM2S1ZjI/nlVY78qvn/4QMCJNsb9HMKuIdjPOPbl16gKdJw7xU+1xm D2UjkyW4nofslpdcSIgxxnm9v5zPLoz8oKTa0yob8KPBL+qoVU6MWKTuzN9OWwSS/x dxeG21NqNDNHw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZaQH-0003hs-0z; Tue, 07 Mar 2023 17:44:21 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Jiri Slaby , Bartosz Golaszewski , Douglas Anderson , Daniel Thompson , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/4] serial: qcom-geni: fix DMA mapping leak on shutdown Date: Tue, 7 Mar 2023 17:44:03 +0100 Message-Id: <20230307164405.14218-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307164405.14218-1-johan+linaro@kernel.org> References: <20230307164405.14218-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Fix what appears to be a copy-paste error that can lead to a leaked DMA mapping on close() and failure to restart TX after the port is reopened. Note that rx_dma_addr is generally NULL when qcom_geni_serial_stop_tx_dma() is called as part of shutdown() (but tx_dma_addr need not be). Fixes: 2aaa43c70778 ("tty: serial: qcom-geni-serial: add support for serial engine DMA") Cc: Bartosz Golaszewski Signed-off-by: Johan Hovold Reviewed-by: Douglas Anderson --- drivers/tty/serial/qcom_geni_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 11da05d8f848..2aa3872e6283 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -596,7 +596,7 @@ static void qcom_geni_serial_stop_tx_dma(struct uart_port *uport) if (!qcom_geni_serial_main_active(uport)) return; - if (port->rx_dma_addr) { + if (port->tx_dma_addr) { geni_se_tx_dma_unprep(&port->se, port->tx_dma_addr, port->tx_remaining); port->tx_dma_addr = 0;