From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D6CB7260D for ; Fri, 5 Jun 2026 13:53:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780667610; cv=none; b=m5D32u/hOOWRRZw4qSnqgGh5oDTkqut5eVCmoRBUC+sktrOl0oWnZhdtcajz+wDDe0p5VMKSIoGZkWNDm0Ym76nR2CR77wWHS+u1pgUu16SJzW16QuhG1WgRkn0sdE74Ki36Tg0h2+E9pYCoALtHk55XZPb/CqrOtj1B7QVByGU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780667610; c=relaxed/simple; bh=zcL5sQV1jPyEcePm1elSArUI7k3Vt/Mgfw4WdOynrmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SuZQh7YRlBPW+lnnxDmbUdDc/ENRmBKLXuVHCD+K/kzW8JjZ4aQMIJl3e2gfmdcE1SQOy1wzU0FzaLluEV41TJiDW94xuj6h3RoV09SR3IQVGPBu8Hiu8tVzYAK1P+D2tuOnRxOKv+kjWXRyozryiPD97CaVootlaJ+huaXuTzE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iw9stf2K; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iw9stf2K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DD161F0089A; Fri, 5 Jun 2026 13:53:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780667608; bh=2+RY35TX7+1Cx0PGfbEIrEFe2z9OrlLErAI2oZOdxk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iw9stf2K/jsBlEGDeCtGIaeEUdQUE2C023RckKajQUhPKGegFlSVadeS1Q40XV6bd KuoXuxrYLYJhv/QlLxhWMoLfs4SrXoYukyuvZtdizFwFfNhYPNxlBDqLZJedksVKyf T3FlvumW116lKJWhESv7u2Q+9cTuev7rVcx/p+OLlg5tL+hvnc0wZ4Rh5bSm9v/KWg 0qVJNz8akdytXrIh+9eSI/nm7ckB3b6TIbOE3Z4lL06YhGdfP9Ya1K2SSXPFwxjoi+ ctO3YRnwvRkK/lCf2QmhgbvMxbr3jgQ/E3pE//n5bGGfxtUw4CWULL4eYJf6Sei54j tNFOiJjdL8U0Q== From: Sasha Levin To: stable@vger.kernel.org Cc: Tudor Ambarus , stable , John Ogness , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 6.6.y 3/3] tty: serial: samsung: Remove redundant port lock acquisition in rx helpers Date: Fri, 5 Jun 2026 09:53:24 -0400 Message-ID: <20260605135324.928676-3-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260605135324.928676-1-sashal@kernel.org> References: <2026060427-payroll-estimator-0ec1@gregkh> <20260605135324.928676-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Tudor Ambarus [ Upstream commit a3bb136bff5e6a5e48cdd813246c9c4686feaaa9 ] Sashiko identified a deadlock when the console flow is engaged [1]. When console flow control is enabled (UPF_CONS_FLOW), s3c24xx_serial_stop_tx() calls s3c24xx_serial_rx_enable() and s3c24xx_serial_start_tx() calls s3c24xx_serial_rx_disable(). The serial core framework invokes the .stop_tx() and .start_tx() callbacks with the port->lock spinlock already held. Furthermore, all internal driver paths that invoke stop_tx (such as the DMA TX completion handler s3c24xx_serial_tx_dma_complete() or the PIO TX IRQ handler s3c24xx_serial_tx_irq()) also acquire port->lock prior to calling it. (Note that s3c24xx_serial_start_tx() is only invoked by the serial core). However, s3c24xx_serial_rx_enable() and s3c24xx_serial_rx_disable() unconditionally attempt to acquire port->lock again using uart_port_lock_irqsave(). Since spinlocks are not recursive, this causes a deadlock on the same CPU when console flow control is engaged. Remove the redundant lock acquisition from both rx helper functions. Cc: stable Fixes: b497549a035c ("[ARM] S3C24XX: Split serial driver into core and per-cpu drivers") Reported-by: John Ogness Closes: https://sashiko.dev/#/patchset/20260506121606.5805-1-john.ogness%40linutronix.de [1] Signed-off-by: Tudor Ambarus Link: https://patch.msgid.link/20260515-samsung-tty-flow-control-deadlock-v1-1-93255edbc9bc@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/samsung_tty.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 3cb5f202530781..a9bafe94a1f1d1 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -244,12 +244,9 @@ static int s3c24xx_serial_txempty_nofifo(const struct uart_port *port) static void s3c24xx_serial_rx_enable(struct uart_port *port) { struct s3c24xx_uart_port *ourport = to_ourport(port); - unsigned long flags; int count = 10000; u32 ucon, ufcon; - uart_port_lock_irqsave(port, &flags); - while (--count && !s3c24xx_serial_txempty_nofifo(port)) udelay(100); @@ -262,23 +259,18 @@ static void s3c24xx_serial_rx_enable(struct uart_port *port) wr_regl(port, S3C2410_UCON, ucon); ourport->rx_enabled = 1; - uart_port_unlock_irqrestore(port, flags); } static void s3c24xx_serial_rx_disable(struct uart_port *port) { struct s3c24xx_uart_port *ourport = to_ourport(port); - unsigned long flags; u32 ucon; - uart_port_lock_irqsave(port, &flags); - ucon = rd_regl(port, S3C2410_UCON); ucon &= ~S3C2410_UCON_RXIRQMODE; wr_regl(port, S3C2410_UCON, ucon); ourport->rx_enabled = 0; - uart_port_unlock_irqrestore(port, flags); } static void s3c24xx_serial_stop_tx(struct uart_port *port) -- 2.53.0