Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1245501 > unrolled thread
| Started by | Geliang Tang <geliangtang@163.com> |
|---|---|
| First post | 2015-10-13 11:40 +0200 |
| Last post | 2015-10-13 22:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] pstore: add vmalloc error check Geliang Tang <geliangtang@163.com> - 2015-10-13 11:40 +0200
Re: [PATCH] pstore: add vmalloc error check Kees Cook <keescook@chromium.org> - 2015-10-13 22:20 +0200
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Date | 2015-10-13 11:40 +0200 |
| Subject | [PATCH] pstore: add vmalloc error check |
| Message-ID | <qj4dQ-2vA-19@gated-at.bofh.it> |
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
--
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]
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2015-10-13 22:20 +0200 |
| Message-ID | <qjedd-o2-17@gated-at.bofh.it> |
| In reply to | #1245501 |
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
--
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