From patchwork Sat Jan 21 15:36:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13111150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A75A3C004D4 for ; Sat, 21 Jan 2023 15:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6n+JkoIm03E/VgnR7OzzAvYNJ4ha+oGj9BoqY+nT3ds=; b=teqPU1Kk672EZ+ BwaFcmDiX1Fy3/Y+A4SrQK0GRRTv6uw97Y6HnasVKxwqHEEbLYC0Aa7MZizmfElfwklN983zgwqA2 XUslcmXuuAWbk1o3km6Wdcl5GvW5BCyaWE722Msiw+h2N5QU6T7u7X2Uq4QMvJAqp4Ur31joIOUQN ULu6zMyschGQ3wsmTxEPE35vqHJp3ORhs9MzcoFoJ0u1yAgPF9NBbhg51R8hx2PQqa9Tc/j0AJJWd vopBmp+ogpMwiDF3+6pVOWFir7mdR8AQBO6821lFmpcQ7lH1tK1LFhJBwJudmlTIcy6cs74I3Ia/q /DYp4pgmhkZ7Y0i2r0ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJFvl-00E48s-4Z; Sat, 21 Jan 2023 15:37:21 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJFvN-00E419-8j for linux-arm-kernel@lists.infradead.org; Sat, 21 Jan 2023 15:36:58 +0000 Received: by mail-ej1-x62c.google.com with SMTP id mp20so20795381ejc.7 for ; Sat, 21 Jan 2023 07:36:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t9PFvNqNRiBtgoK1FQlt2dgZjVa65hIZ+MQtdwTOsMQ=; b=QEjQ5FTQ1p1l7Cd4SDXPKJZ6sDaKO4pSMir4BAS6hvoSdAFJ0cS+qBajfbwJV2pTJO x2WivqetX72P82ztk/8BSNaqx/ZIMtwfufirIk+npl3/cZ8qUhMakCz94H1xBr/3WHxh ywOmBlRnzvzzAP8cTsedv1lwu0D4+7aE74grKArkKVJ+WIeykONRA4PRV9/ucaH3FIYA LKA0BxbFTXdRw785gtB1QIJ/DUO6JseDP+AXJDDPl7HIx8xK5E3MxQEVEZJp0Lev81sl IJcbkwi+HZW2xqNRDkhDwV452ClQoPHLJKYRFMy1rg93qxkbztTQSFp0g2diIisN/LBz YhYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t9PFvNqNRiBtgoK1FQlt2dgZjVa65hIZ+MQtdwTOsMQ=; b=K/D6gOOoufVr12L+nXdtDBl9i83JvnFK2IOX1C1SWbNmIAZ5BqMqVf1Jc9pnlspPBI COmAJar6No4hN3B4YBqlA6Ab+oxdUWhDx45g2EViWUjNvx1/OD1H1HvCQ9rpmnZNvJ71 ZQ+2iVMUPzVzuy+BoSCF88SZOxAYM43z8HPlymd2648uaneokAK/kHieqKjiUySdmEvl 26w0/emvR1JuGGX/A7/Zc5fsTX/UO0VGLJij0p8hFzjFULsGAtVrQyjIBQkoFlYvmPq/ ustk9Nx5xRiICNIEfudoKW7OXjezOVFwXJOhnbS83fhPmujzfgsYdIClZqFSnCVNieLl aajg== X-Gm-Message-State: AFqh2kpGw/c7P79SwARBT233c2Kpa05hUTVbtQ0CC8zpnOUN83adB/q4 o0CflFYRBJZxB/mWGq/xEdI= X-Google-Smtp-Source: AMrXdXu8317LXKt67uugrjyibQpv8a3lJd/ELRzxu3nTo8TdR5m3rzZ6aUVDkVcdqpY+V2cnlpMPjQ== X-Received: by 2002:a17:906:2612:b0:83f:384f:ea23 with SMTP id h18-20020a170906261200b0083f384fea23mr19222886ejc.57.1674315415953; Sat, 21 Jan 2023 07:36:55 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id vc10-20020a170907d08a00b008717a377125sm8187030ejc.85.2023.01.21.07.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jan 2023 07:36:55 -0800 (PST) From: Sergey Organov To: linux-serial@vger.kernel.org Cc: Fabio Estevam , Greg Kroah-Hartman , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?utf-8?q?Tomasz_Mo=C5=84?= , =?utf-8?q?Uwe_Kle?= =?utf-8?q?ine-K=C3=B6nig?= , Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Sherry Sun , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH v1 3/7] serial: imx: do not sysrq broken chars Date: Sat, 21 Jan 2023 18:36:35 +0300 Message-Id: <20230121153639.15402-4-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230121153639.15402-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230121153639.15402-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230121_073657_389584_1240C453 X-CRM114-Status: GOOD ( 11.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Do not call uart_handle_sysrq_char() if we got any receive error along with the character, as we don't want random junk to be considered a sysrq. Signed-off-by: Sergey Organov --- drivers/tty/serial/imx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e7fce31e460d..e709118fe85c 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -911,9 +911,6 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) continue; } - if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) - continue; - if (unlikely(rx & URXD_ERR)) { if (rx & URXD_BRK) sport->port.icount.brk++; @@ -942,6 +939,8 @@ static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) flg = TTY_OVERRUN; sport->port.sysrq = 0; + } else if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) { + continue; } if (sport->port.ignore_status_mask & URXD_DUMMY_READ)