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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e28d338-7667-f889-fae2-5aba0fdeb647@nokia.com>
Date:   Mon, 12 Sep 2016 13:29:29 +0200
From:   Alexander Sverdlin <alexander.sverdlin@...ia.com>
To:     Guenter Roeck <linux@...ck-us.net>, <linux-kernel@...r.kernel.org>
CC:     <linux-serial@...r.kernel.org>, Jiri Slaby <jslaby@...e.com>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Subject: [PATCH] serial: core: Fix handling of options after MMIO address

Guenter Roeck reported a regression caused by commit "serial: earlycon:
Extend earlycon command line option to support 64-bit addresses":

console= and earlycon= options have the following format:
...,<addr>,<options>

Historically used here simple_strtoul() had no problems with comma, but the
new and recommended kstrtoull() requires null-terminated string and returns
-EINVAL in case there are "options" at the end. There is no recommended to
use function currently that will support it, so stick to obsolete
simple_strtoull() variant.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@...ia.com>
Reported-by: Guenter Roeck <linux@...ck-us.net>
---
 drivers/tty/serial/serial_core.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 89f5d6a..f2c8a8d 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1938,14 +1938,11 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co)
  *	   console=<name>,0x<addr>,<options>
  *	is also accepted; the returned @iotype will be UPIO_MEM.
  *
- *	Returns 0 on success, -EINVAL or -ERANGE on failure
+ *	Returns 0 on success or -EINVAL on failure
  */
 int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
 			char **options)
 {
-	int ret;
-	unsigned long long tmp;
-
 	if (strncmp(p, "mmio,", 5) == 0) {
 		*iotype = UPIO_MEM;
 		p += 5;
@@ -1971,10 +1968,11 @@ int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
 		return -EINVAL;
 	}
 
-	ret = kstrtoull(p, 0, &tmp);
-	if (ret)
-		return ret;
-	*addr = tmp;
+	/*
+	 * Before you replace it with kstrtoull(), think about options separator
+	 * (',') it will not tolerate
+	 */
+	*addr = simple_strtoull(p, NULL, 0);
 	p = strchr(p, ',');
 	if (p)
 		p++;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ