x86: ACPI - add checking for NULL early param
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/5 x86: ACPI - add checking for NULL early param
---
drivers/acpi/tables.c +2 -0
@@ -300,6 +300,8 @@ int __init acpi_table_init(void)static int __init acpi_parse_apic_instance (char *str) { +if (!str) +return -EINVAL ; acpi_apic_instance =simple_strtoul (str,NULL ,0 );
Quoted 8 lines · On Sat, 05 Jul 2008 15:53:35 +0400 Cyrill Gorcunov <[email protected]> wrote:
Signed-off-by Cyrill Gorcunov <[email protected]>---
Index:
linux-2.6.git/drivers/acpi/tables.c
====================================================================
drivers/acpi/tables.c int __init acpi_table_init(void) · line 307
Quoted 8 lines
drivers/acpi/tables.c +2
-0@@ -300,6 +300,8 @@ int __init acpi_table_init(void)static int __init acpi_parse_apic_instance (char *str) { +if (!str) +return -EINVAL ; acpi_apic_instance =simple_strtoul (str,NULL ,0 );
Could you please explain this patch?
[Andrew Morton - Tue, Jul 22, 2008 at 02:53:32AM -0700]
| On Sat, 05 Jul 2008 15:53:35 +0400 Cyrill Gorcunov <[email protected]> wrote: | | > Signed-off-by: Cyrill Gorcunov <[email protected]> | > --- | > | > Index: linux-2.6.git/drivers/acpi/tables.c | > ==================================================================== | > --- linux-2.6.git.orig/drivers/acpi/tables.c 2008-01-21 23:14:47.000000000 +0300 | > +++ linux-2.6.git/drivers/acpi/tables.c 2008-07-05 12:24:16.000000000 +0400 | > @@ -300,6 +300,8 @@ int __init acpi_table_init(void) | > | > static int __init acpi_parse_apic_instance(char *str) | > { | > + if (!str) | > + return -EINVAL; | > | > acpi_apic_instance = simple_strtoul(str, NULL, 0); | > | | Could you please explain this patch? |
we could get NULL deref here - if you start kernel as
qemu-system-x86_64 -kernel arch/x86/boot/bzImage -append "root=/dev/sda acpi_apic_instance" ../images/root-j
so user was not carried about correct boot option and the kernel respond by hang - which is not good I think. Actually - by the patch we easy protect ourself from user-madness :)
- Cyrill -
PATCH 2/5 x86: idle process - add checking for NULL early param
In reply to a message not in the archive---
arch/x86/kernel/process.c +3 -0
@@ -325,6 +325,9 @@ void __cpuinit select_idle_routine(conststatic int __init idle_setup (char *str) { +if (!str) +return -EINVAL ; +if (!strcmp (str,"poll" )) {printk ("using polling idle threads.\n" ); pm_idle = poll_idle;
PATCH 3/5 x86: io delay - add checking for NULL early param
In reply to a message not in the archive---
arch/x86/kernel/io_delay.c +3 -0
@@ -103,6 +103,9 @@ void __init io_delay_init(void)static int __init io_delay_param (char *s) { +if (!s) +return -EINVAL ; +if (!strcmp (s,"0x80" )) io_delay_type =CONFIG_IO_DELAY_TYPE_0X80 ;else if (!strcmp (s,"0xed" ))
PATCH 4/5 x86: smpboot maxcpus - add checking for NULL early param
In reply to a message not in the archive---
arch/x86/kernel/smpboot.c +2 -1
@@ -1383,7 +1383,8 @@ static int __init parse_maxcpus(char *ar {extern unsigned int maxcpus; - maxcpus =simple_strtoul (arg,NULL ,0 ); +if (arg) + maxcpus =simple_strtoul (arg,NULL ,0 );return 0 ; }early_param ("maxcpus" , parse_maxcpus);
PATCH 5/5 x86: e820 memmap - add checking for NULL early param
In reply to a message not in the archive---
arch/x86/kernel/e820.c +3 -0
@@ -1131,6 +1131,9 @@ static int __init parse_memmap_opt(charchar *oldp;u64 start_at, mem_size; +if (!p) +return -EINVAL ; +if (!strcmp (p,"exactmap" )) {#ifdef CONFIG_CRASH_DUMP /*