lkml.org 
[lkml]   [2015]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] pstore: add vmalloc error check
From
On Tue, Oct 13, 2015 at 2:27 AM, Geliang Tang <geliangtang@163.com> wrote:
> If vmalloc is failed, return -ENOMEM.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> fs/pstore/pmsg.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
> index feb5dd2..5a2f05a 100644
> --- a/fs/pstore/pmsg.c
> +++ b/fs/pstore/pmsg.c
> @@ -37,6 +37,8 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
> if (buffer_size > PMSG_MAX_BOUNCE_BUFFER_SIZE)
> buffer_size = PMSG_MAX_BOUNCE_BUFFER_SIZE;
> buffer = vmalloc(buffer_size);
> + if (!buffer)
> + return -ENOMEM;
>
> mutex_lock(&pmsg_lock);
> for (i = 0; i < count; ) {
> --
> 1.9.1

I thought I saw this fix come through before? Regardless, thank you!

Acked-by: Kees Cook <keescook@chromium.org>

-Kees


--
Kees Cook
Chrome OS Security


\
 
 \ /
  Last update: 2015-10-13 22:21    [W:0.137 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site