From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8136C636CD for ; Wed, 1 Feb 2023 14:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232203AbjBAO1y (ORCPT ); Wed, 1 Feb 2023 09:27:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231923AbjBAO1r (ORCPT ); Wed, 1 Feb 2023 09:27:47 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3018F6813A for ; Wed, 1 Feb 2023 06:27:44 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id eq11so863031edb.6 for ; Wed, 01 Feb 2023 06:27:44 -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=VuJERbKWYOkgt/D8s8FOfDHVNd9glpziOVsTG+1JjLTYT7jGJy1VkNDZTgK1e3AjMi uiTHC7h8eh40cm5Ey0iOSL2dpFDm/v98ZQMIex6y23PczBzbg88bVdaUZNd0WWg/0jOA JzycDx1+F+NmAh/FdYq0uN6t5s2s+R5IAZ0CchzXlf2wZRO593HSjQ8BJOyjxZ9HWs/i uQzPZWRRcgdGxyi/Z+02V/ktq/h+yh9NWIrVbclaJyzIOW5XSGww95ZnYMue7FOCrd9+ TUr+d6HsTGLjHygi10C1POXJ+GgaTvnL56wA9d+DVUKNX4J2/dVnsWp5U/y7xmxOeUQY vjTQ== 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=0y0m4n3SsH/0RYtRmDqFwFT4C8lFjaOP0ahXJ4z4Kc3dTh9xb1e4dr9RPhi7yC/ytR B6C6JdZda4eidGx7SVDHsWqIhyXkqG9tRCIXmJMCbF5mjSN5PtT+78psk2SeRlL2mRCS 0gfF3iZyQatiZKhWYeDU9OMdpGBk1HLvrkOxidAEHf0fwRxeRuN9Vd9qpV+ZuegRkU83 B0bjnboscnxrh5zSi4FQe+HPQNDESTjH3Qi749D96BNi87D0dqJZdd4szFozW2iwgKSs MooytjgfxxLjG9GUmbcbguql49i6hATTdEASOCCHgxDi9meojWbCh6KE8f+F7Zz5thGs Twhw== X-Gm-Message-State: AO0yUKX0qTlaoOZu4wZml1T8m/siNb80ACsz6C/34tPf5eWnvsjZYzQ4 xggi8QN1AG1d/qAFtsLmDNc= X-Google-Smtp-Source: AK7set9hYDxvOQi0xjHhLN/X3aYvdrUsus0F/Am0ploCUlkQQm6XutLDb+3FJsBgq+1sa7AWYzsHnw== X-Received: by 2002:a50:ccd3:0:b0:47a:e008:8662 with SMTP id b19-20020a50ccd3000000b0047ae0088662mr2526553edj.34.1675261662685; Wed, 01 Feb 2023 06:27:42 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id cf8-20020a0564020b8800b004a18f2ffb86sm8975564edb.79.2023.02.01.06.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 06:27:42 -0800 (PST) From: Sergey Organov To: Greg Kroah-Hartman Cc: linux-serial@vger.kernel.org, Fabio Estevam , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?UTF-8?q?Tomasz=20Mo=C5=84?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Johan Hovold , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sherry Sun , Stefan Wahren , 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: Wed, 1 Feb 2023 17:26:56 +0300 Message-Id: <20230201142700.4346-4-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230201142700.4346-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230201142700.4346-1-sorganov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.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) -- 2.30.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 12E39C636CD for ; Wed, 1 Feb 2023 14:40:21 +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=kXg9KekTQZvXky 0YzKYsIAkqqGwTn8avSHxxvPU5KIac/OTyjD9NVGa25vuDVNZ8XDiaDR4BBjeykNcl9A63ohrgD+/ kYbh0tmUUV0p/H5tjxMCl6bF+cPigbVW72NxCncZEzQLy0BRf3FA78xEXGMojQflXzQxRxnVfX8vh d7aBQZUe8be/ZVNxnH3w9XYwddvmf4WhKeMqryyGv0D294djPCE+aJy4lD/qyD8kGiEWb8zwNabRq 07S0Et2BxeqbB/PkepwgE5ctyz2vqw90FnKK2CCoTVY2pRVivJYKuznvAAT7j0JJpa89TB82M3JXD s3fy3/r4rQESxYPTZzIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNEGM-00CQgO-Le; Wed, 01 Feb 2023 14:39:04 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNE5P-00CLn5-Uc for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 14:27:45 +0000 Received: by mail-ed1-x52f.google.com with SMTP id x7so14626885edr.0 for ; Wed, 01 Feb 2023 06:27:43 -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=VuJERbKWYOkgt/D8s8FOfDHVNd9glpziOVsTG+1JjLTYT7jGJy1VkNDZTgK1e3AjMi uiTHC7h8eh40cm5Ey0iOSL2dpFDm/v98ZQMIex6y23PczBzbg88bVdaUZNd0WWg/0jOA JzycDx1+F+NmAh/FdYq0uN6t5s2s+R5IAZ0CchzXlf2wZRO593HSjQ8BJOyjxZ9HWs/i uQzPZWRRcgdGxyi/Z+02V/ktq/h+yh9NWIrVbclaJyzIOW5XSGww95ZnYMue7FOCrd9+ TUr+d6HsTGLjHygi10C1POXJ+GgaTvnL56wA9d+DVUKNX4J2/dVnsWp5U/y7xmxOeUQY vjTQ== 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=m2+k40M5/FNsyg+Lwumh+wLyD+GR3aAyL4tjzyUigwguV1iyHDAbhmThJ10GGfb005 5apWEWMjqnJQIHLcO2G373DMp1bCuCdnCbjM5tgZEQOSLmp/vaVH5BjNm4AmJ6kpzITd 8JWKVuJjoKnFSWt4fz7Ov7xZLpvPVQMtUikO+WSPbH7G2m5vGJ0Auag+dy8kqkEwPxRL /Xy97JQNZMUApMTJLuan4qVOwnHUdmdIYhrqEUHNQhJg/mN3qS+8XN3ThRarCLwBH2y8 l+sjqIsxuvsZBnfNwQAZxZQXH9D1QMp/S5z/lSF72FhBcAk4Cox2QJ96qA9ObfFGYU33 igNg== X-Gm-Message-State: AO0yUKX4eT2BTskSjCDfev1NFu7ukpSptgGYML4mQFgZECWN+OUmJ4GD 33av0dU+xxcImdTKk+OD4vo= X-Google-Smtp-Source: AK7set9hYDxvOQi0xjHhLN/X3aYvdrUsus0F/Am0ploCUlkQQm6XutLDb+3FJsBgq+1sa7AWYzsHnw== X-Received: by 2002:a50:ccd3:0:b0:47a:e008:8662 with SMTP id b19-20020a50ccd3000000b0047ae0088662mr2526553edj.34.1675261662685; Wed, 01 Feb 2023 06:27:42 -0800 (PST) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id cf8-20020a0564020b8800b004a18f2ffb86sm8975564edb.79.2023.02.01.06.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 06:27:42 -0800 (PST) From: Sergey Organov To: Greg Kroah-Hartman Cc: linux-serial@vger.kernel.org, Fabio Estevam , Jiri Slaby , Richard Genoud , Sascha Hauer , Shawn Guo , Tim Harvey , =?UTF-8?q?Tomasz=20Mo=C5=84?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Johan Hovold , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sherry Sun , Stefan Wahren , 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: Wed, 1 Feb 2023 17:26:56 +0300 Message-Id: <20230201142700.4346-4-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230201142700.4346-1-sorganov@gmail.com> References: <87bko4e65y.fsf@osv.gnss.ru> <20230201142700.4346-1-sorganov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_062744_080212_BA52E2E0 X-CRM114-Status: GOOD ( 12.77 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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) -- 2.30.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel