Received: by 10.213.65.68 with SMTP id h4csp485920imn; Fri, 16 Mar 2018 09:10:56 -0700 (PDT) X-Google-Smtp-Source: AG47ELu52/A7C6CgThu6LN5S0VfGM6EdpPTnZAv5XpRdbraDE0VO1WgJTDS4KBp3sffyXkm1CDTo X-Received: by 10.99.165.66 with SMTP id r2mr1890736pgu.452.1521216656710; Fri, 16 Mar 2018 09:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521216656; cv=none; d=google.com; s=arc-20160816; b=UKAErr6zkDTzzIXc2PyTFjS/Th6lM0Tzz+f4Qjh6qIbYbndGHafAcNuC+xBi2b/z9i sb8UehI6I/ITfRdo54L5AWr7IfmAV6aQtNb5Lt2rYM3tmxlSFkkAg1AjgUJdDcEXX4Vx 0KYsMZg050mrMsP4aTLRpM69DAavQ3uqs3NeC8GXVHrfZEsddaYSLDqtDkjzlyVFiMaM 5Dv2Jhcb8GqJJWQrRuJY6gdKApDShHZL3m0TiSeAH9GYuCHXPwoEW+8ZZrz02o9Yp4CZ Zpo8PjHK0YtZbsPZIbdFHgYqPH1Yc+kKUuyavdUtgIxlm9ZrNi2Gbeq7X9JAKnfA/Eqq kHhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Yr7k/eOEJOv0/8NwK2sHLymB27YcjSlIXekZvtEumnM=; b=y++/4if+aiiRCuQFZs7bYEypT2NIUE83S/R9Elwux07bUAzRPFFTFZ2B0VgGLxREs5 8L8Z8ch9hbstx9j48kSAR9h9/ZaiLFalDV6K3Cn2ziiWu393e6aSeUnwqh+hNScy7yNW Ik2Uemk+VJsZhM6yMEON9y1YSYH4yNUY186cTnSJL+Bj2AeEGa7VpekvwTIKO+H2XCb9 EoG/c9dDhghdwtgE2NaZ/Th/gZr9PwJAHm0ZwKmRHFS1oRCKLrHJ/E5O3hdsfMUQ4c4Q d6jglj1S4xBDkOXGPkua9HPDSREqpaVfKIXfxouUxkE5j8dLCUF4Hn9jTRBiHEVJSUjv QlVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si6446993plg.618.2018.03.16.09.10.42; Fri, 16 Mar 2018 09:10:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964940AbeCPQJl (ORCPT + 99 others); Fri, 16 Mar 2018 12:09:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43814 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965133AbeCPPk7 (ORCPT ); Fri, 16 Mar 2018 11:40:59 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CE7D4E98; Fri, 16 Mar 2018 15:40:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Ulrich Hecht , Geert Uytterhoeven , Nguyen Viet Dung Subject: [PATCH 4.15 009/128] serial: sh-sci: prevent lockup on full TTY buffers Date: Fri, 16 Mar 2018 16:22:30 +0100 Message-Id: <20180316152336.670371434@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ulrich Hecht commit 7842055bfce4bf0170d0f61df8b2add8399697be upstream. When the TTY buffers fill up to the configured maximum, a system lockup occurs: [ 598.820128] INFO: rcu_preempt detected stalls on CPUs/tasks: [ 598.825796] 0-...!: (1 GPs behind) idle=5a6/2/0 softirq=1974/1974 fqs=1 [ 598.832577] (detected by 3, t=62517 jiffies, g=296, c=295, q=126) [ 598.838755] Task dump for CPU 0: [ 598.841977] swapper/0 R running task 0 0 0 0x00000022 [ 598.849023] Call trace: [ 598.851476] __switch_to+0x98/0xb0 [ 598.854870] (null) This can be prevented by doing a dummy read of the RX data register. This issue affects both HSCIF and SCIF ports. Reported for R-Car H3 ES2.0; reproduced and fixed on H3 ES1.1. Probably affects other R-Car platforms as well. Reported-by: Yoshihiro Shimoda Signed-off-by: Ulrich Hecht Reviewed-by: Geert Uytterhoeven Cc: stable Tested-by: Nguyen Viet Dung Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/sh-sci.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -885,6 +885,8 @@ static void sci_receive_chars(struct uar /* Tell the rest of the system the news. New characters! */ tty_flip_buffer_push(tport); } else { + /* TTY buffers full; read from RX reg to prevent lockup */ + serial_port_in(port, SCxRDR); serial_port_in(port, SCxSR); /* dummy read */ sci_clear_SCxSR(port, SCxSR_RDxF_CLEAR(port)); }