Message ID | 20230525093159.223817-3-john.ogness@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp232633vqr; Thu, 25 May 2023 02:36:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7E7Fq2udxTamYtmKxXkIuZCGgFTQ4EBZAa2y1YJyQfUioIFFSvy5lRIPRNd41cCpgSwljK X-Received: by 2002:a05:6a00:1a56:b0:64d:3227:b800 with SMTP id h22-20020a056a001a5600b0064d3227b800mr7669458pfv.16.1685007383915; Thu, 25 May 2023 02:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685007383; cv=none; d=google.com; s=arc-20160816; b=ZcLJ1JCnADYi4vPhOT/Mzo/ONCkgi2euT0F8J5I2exHAACYXi6gsiUAvebJgk1JbUt +PHzMgiZtVmowFIbGlXYD++4HRd572htz70QghVTbfGm95FA50jeee8SoxZJzLmZB9G/ JSGoIhvm8q8lzErQrXrwn9v4Pg3FSmrJlGb5goQGQCVFBQqyzqPJXH9TOc8EpeNK66jt /0uZjnT4Cu3cFvCNQwbtz9+jjgK+kGAYsRwMoZYqnS3jaNNqVYMXR17bK7MJn1dHnKo3 NrDR+u8aRCahdSvMIl7JlCK7sENhm2ghtr2J88VzKOTyIKmMqtTQl7yPJaUPgE1wrwms QpHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=GfgGfHa1/jsadbpGlnKJSGFRiVJrywAA/VFxC+Yj2dA=; b=lMly6tU5/sbW/zFMPN1UJg7/DRBKObR+b4KbV2boOIn46YbHzIPXgVz54cJBl1+YPf 5Ex1vABuAB+aKgKuJkF8bslys5Piy6lsx4eGaoy93OP7FWKwfy/QiDCm1lbGTfgfBQYK 9+6PPGUIbXiTG/8HY6Og/gWXJnTQhwtLdW6jpCn7UQH1xWGGnzSe36aUgnRaBzx/PTec U0y/q9LVv0MxDDrQ3k+h9MUahONVBRa+kn+36bVZC721qUSZilW0bgAYF/rj3Eazcznd WBxLUfSpjFHgjfbZ+rrhf3bC0s7ZZhNfhonJMfiNkjwuMR9ivYkJDJ00VezR7gXem41a NK1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1XqeSoef; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a638c54000000b0053072cbae67si704571pgn.379.2023.05.25.02.36.11; Thu, 25 May 2023 02:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1XqeSoef; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240732AbjEYJev (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Thu, 25 May 2023 05:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240547AbjEYJeg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 25 May 2023 05:34:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF59B197; Thu, 25 May 2023 02:34:30 -0700 (PDT) From: John Ogness <john.ogness@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685007269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GfgGfHa1/jsadbpGlnKJSGFRiVJrywAA/VFxC+Yj2dA=; b=1XqeSoefdhJJALM506iJsLxxiP33wRzEY/RsMT3xMOtbbwSIZJfn7afMjs2zCnNlZFm+MY 4C4cM0CGhUpbyB2kwn0lz5YTvF/Pt/sQyJPQpL7ICrDoCw7ifmLRZAs55sTnQ6JhTjOZvH P8ygMFRT+3hgG5MJYXN/psukiO3zfw/8WXpvUVy5s/XmOzO/zRZyDvBPeRwWAo7b82kTg8 RQIPSeXcpQpG51Ta2ARcV0PQgJ0IGjyzvmZR59/tZ1sW5mPAgFgBa6+E6wzg55gRrk/i9r Wr2sPsBgf4RtvEO2LM/yU3WOLQ94jsK5nTTOYFi3lG4gpbvRbCWh7zCaCkGkzQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685007269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GfgGfHa1/jsadbpGlnKJSGFRiVJrywAA/VFxC+Yj2dA=; b=Fyn+5UtOwFlmls5SvZ5Pshw2Y2RG5/lrcgn39nVFzwqUwJW/1dghAip25QPfmh228+BFEH xBccxteWawp6g4AQ== To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Petr Mladek <pmladek@suse.com>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, Jiri Slaby <jirislaby@kernel.org>, Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>, linux-serial@vger.kernel.org Subject: [PATCH tty v1 2/8] serial: core: lock port for stop_rx() in uart_suspend_port() Date: Thu, 25 May 2023 11:37:53 +0206 Message-Id: <20230525093159.223817-3-john.ogness@linutronix.de> In-Reply-To: <20230525093159.223817-1-john.ogness@linutronix.de> References: <20230525093159.223817-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766858302599312461?= X-GMAIL-MSGID: =?utf-8?q?1766858302599312461?= |
Series |
synchronize UART_IER access against console write
|
|
Commit Message
John Ogness
May 25, 2023, 9:31 a.m. UTC
The uarts_ops stop_rx() callback expects that the port->lock is
taken and interrupts are disabled.
Fixes: c9d2325cdb92 ("serial: core: Do stop_rx in suspend path for console if console_suspend is disabled")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
drivers/tty/serial/serial_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
++Doug Hi, > -----Original Message----- > From: John Ogness <john.ogness@linutronix.de> > Sent: Thursday, May 25, 2023 3:02 PM > To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Petr Mladek <pmladek@suse.com>; Thomas Gleixner > <tglx@linutronix.de>; linux-kernel@vger.kernel.org; Jiri Slaby > <jirislaby@kernel.org>; Vijaya Krishna Nivarthi (Temp) (QUIC) > <quic_vnivarth@quicinc.com>; linux-serial@vger.kernel.org > Subject: [PATCH tty v1 2/8] serial: core: lock port for stop_rx() in > uart_suspend_port() > > WARNING: This email originated from outside of Qualcomm. Please be wary > of any links or attachments, and do not enable macros. > > The uarts_ops stop_rx() callback expects that the port->lock is taken and > interrupts are disabled. > > Fixes: c9d2325cdb92 ("serial: core: Do stop_rx in suspend path for console if > console_suspend is disabled") > Signed-off-by: John Ogness <john.ogness@linutronix.de> > --- > drivers/tty/serial/serial_core.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > index 4b98d13555c0..37ad53616372 100644 > --- a/drivers/tty/serial/serial_core.c > +++ b/drivers/tty/serial/serial_core.c > @@ -2333,8 +2333,11 @@ int uart_suspend_port(struct uart_driver *drv, > struct uart_port *uport) > * able to Re-start_rx later. > */ > if (!console_suspend_enabled && uart_console(uport)) { > - if (uport->ops->start_rx) > + if (uport->ops->start_rx) { > + spin_lock_irq(&uport->lock); > uport->ops->stop_rx(uport); > + spin_unlock_irq(&uport->lock); > + } Looks correct to me. Thank you for the fix. -Vijay/ > goto unlock; > } > > -- > 2.30.2
Hi, On Thu, May 25, 2023 at 2:35 AM John Ogness <john.ogness@linutronix.de> wrote: > > The uarts_ops stop_rx() callback expects that the port->lock is > taken and interrupts are disabled. > > Fixes: c9d2325cdb92 ("serial: core: Do stop_rx in suspend path for console if console_suspend is disabled") > Signed-off-by: John Ogness <john.ogness@linutronix.de> > --- > drivers/tty/serial/serial_core.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) Reviewed-by: Douglas Anderson <dianders@chromium.org>
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 4b98d13555c0..37ad53616372 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2333,8 +2333,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) * able to Re-start_rx later. */ if (!console_suspend_enabled && uart_console(uport)) { - if (uport->ops->start_rx) + if (uport->ops->start_rx) { + spin_lock_irq(&uport->lock); uport->ops->stop_rx(uport); + spin_unlock_irq(&uport->lock); + } goto unlock; }