Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1733278pxb; Thu, 16 Sep 2021 14:16:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZRjM7kyxNTl5jTE9XTCeHVdB2FgtlV/1p1YtAwVQ0HxTsAdM0xMwjkdQL5ANiKC4P8BTx X-Received: by 2002:a17:906:f289:: with SMTP id gu9mr8120194ejb.559.1631826993852; Thu, 16 Sep 2021 14:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631826993; cv=none; d=google.com; s=arc-20160816; b=ovJFw8vzT6GjUzBSK1jeWPrqOGhklafMu7F2Rn6zcIx1g4ImkehhOdiYFdkbsdxfrm 0ZawOY+wfeDMp/eOeUvkfs9XZNTr7myNxijm20pvw1O0Hmfer+pVaZIiUMNgwWRHlwvA +b9oruw3npmuFC8gXKw1QgOeWUEcBuTtHeWNSI5LLG1t+Eaa0imL0IGkRZP6jjXLrkwZ 5nszCygeiBZ6KoRWtlF41KTSed+EldpfHTy3L7e9EL4O71aejIGXdL85qCvJTg9PrK9H /C46FIzybFHL1gDS5n1wGECOQMVHvLl4xSjBMnpcM5/wKKTMKDRxUUXjEQI9FpozjMBC PObw== 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=FxDN4le+odb17Ygg1+X9DreZiH0MtPNVbD8nu5ttj2k=; b=ubdhC6tytXibEhp9azF32bzKGxARLgg73REAK77hUtz9qixXL/P9ytas1CGtcimayL wnX4UxG8hAMJBfuLNQkfoMqWeQW9+GGkfw2bfql5q1crCMxnbfA/LZ5EBEEn3MMIsfMe 6DoyR7/oC10DuT27TIcDTUiIlq0gSJSnu7Np5HtRKWp6mJ7icbfTl05Zm1t36lNNAGw0 pn6ThRP4rBXjlkGYmXgOMu0xOcaox0BrjxYvruSAz1A6KNqnNEo2CSKsRjuNyyUkDqV5 TiCfk67MBtlmPv92iC/7ZBZ5DPtiHItFmDc+8SciL7ImHEkFkdWWCo0t6c7J8nlyyh8C PHSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fTj8XfK8; 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 o5si4676674ejy.4.2021.09.16.14.16.07; Thu, 16 Sep 2021 14:16:33 -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=fTj8XfK8; 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 S241570AbhIPQ0S (ORCPT + 99 others); Thu, 16 Sep 2021 12:26:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:54968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241065AbhIPQTO (ORCPT ); Thu, 16 Sep 2021 12:19:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 17D7A6137E; Thu, 16 Sep 2021 16:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808785; bh=5M+U9qXHvYHNEZev3mvucxufKEpHdDaJvFQ8BTUZvE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTj8XfK8H1r/rsUEYJvu1CE/ZDEbQJnKlpUKZjmZDtOE3MjMDD8ql00IlQs09GOVl qHlOPm19ywMSzAqYFfCqmcC1ch6Rmd0GzhgqYUWYXW+OjaIAm1fnmSVaMWR9Pn5RoC ctyhgNfE7+IPfBtl+YSfqlVi0BIVjaRutph7VzKg= 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.10 222/306] serial: sh-sci: fix break handling for sysrq Date: Thu, 16 Sep 2021 17:59:27 +0200 Message-Id: <20210916155801.622433253@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@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 70898a999a49..f700bfaef129 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