Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1803484pxb; Thu, 16 Sep 2021 16:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOg/mU42dKXfdwsmanWJXHlFSGREJPVfkNIQSMm/G4n1VInxCAzCuyzdXDFIp4fps5/+mF X-Received: by 2002:a50:d80f:: with SMTP id o15mr9238330edj.52.1631834448057; Thu, 16 Sep 2021 16:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631834448; cv=none; d=google.com; s=arc-20160816; b=PE/6ZbF/w533rvr73mI8VOtFuDPtlk26GE2VB1t6RJKgMUVKR6FvAtREBIc2mdsYvb PCp6vfXwalIksqrL27ewDyMoI4fmqgNYWbrhZrOzXVHGJjuDZ/jrmNTqC/TzTfCS0EYR ahk6i27vsM3yI9hJlBUCCBrmc1Bcu8ySvZo+KNzHZsGkjj54yBjdShFVxC9jrSCejEFs 2FJgQioGZ2vnAWxemg7Pni1oj0xwkoLDghnyWg/soFnuExK93ble0Si8lFT7Ud+JN5hB 0n/fQn0ODV2flZ9OXYL5bfjfZ+lfgnWWCG8KQh8/lwld5q43i2erEI11KlgFPiyTpucZ ZK9w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PNUeEhuVQrwgUFCT4P7NZDcV1M73aEoBN760IHLHlHI=; b=IZ/AYi0ytIZQgO1VqqOaA7gH2UTTZv1c+NgfuH7kWbTcAlwZDyXUqBJoGmOL+EWBia 04z6buOVd9LaBj51Q7aAOnI6CRTCggigvm0C+vvsI/YpKPzC0KkozuU+w4LUO3fh4tX3 YnPkrWhSAPTtsov6yCo1U53xjg3G6/L1KUDnU/zwAu/F1kHpSZk5WkyOw4dZ8OVtiz4q CFhapK7haYrddR3sKIQmMe8RbgNbJ4oeNdALDk/oCKLqZT0D+ep1UGnDeFRhDE5ugZfZ tEb9xXfVN1D1GbrHoJHUBdN+D2N0SVp9IMaTQB5yy9LVTTr/BBixfAgSCDmvcN/QCLKx Y7CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uIlGtmN9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl24si5365479ejc.190.2021.09.16.16.20.23; Thu, 16 Sep 2021 16:20:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uIlGtmN9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343894AbhIPQ5G (ORCPT + 99 others); Thu, 16 Sep 2021 12:57:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:37600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237688AbhIPQwx (ORCPT ); Thu, 16 Sep 2021 12:52:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C76E6135E; Thu, 16 Sep 2021 16:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809771; bh=vltmrNgN+E0W7LKarKrqHmP9bA245YK9RPBi7h2Hvrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIlGtmN957C3TL7s5d5GrxqK4DaLHGsoFI3tSZLX2MoqehxB7fk3d/NRz+Dg6oil8 Eu0GSp56oVqlBAEo+YHkDTx+qhjAm894IzjUsLuKrt8EvRG0mhGun/zKbUR8feN1UR HtHsJMRJVXjR3r/leZSUGFztiV0Luh/9wuVi8Thw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulrich Hecht , Sasha Levin Subject: [PATCH 5.13 276/380] serial: sh-sci: fix break handling for sysrq Date: Thu, 16 Sep 2021 18:00:33 +0200 Message-Id: <20210916155813.468148963@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulrich Hecht [ Upstream commit 87b8061bad9bd4b549b2daf36ffbaa57be2789a2 ] This fixes two issues that cause the sysrq sequence to be inadvertently aborted on SCIF serial consoles: - a NUL character remains in the RX queue after a break has been detected, which is then passed on to uart_handle_sysrq_char() - the break interrupt is handled twice on controllers with multiplexed ERI and BRI interrupts Signed-off-by: Ulrich Hecht Link: https://lore.kernel.org/r/20210816162201.28801-1-uli+renesas@fpond.eu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/sh-sci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 2d5487bf6855..a2e62f372e10 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1760,6 +1760,10 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) /* Handle BREAKs */ sci_handle_breaks(port); + + /* drop invalid character received before break was detected */ + serial_port_in(port, SCxRDR); + sci_clear_SCxSR(port, SCxSR_BREAK_CLEAR(port)); return IRQ_HANDLED; @@ -1839,7 +1843,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) ret = sci_er_interrupt(irq, ptr); /* Break Interrupt */ - if ((ssr_status & SCxSR_BRK(port)) && err_enabled) + if (s->irqs[SCIx_ERI_IRQ] != s->irqs[SCIx_BRI_IRQ] && + (ssr_status & SCxSR_BRK(port)) && err_enabled) ret = sci_br_interrupt(irq, ptr); /* Overrun Interrupt */ -- 2.30.2