mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* pstore: pmsg: return -ENOMEM on vmalloc failure
@ 2015-08-20 21:21 Mark Salyzyn
  2015-08-20 21:39 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Salyzyn @ 2015-08-20 21:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Salyzyn, Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pstore: pmsg: return -ENOMEM on vmalloc failure
  2015-08-20 21:21 pstore: pmsg: return -ENOMEM on vmalloc failure Mark Salyzyn
@ 2015-08-20 21:39 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2015-08-20 21:39 UTC (permalink / raw)
  To: Mark Salyzyn; +Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-20 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-20 21:21 pstore: pmsg: return -ENOMEM on vmalloc failure Mark Salyzyn
2015-08-20 21:39 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®