Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210743 > unrolled thread

pstore: pmsg: return -ENOMEM on vmalloc failure

Started byMark Salyzyn <salyzyn@android.com>
First post2015-08-20 23:30 +0200
Last post2015-08-20 23:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  pstore: pmsg: return -ENOMEM on vmalloc failure Mark Salyzyn <salyzyn@android.com> - 2015-08-20 23:30 +0200
    Re: pstore: pmsg: return -ENOMEM on vmalloc failure Kees Cook <keescook@chromium.org> - 2015-08-20 23:40 +0200

#1210743 — pstore: pmsg: return -ENOMEM on vmalloc failure

FromMark Salyzyn <salyzyn@android.com>
Date2015-08-20 23:30 +0200
Subjectpstore: pmsg: return -ENOMEM on vmalloc failure
Message-ID<pZFzk-7l-11@gated-at.bofh.it>
Signed-off-by: Mark Salyzyn <salyzyn@android.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; ) {
-- 
2.5.0.276.gf5e568e

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

[toc] | [next] | [standalone]


#1210746

FromKees Cook <keescook@chromium.org>
Date2015-08-20 23:40 +0200
Message-ID<pZFIZ-io-11@gated-at.bofh.it>
In reply to#1210743
On Thu, Aug 20, 2015 at 2:21 PM, Mark Salyzyn <salyzyn@android.com> wrote:
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>

Eek, yes please.

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

Thanks!

-Kees

> ---
>  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; ) {
> --
> 2.5.0.276.gf5e568e
>



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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web