From: Vasiliy Kulikov <segoon@openwall.com>
To: kernel-janitors@vger.kernel.org
Cc: Dave Airlie <airlied@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Tiago Vignatti <tiago.vignatti@nokia.com>,
Mike Travis <travis@sgi.com>, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] gpu: vga: fix ZERO_SIZE_PTR dereference
Date: Sun, 21 Nov 2010 20:39:54 +0300 [thread overview]
Message-ID: <1290361196-14999-1-git-send-email-segoon@openwall.com> (raw)
count is not checked before kmalloc() call, if it is -1 then
kmalloc() returns ZERO_SIZE_PTR. This pointer is then dereferenced.
Also one may pass too big count to generate OOM condition.
To prevent this limit 'count' maximum value. PAGE_SIZE looks OK.
Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
---
Compile tested only.
drivers/gpu/vga/vgaarb.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index c380c65..09e3090 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -836,6 +836,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
int ret_val;
int i;
+ if (count > PAGE_SIZE)
+ count = PAGE_SIZE;
kbuf = kmalloc(count + 1, GFP_KERNEL);
if (!kbuf)
--
1.7.0.4
reply other threads:[~2010-11-21 17:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290361196-14999-1-git-send-email-segoon@openwall.com \
--to=segoon@openwall.com \
--cc=airlied@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiago.vignatti@nokia.com \
--cc=travis@sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®