lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200305064423.16196-1-acelan.kao@canonical.com>
Date:   Thu,  5 Mar 2020 14:44:23 +0800
From:   AceLan Kao <acelan.kao@...onical.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Allison Randal <allison@...utok.net>,
        Enrico Weigelt <info@...ux.net>,
        Stephen Boyd <swboyd@...omium.org>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Input: i8042 - Fix the selftest retry logic

It returns -NODEV at the first selftest timeout, so the retry logic
doesn't work. Move the return outside of the while loop to make it real
retry 5 times before returns -ENODEV.

BTW, the origin loop will retry 6 times, also fix this.

Signed-off-by: AceLan Kao <acelan.kao@...onical.com>
---
 drivers/input/serio/i8042.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 20ff2bed3917..3f6433a5c8e6 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -944,10 +944,9 @@ static int i8042_controller_selftest(void)
 	 */
 	do {
 
-		if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
-			pr_err("i8042 controller selftest timeout\n");
-			return -ENODEV;
-		}
+		if (i8042_command(&param, I8042_CMD_CTL_TEST))
+			pr_err("i8042 controller selftest timeout (%d/5)\n",
+			       i+1);
 
 		if (param == I8042_RET_CTL_TEST)
 			return 0;
@@ -955,7 +954,9 @@ static int i8042_controller_selftest(void)
 		dbg("i8042 controller selftest: %#x != %#x\n",
 		    param, I8042_RET_CTL_TEST);
 		msleep(50);
-	} while (i++ < 5);
+	} while (++i < 5);
+	if (i == 5)
+		return -ENODEV;
 
 #ifdef CONFIG_X86
 	/*
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ