[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=FwrG43Br3RVNDJ1Z4UJNgfYt6ih=Gv=0HEtG-@mail.gmail.com>
Date: Fri, 4 Feb 2011 12:19:05 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Kamal Mostafa <kamal@...onical.com>, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Len Brown <len.brown@...el.com>,
"Rafael J. Wysocki" <rjw@...k.pl>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param
On Fri, Feb 4, 2011 at 12:09 PM, H. Peter Anvin <hpa@...or.com> wrote:
> On 02/04/2011 11:44 AM, Yinghai Lu wrote:
>> On Thu, Feb 3, 2011 at 5:38 PM, Kamal Mostafa <kamal@...onical.com> wrote:
>>> Avoid removing all of memory and panicing when "mem={invalid}" is
>>> specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on platforms
>>> other than x86_32).
>>>
>>> BugLink: http://bugs.launchpad.net/bugs/553464
>>> Signed-off-by: Kamal Mostafa <kamal@...onical.com>
>>> Cc: <stable@...nel.org>
>>> ---
>>> arch/x86/kernel/e820.c | 3 +++
>>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
>>> index 294f26d..55a59d8 100644
>>> --- a/arch/x86/kernel/e820.c
>>> +++ b/arch/x86/kernel/e820.c
>>> @@ -856,6 +856,9 @@ static int __init parse_memopt(char *p)
>>>
>>> userdef = 1;
>>> mem_size = memparse(p, &p);
>>> + /* don't remove all of memory when handling "mem={invalid}" param */
>>> + if (mem_size == 0)
>>> + return -EINVAL;
>>> e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
>>>
>>> return 0;
>>> --
>>
>> then how about some one pass mem=32M etc?
>>
>> or total wrongly usermap?
>>
>
> All he looks at is when the value returned is zero. It wouldn't be zero
> for any actual value, including mem=32M.
>
when user pass wrong parameter like less 128M, kernel will not boot either.
Do we need to sanity check for that?
Yinghai
--
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