From: james_p_freyensee@linux.intel.com
To: linux-mm@kvack.org
Cc: gregkh@suse.de, hari.k.kanigeri@intel.com,
james_p_freyensee@linux.intel.com
Subject: [PATCH] kernel buffer overflow kmalloc_slab() fix
Date: Thu, 19 May 2011 12:51:52 -0700 [thread overview]
Message-ID: <1305834712-27805-2-git-send-email-james_p_freyensee@linux.intel.com> (raw)
In-Reply-To: <james_p_freyensee@linux.intel.com>
From: J Freyensee <james_p_freyensee@linux.intel.com>
Currently, kmalloc_index() can return -1, which can be
passed right to the kmalloc_caches[] array, cause a
buffer overflow, and security bug issue (not sure how
likely this can happen, but this case does exist in the code).
This adds a check for -1 and completely prevents this from happening.
Signed-off-by: J Freyensee <james_p_freyensee@linux.intel.com>
---
include/linux/slub_def.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 45ca123..558fa99 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -211,7 +211,7 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
{
int index = kmalloc_index(size);
- if (index == 0)
+ if ((index == 0) || (index == -1))
return NULL;
return kmalloc_caches[index];
--
1.7.2.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2011-05-19 19:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 19:51 james_p_freyensee [this message]
2011-05-19 20:51 ` [PATCH] kernel buffer overflow kmalloc_slab() fix Christoph Lameter
2011-05-19 21:14 ` J Freyensee
2011-05-19 21:24 ` Christoph Lameter
2011-05-19 22:19 ` J Freyensee
2011-05-20 14:32 ` Christoph Lameter
2011-05-20 12:02 ` James Bottomley
2011-05-20 14:33 ` Christoph Lameter
2011-05-20 14:42 ` Christoph Lameter
2011-05-20 18:02 ` J Freyensee
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=1305834712-27805-2-git-send-email-james_p_freyensee@linux.intel.com \
--to=james_p_freyensee@linux.intel.com \
--cc=gregkh@suse.de \
--cc=hari.k.kanigeri@intel.com \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).