[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f11576a0908052206t421686c9q9a458afee49b1d6f@mail.gmail.com>
Date: Thu, 6 Aug 2009 14:06:11 +0900
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Paul Menage <menage@...gle.com>,
David Rientjes <rientjes@...gle.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Rik van Riel <riel@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>, linux-mm <linux-mm@...ck.org>
Subject: Re: [PATCH 4/4] oom: fix oom_adjust_write() input sanity check.
>> @@ -1033,12 +1033,15 @@ static ssize_t oom_adjust_write(struct f
>> count = sizeof(buffer) - 1;
>> if (copy_from_user(buffer, buf, count))
>> return -EFAULT;
>> +
>> + strstrip(buffer);
>
> +1 for using strstrip()
>
> -1 for using it wrongly. If it strips leading whitespace it will
> return a new address for the caller to use.
Will fix. thanks.
Paul, hehe your kernel/cgroup.c parsing have the same problem. Could you
please fix it too? :-)
> We could mark it __must_check() to prevent reoccurences of this error.
>
> How does this look?
I see.
I'll do and send it.
>
> --- a/fs/proc/base.c~oom-fix-oom_adjust_write-input-sanity-check-fix
> +++ a/fs/proc/base.c
> @@ -1033,8 +1033,7 @@ static ssize_t oom_adjust_write(struct f
> if (copy_from_user(buffer, buf, count))
> return -EFAULT;
>
> - strstrip(buffer);
> - oom_adjust = simple_strtol(buffer, &end, 0);
> + oom_adjust = simple_strtol(strstrip(buffer), &end, 0);
> if (*end)
> return -EINVAL;
> if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
>
>
>> oom_adjust = simple_strtol(buffer, &end, 0);
>
> That should've used strict_strtoul() but it's too late to fix it now.
Perhaps, it's not too late. I never seen userland program pass non number value
into this.
--
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