From patchwork Fri Jan 13 18:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 13101490 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 45F6EC677F1 for ; Fri, 13 Jan 2023 18:45:05 +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=pc9Ex2ubYI2H5pzgMf4cqtGjmdzs5L6TFErCS9A/N9U=; b=ENU1lImEPQ70Ok ar/sti09Mh5FKib8oiOKkOM5EP9TLyebsAnCluj/r5lhuT9a2b0dZifa4tJhYGX1eBVRqxBsEZmy7 3t2qhJfSBoV4uRQ1pnYPJNE2McOYfEuh4JvMHGnJOBQrqswfJ05xxyKKR4h4gX7KXZG0612yPk85k ZAK4+kzLt+H0Lm35gBQZi9whE2Btf3sVPA62UL4dTGzxyfJYEGCMBsx5xqnj9LzjtTi2ZX0Lql5E6 CuLOjmh3RfyqgbvMaiJi5c1xm9oBcS5/vc2fy97vv9Vfb7xCIi28GOtRnofDbAgludkrp/c1a91Vx bgEp+alkCMeqF/RQD5GA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGP27-0045N7-0z; Fri, 13 Jan 2023 18:44:07 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGP1m-0045H7-3u for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 18:43:48 +0000 Received: by mail-lf1-x12e.google.com with SMTP id bf43so34331541lfb.6 for ; Fri, 13 Jan 2023 10:43:46 -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=+uSogoDZIxozQW5QEm2zGToSkpBWHSYVqPpGas5pKh8=; b=TR0PtLOgazeFx4JTnDSy1KbfiovsMAKfP5Httj5Bcv8O0FaCWJP41G6xvzqpsRhaTk tlnCXfjwHYb40BlO7LkuTjZSSycCwZWgp+ij13dWYzb/fPEE5/86IgJ4ShEvD8yhRWcS OORMkGKiNQx5xYcFM61F+2SfejYzUh/K/NSLME5HPh19Y7BlpbwIT6P5Vo3KbamsSf07 vubxy6zIxbcIdcVhFi3wfGrI6TZxfyKHmMorp3+deiowuiaA+dam3XbKAErYVdUmiOap Qrh+u/gyVpqcS9VEnXoMFEFbPT7I674ryim/3s9J69M5q6MOr/TlaXtf9USozUW8bUoo pZOQ== 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=+uSogoDZIxozQW5QEm2zGToSkpBWHSYVqPpGas5pKh8=; b=NN7Xl2jFxn9+6rDpdcxcPKoPD2Bc+cnrfHF3Vfpbq5MIBXcxlbYQ86HljgOWimdkqn NGyWdEBiVhtAuTlkei8mCDl851QqnTGrPdfzaFwgELK9MumFgfKu+n9axGZHXqVmMxxb Wip9QrP9LYxFNFr9dQjgi7tPjzkgkqDxtHiRvmWuIjzg/f2rly2Y6AdVlqIEHy0nPhq8 BkK0edmXGJKGRXqPQLMDlfIRsfqUzeqSCLTqtBDMj/oAlmgce6J5azO4MjYryNMLN+wV kgKwnSu0DJIjE+gsx6+cul6+YXWPT/A2nGwzVqG3Lsn7v3OnCboqqyciEo4TW58cByN2 WYbg== X-Gm-Message-State: AFqh2korBJoE8g5cixUVOZYJJvMh7Uj/7i4ANyJTbvCBM2KzONm+nd28 fSO9oITSXipvfVHnXtAKMJQ= X-Google-Smtp-Source: AMrXdXv2v9QEPDicYWZ6C8d5dObmPqiC3pJ1vOYx0+av0mtu3SOR4E0mlyiirZ5mjQCR8HrdllC0GA== X-Received: by 2002:a05:6512:2349:b0:4a4:68b9:66cd with SMTP id p9-20020a056512234900b004a468b966cdmr23194583lfu.24.1673635424853; Fri, 13 Jan 2023 10:43:44 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id o11-20020ac2434b000000b004cc9ddce3adsm1261439lfl.82.2023.01.13.10.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 10:43:44 -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?= , linux-arm-kernel@lists.infradead.org, NXP Linux Team , Pengutronix Kernel Team , Sergey Organov Subject: [PATCH 3/8] serial: imx: do not sysrq broken chars Date: Fri, 13 Jan 2023 21:43:29 +0300 Message-Id: <20230113184334.287130-4-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230113184334.287130-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230113184334.287130-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230113_104346_178769_84DE8B85 X-CRM114-Status: GOOD ( 11.44 ) 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 Reviewed-by: Ilpo Järvinen --- drivers/tty/serial/imx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e7fce31e460d..1c950112a598 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,7 +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) goto out;