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: <1428417548.20888.105.camel@perches.com>
Date:	Tue, 07 Apr 2015 07:39:08 -0700
From:	Joe Perches <joe@...ches.com>
To:	Daniel J Blueman <daniel@...ascale.com>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org, Steffen Persvold <sp@...ascale.com>
Subject: Re: [PATCH] x86: Fix earlyprintk ttyS2/3

On Tue, 2015-04-07 at 22:29 +0800, Daniel J Blueman wrote:
> Quite a few platforms use ttyS2 for their serial-over-LAN, so fix early
> printk support for ttyS2 and 3, avoiding the need to hard-code the IO port.
[]
> diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c
[]
> @@ -71,15 +71,16 @@ static void parse_earlyprintk(void)
>  			else
>  				pos = e - arg;
>  		} else if (!strncmp(arg + pos, "ttyS", 4)) {
> -			static const int bases[] = { 0x3f8, 0x2f8 };
> -			int idx = 0;
> +			static const int bases[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
> +			unsigned idx = 0;
>  
>  			if (!strncmp(arg + pos, "ttyS", 4))
>  				pos += 4;
>  
> -			if (arg[pos++] == '1')
> -				idx = 1;
> +			if ((arg[pos] - '0') < (sizeof(bases) / sizeof(bases[0])))
> +				idx = arg[pos] - '0';

This doesn't prevent negative indexing in case someone
does something like shift key typo "ttyS!" for "ttyS1".

I've done that.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ