From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388598; b=WOA+TUnUkikfKD17tOXxtP43AowLyVfDwnH4bsrsFOOJjvjQmVQkTmyCZFdXycSBteJe VKCfnp/lqZRbUW9b9SKGn6l1v3dlq4rFBlV7p0/zZDQ2GfiZik6Rsri3fZV3wgU9hAbrX EeAlSKsWjoFhVVuYo20q7Qu1p7uqahGoKsvo4wtjMU7e4GF9y7TQdP8QAu681uClT4OBU ftLVRVgGItTcE5tws4dFY8HUtq+NQohybBrdqJXpGnBo/5rFQpnuujv59QUG4iVdcZ/XD BTVOauNNeTX8xm5flH3ZybXzdDlkFktL27jR2RdzaCX5RCOP4IUef5UTohGzDaTxv3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388598; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Q7K+hAAtBMrjKBSh8VeUHmBm9SsHijy56n2iB+pP9Hw=; b=k2LObEYEpilUw/juwVpW/rTjsOIvBhEqVuvb86sOWbOdusnoSet/w0NCir3vZCtqO6LK F/gRP+gdREIWkmaqpFRz0K/ZaHrL4Dg4Zdbr7ifSIwruR35T/OJehT7DCwxaB2fqOaLS6 s+HKdgB9epwTyl+sJ+0jUZrT1Z8rMEvgMQk3DSMQprAEVApuOa7lqSiW7MnDSTHK9qSyP argtiLwSgjDSB2wSUGK/+yqKw9vBZIgD4wtJYbhkvWCXcnzsSt5uBsJg6dvqy6cEgb/WF n6joxt6PkNGZKMuHsOifrKGOHAtIn9V/iW5M2ENk3aVrfSpAmE2Ym8UiSVqCQ+1ApSA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lIy5DoBw; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B451606A322; Fri, 4 Dec 2026 12:49:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=lIy5DoBw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 755FF1F000CE; Fri, 4 Dec 2026 12:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388597; bh=Q7K+hAAtBMrjKBSh8VeUHmBm9SsHijy56n2iB+pP9Hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lIy5DoBwjvmVGFyq6BtiPPgnt7x5PGMm9pNyDv0+LerH4x8kVmkttSRAZxBUsoSBS CWNRzRv11CEwSruFhZWtVwadVv8HkbXMUlfRBZmAE+/mUCDVLRQ5de6SeGESJZigOD GhHhsEBQmxaxkzlUXavTdXYGzaikAkDDedsTsoWw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Claudiu Beznea , Sasha Levin Subject: [PATCH 6.1 0682/1059] serial: sh-sci: Check that the DMA cookie is valid Date: Fri, 4 Dec 2026 19:03:33 +0900 Message-ID: <20261204100701.671981589@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Claudiu Beznea [ Upstream commit c3ca8a0aac832fe8047608bb2ae2cca314c6d717 ] The driver updates struct sci_port::tx_cookie to zero right before the TX work is scheduled, or to -EINVAL when DMA is disabled. dma_async_is_complete(), called through dma_cookie_status() (and possibly through dmaengine_tx_status()), considers cookies valid only if they have values greater than or equal to 1. Passing zero or -EINVAL to dmaengine_tx_status() before any TX DMA transfer has started leads to an incorrect TX status being reported, as the cookie is invalid for the DMA subsystem. This may cause long wait times when the serial device is opened for configuration before any TX activity has occurred. Check that the TX cookie is valid before passing it to dmaengine_tx_status(). Fixes: 7cc0e0a43a91 ("serial: sh-sci: Check if TX data was written to device in .tx_empty()") Cc: stable Signed-off-by: Claudiu Beznea Link: https://patch.msgid.link/20251217135759.402015-1-claudiu.beznea.uj@bp.renesas.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 3c84c0580a9ce..4800682ba9fcc 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1700,7 +1700,7 @@ static void sci_dma_check_tx_occurred(struct sci_port *s) struct dma_tx_state state; enum dma_status status; - if (!s->chan_tx) + if (!s->chan_tx || s->cookie_tx <= 0) return; status = dmaengine_tx_status(s->chan_tx, s->cookie_tx, &state); -- 2.53.0